Merge branch 'fix-do-while' into 'master'
visit block first because the condition variable may be initialized inside the block See merge request mkais001/klang!20
This commit is contained in:
@@ -150,8 +150,8 @@ public class ContextAnalysis extends KlangBaseVisitor<Node> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Node visitDoWhileLoop(KlangParser.DoWhileLoopContext ctx) {
|
public Node visitDoWhileLoop(KlangParser.DoWhileLoopContext ctx) {
|
||||||
Node condition = this.visit(ctx.cond);
|
|
||||||
Node block = this.visit(ctx.braced_block());
|
Node block = this.visit(ctx.braced_block());
|
||||||
|
Node condition = this.visit(ctx.cond);
|
||||||
Node result = new DoWhileLoop((Expression) condition, (Block) block);
|
Node result = new DoWhileLoop((Expression) condition, (Block) block);
|
||||||
result.line = ctx.start.getLine();
|
result.line = ctx.start.getLine();
|
||||||
result.col = ctx.start.getCharPositionInLine();
|
result.col = ctx.start.getCharPositionInLine();
|
||||||
|
|||||||
Reference in New Issue
Block a user