From 030404c793cd20bf8b7eb11f91f3f0f8010bf52a Mon Sep 17 00:00:00 2001 From: Tim Chevalier Date: Thu, 19 Apr 2012 14:26:45 -0700 Subject: [PATCH] Cleanup FIXMEs in syntax::ext::qquote Inline some one-off functions, add an error message, annotate a FIXME --- src/librustsyntax/ext/qquote.rs | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/src/librustsyntax/ext/qquote.rs b/src/librustsyntax/ext/qquote.rs index f95c902cb6d1..e625ba55fed3 100644 --- a/src/librustsyntax/ext/qquote.rs +++ b/src/librustsyntax/ext/qquote.rs @@ -96,13 +96,15 @@ impl of qq_helper for @ast::pat { fn gather_anti_quotes(lo: uint, node: N) -> aq_ctxt { - let v = @{visit_expr: visit_aq_expr, - visit_ty: visit_aq_ty + let v = @{visit_expr: {|node, &&cx, v| + visit_aq(node, "from_expr", cx, v)}, + visit_ty: {|node, &&cx, v| + visit_aq(node, "from_ty", cx, v)} with *default_visitor()}; let cx = @{lo:lo, mut gather: []}; node.visit(cx, mk_vt(v)); // FIXME: Maybe this is an overkill (merge_sort), it might be better - // to just keep the gather array in sorted order ... + // to just keep the gather array in sorted order ... (Issue #2250) cx.gather = std::sort::merge_sort({|a,b| a.lo < b.lo}, copy cx.gather); ret cx; } @@ -117,14 +119,6 @@ fn visit_aq(node: T, constr: str, &&cx: aq_ctxt, v: vt) _ {node.visit(cx, v);} } } -// FIXME: these are only here because I (kevina) couldn't figure out how to -// get bind to work in gather_anti_quotes -fn visit_aq_expr(node: @ast::expr, &&cx: aq_ctxt, v: vt) { - visit_aq(node,"from_expr",cx,v); -} -fn visit_aq_ty(node: @ast::ty, &&cx: aq_ctxt, v: vt) { - visit_aq(node,"from_ty",cx,v); -} fn is_space(c: char) -> bool { parse::lexer::is_whitespace(c) @@ -180,8 +174,8 @@ fn parse_stmt(p: parser) -> @ast::stmt { fn parse_item(p: parser) -> @ast::item { alt (parser::parse_item(p, [])) { - some(item) {item} - none {fail; /* FIXME: Error message, somehow */} + some(item) { item } + none { fail "parse_item: parsing an item failed"; } } }