From a803a14b56752a977d2766b96dae76162cb6fd85 Mon Sep 17 00:00:00 2001 From: Kevin Atkinson Date: Fri, 10 Feb 2012 17:27:35 -0700 Subject: Bug fix to accept $ in 0th pos, (ie #ast{$(x) + ...}). Note: part from Niko Matsakis commit: rewrite assert to accept a $ in 0th pos. --- src/comp/syntax/ext/qquote.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/comp') diff --git a/src/comp/syntax/ext/qquote.rs b/src/comp/syntax/ext/qquote.rs index c30762f11c4..6afb3fa3f75 100644 --- a/src/comp/syntax/ext/qquote.rs +++ b/src/comp/syntax/ext/qquote.rs @@ -184,11 +184,12 @@ fn finish let sp = node.span(); let qcx = gather_anti_quotes(sp.lo, node); let cx = qcx; - let prev = 0u; - for {lo: lo, _} in cx.gather { - assert lo > prev; - prev = lo; + + // assert that the vector is sorted by position: + uint::range(1u, vec::len(cx.gather)) {|i| + assert cx.gather[i-1u].lo < cx.gather[i].lo; } + let str2 = ""; enum state {active, skip(uint), blank}; let state = active; -- cgit 1.4.1-3-g733a5