expr.definitions.forEach(extract_candidates);
} else if (expr instanceof AST_DWLoop) {
extract_candidates(expr.condition);
+ if (!(expr.body instanceof AST_Block)) {
+ extract_candidates(expr.body);
+ }
} else if (expr instanceof AST_Exit) {
if (expr.value) extract_candidates(expr.value);
} else if (expr instanceof AST_For) {
if (expr.init) extract_candidates(expr.init);
if (expr.condition) extract_candidates(expr.condition);
if (expr.step) extract_candidates(expr.step);
+ if (!(expr.body instanceof AST_Block)) {
+ extract_candidates(expr.body);
+ }
} else if (expr instanceof AST_If) {
extract_candidates(expr.condition);
+ if (!(expr.body instanceof AST_Block)) {
+ extract_candidates(expr.body);
+ }
+ if (expr.alternative && !(expr.alternative instanceof AST_Block)) {
+ extract_candidates(expr.alternative);
+ }
} else if (expr instanceof AST_Sequence) {
expr.expressions.forEach(extract_candidates);
} else if (expr instanceof AST_SimpleStatement) {
if (parent instanceof AST_Call) return node;
if (parent instanceof AST_Case) return node;
if (parent instanceof AST_Conditional) return node;
+ if (parent instanceof AST_Definitions) return find_stop(parent, level + 1);
if (parent instanceof AST_Exit) return node;
if (parent instanceof AST_If) return node;
if (parent instanceof AST_IterationStatement) return node;
if (parent instanceof AST_Sequence) return find_stop(parent, level + 1);
+ if (parent instanceof AST_SimpleStatement) return find_stop(parent, level + 1);
if (parent instanceof AST_Switch) return node;
if (parent instanceof AST_VarDef) return node;
return null;