http://d.puremagic.com/issues/show_bug.cgi?id=1894



--- Comment #5 from Don <clugd...@yahoo.com.au> 2010-05-22 14:21:41 PDT ---
An interim patch:
To patch the worst instance of this (  if (xxx) scope(exit) yyy;
 creating a error which recommends scope(exit) if (xxx) yyy; ),
 add IsScopeGuardStatement() to Statement and OnScopeStatement, and then
add the following lines to statement.c 2300 (IfStatement::semantic())

    // If we can short-circuit evaluate the if statement, don't do the
    // semantic analysis of the skipped code.
    // This feature allows a limited form of conditional compilation.
    condition = condition->optimize(WANTflags);
+    if (ifbody->IsScopeGuardStatement() ) {
+        OnScopeStatement *onsc = ifbody->IsScopeGuardStatement();
+        IfStatement *iff = new IfStatement(loc, arg, condition,
onsc->statement, elsebody);
+        error("Use of ScopeGuardStatement in otherwise empty scope. Did you
mean\n%s",    
+        (new OnScopeStatement(onsc->loc, onsc->tok, iff))->toChars());
+    }

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to