public override void visit_while_statement (WhileStatement stmt) {
// convert to simple loop
push_builder (new CodeBuilder (context, stmt, stmt.source_reference));
-
+ Expression cond = null;
if (!always_false (stmt.condition)) {
b.open_loop ();
if (!always_true (stmt.condition)) {
- b.open_if (new UnaryExpression (UnaryOperator.LOGICAL_NEGATION, stmt.condition, stmt.condition.source_reference));
+ cond = expression (@"!$(stmt.condition)");
+ b.open_if (cond);
b.add_break ();
b.close ();
}
this.source_reference = source_reference;
current_block = new Block (source_reference);
+ current_block.owner = context.analyzer.get_current_symbol (insert_statement).scope;
insert_block = context.analyzer.get_current_block (insert_statement);
insert_block.insert_before (insert_statement, current_block);
this.insert_statement = current_block;
}
public void check (CodeNode node) {
+ var sym = context.analyzer.get_current_symbol (node);
+ if (sym != null) {
+ context.resolver.current_scope = sym.scope;
+ }
node.accept (context.resolver);
if (!node.check (context)) {
return;
*/
public class Vala.SymbolResolver : CodeVisitor {
Symbol root_symbol;
- Scope current_scope;
+ public Scope current_scope;
/**
* Resolve symbol names in the specified code context.