private boolean needsSuperCall(Stmnt body) throws CompileError { if (body.getOperator() == BLOCK) body = (Stmnt)body.head(); if (body != null && body.getOperator() == EXPR) { ASTree expr = body.head(); if (expr != null && expr instanceof Expr && ((Expr)expr).getOperator() == CALL) { ASTree target = ((Expr)expr).head(); if (target instanceof Keyword) { int token = ((Keyword)target).get(); return token != THIS && token != SUPER; } } } return true; }
private boolean needsSuperCall(Stmnt body) throws CompileError { if (body.getOperator() == BLOCK) body = (Stmnt)body.head(); if (body != null && body.getOperator() == EXPR) { ASTree expr = body.head(); if (expr != null && expr instanceof Expr && ((Expr)expr).getOperator() == CALL) { ASTree target = ((Expr)expr).head(); if (target instanceof Keyword) { int token = ((Keyword)target).get(); return token != THIS && token != SUPER; } } } return true; }
private Stmnt parseSwitchBlock(SymbolTable tbl) throws CompileError { if (lex.get() != '{') throw new SyntaxError(lex); SymbolTable tbl2 = new SymbolTable(tbl); Stmnt s = parseStmntOrCase(tbl2); if (s == null) throw new CompileError("empty switch block", lex); int op = s.getOperator(); if (op != CASE && op != DEFAULT) throw new CompileError("no case or default in a switch block", lex); Stmnt body = new Stmnt(BLOCK, s); while (lex.lookAhead() != '}') { Stmnt s2 = parseStmntOrCase(tbl2); if (s2 != null) { int op2 = s2.getOperator(); if (op2 == CASE || op2 == DEFAULT) { body = (Stmnt)ASTList.concat(body, new Stmnt(BLOCK, s2)); s = s2; } else s = (Stmnt)ASTList.concat(s, new Stmnt(BLOCK, s2)); } } lex.get(); // '}' return body; }
private Stmnt parseSwitchBlock(SymbolTable tbl) throws CompileError { if (lex.get() != '{') throw new SyntaxError(lex); SymbolTable tbl2 = new SymbolTable(tbl); Stmnt s = parseStmntOrCase(tbl2); if (s == null) throw new CompileError("empty switch block", lex); int op = s.getOperator(); if (op != CASE && op != DEFAULT) throw new CompileError("no case or default in a switch block", lex); Stmnt body = new Stmnt(BLOCK, s); while (lex.lookAhead() != '}') { Stmnt s2 = parseStmntOrCase(tbl2); if (s2 != null) { int op2 = s2.getOperator(); if (op2 == CASE || op2 == DEFAULT) { body = (Stmnt)ASTList.concat(body, new Stmnt(BLOCK, s2)); s = s2; } else s = (Stmnt)ASTList.concat(s, new Stmnt(BLOCK, s2)); } } lex.get(); // '}' return body; }
int npairs = 0; for (ASTList list = body; list != null; list = list.tail()) if (((Stmnt)list.head()).getOperator() == CASE) ++npairs; for (ASTList list = body; list != null; list = list.tail()) { Stmnt label = (Stmnt)list.head(); int op = label.getOperator(); if (op == DEFAULT) defaultPc = bytecode.currentPc();
int npairs = 0; for (ASTList list = body; list != null; list = list.tail()) if (((Stmnt)list.head()).getOperator() == CASE) ++npairs; for (ASTList list = body; list != null; list = list.tail()) { Stmnt label = (Stmnt)list.head(); int op = label.getOperator(); if (op == DEFAULT) defaultPc = bytecode.currentPc();
return; // empty int op = st.getOperator(); if (op == EXPR) { ASTree expr = st.getLeft();
return; // empty int op = st.getOperator(); if (op == EXPR) { ASTree expr = st.getLeft();
private boolean needsSuperCall(Stmnt body) throws CompileError { if (body.getOperator() == BLOCK) body = (Stmnt)body.head(); if (body != null && body.getOperator() == EXPR) { ASTree expr = body.head(); if (expr != null && expr instanceof Expr && ((Expr)expr).getOperator() == CALL) { ASTree target = ((Expr)expr).head(); if (target instanceof Keyword) { int token = ((Keyword)target).get(); return token != THIS && token != SUPER; } } } return true; }
private boolean needsSuperCall(Stmnt body) throws CompileError { if (body.getOperator() == BLOCK) body = (Stmnt)body.head(); if (body != null && body.getOperator() == EXPR) { ASTree expr = body.head(); if (expr != null && expr instanceof Expr && ((Expr)expr).getOperator() == CALL) { ASTree target = ((Expr)expr).head(); if (target instanceof Keyword) { int token = ((Keyword)target).get(); return token != THIS && token != SUPER; } } } return true; }
private boolean needsSuperCall(Stmnt body) throws CompileError { if (body.getOperator() == BLOCK) body = (Stmnt)body.head(); if (body != null && body.getOperator() == EXPR) { ASTree expr = body.head(); if (expr != null && expr instanceof Expr && ((Expr)expr).getOperator() == CALL) { ASTree target = ((Expr)expr).head(); if (target instanceof Keyword) { int token = ((Keyword)target).get(); return token != THIS && token != SUPER; } } } return true; }
private boolean needsSuperCall(Stmnt body) throws CompileError { if (body.getOperator() == BLOCK) body = (Stmnt)body.head(); if (body != null && body.getOperator() == EXPR) { ASTree expr = body.head(); if (expr != null && expr instanceof Expr && ((Expr)expr).getOperator() == CALL) { ASTree target = ((Expr)expr).head(); if (target instanceof Keyword) { int token = ((Keyword)target).get(); return token != THIS && token != SUPER; } } } return true; }
private boolean needsSuperCall(Stmnt body) throws CompileError { if (body.getOperator() == BLOCK) body = (Stmnt)body.head(); if (body != null && body.getOperator() == EXPR) { ASTree expr = body.head(); if (expr != null && expr instanceof Expr && ((Expr)expr).getOperator() == CALL) { ASTree target = ((Expr)expr).head(); if (target instanceof Keyword) { int token = ((Keyword)target).get(); return token != THIS && token != SUPER; } } } return true; }
private Stmnt parseSwitchBlock(SymbolTable tbl) throws CompileError { if (lex.get() != '{') throw new SyntaxError(lex); SymbolTable tbl2 = new SymbolTable(tbl); Stmnt s = parseStmntOrCase(tbl2); if (s == null) throw new CompileError("empty switch block", lex); int op = s.getOperator(); if (op != CASE && op != DEFAULT) throw new CompileError("no case or default in a switch block", lex); Stmnt body = new Stmnt(BLOCK, s); while (lex.lookAhead() != '}') { Stmnt s2 = parseStmntOrCase(tbl2); if (s2 != null) { int op2 = s2.getOperator(); if (op2 == CASE || op2 == DEFAULT) { body = (Stmnt)ASTList.concat(body, new Stmnt(BLOCK, s2)); s = s2; } else s = (Stmnt)ASTList.concat(s, new Stmnt(BLOCK, s2)); } } lex.get(); // '}' return body; }
private Stmnt parseSwitchBlock(SymbolTable tbl) throws CompileError { if (lex.get() != '{') throw new SyntaxError(lex); SymbolTable tbl2 = new SymbolTable(tbl); Stmnt s = parseStmntOrCase(tbl2); if (s == null) throw new CompileError("empty switch block", lex); int op = s.getOperator(); if (op != CASE && op != DEFAULT) throw new CompileError("no case or default in a switch block", lex); Stmnt body = new Stmnt(BLOCK, s); while (lex.lookAhead() != '}') { Stmnt s2 = parseStmntOrCase(tbl2); if (s2 != null) { int op2 = s2.getOperator(); if (op2 == CASE || op2 == DEFAULT) { body = (Stmnt)ASTList.concat(body, new Stmnt(BLOCK, s2)); s = s2; } else s = (Stmnt)ASTList.concat(s, new Stmnt(BLOCK, s2)); } } lex.get(); // '}' return body; }
private Stmnt parseSwitchBlock(SymbolTable tbl) throws CompileError { if (lex.get() != '{') throw new SyntaxError(lex); SymbolTable tbl2 = new SymbolTable(tbl); Stmnt s = parseStmntOrCase(tbl2); if (s == null) throw new CompileError("empty switch block", lex); int op = s.getOperator(); if (op != CASE && op != DEFAULT) throw new CompileError("no case or default in a switch block", lex); Stmnt body = new Stmnt(BLOCK, s); while (lex.lookAhead() != '}') { Stmnt s2 = parseStmntOrCase(tbl2); if (s2 != null) { int op2 = s2.getOperator(); if (op2 == CASE || op2 == DEFAULT) { body = (Stmnt)ASTList.concat(body, new Stmnt(BLOCK, s2)); s = s2; } else s = (Stmnt)ASTList.concat(s, new Stmnt(BLOCK, s2)); } } lex.get(); // '}' return body; }
private Stmnt parseSwitchBlock(SymbolTable tbl) throws CompileError { if (lex.get() != '{') throw new SyntaxError(lex); SymbolTable tbl2 = new SymbolTable(tbl); Stmnt s = parseStmntOrCase(tbl2); if (s == null) throw new CompileError("empty switch block", lex); int op = s.getOperator(); if (op != CASE && op != DEFAULT) throw new CompileError("no case or default in a switch block", lex); Stmnt body = new Stmnt(BLOCK, s); while (lex.lookAhead() != '}') { Stmnt s2 = parseStmntOrCase(tbl2); if (s2 != null) { int op2 = s2.getOperator(); if (op2 == CASE || op2 == DEFAULT) { body = (Stmnt)ASTList.concat(body, new Stmnt(BLOCK, s2)); s = s2; } else s = (Stmnt)ASTList.concat(s, new Stmnt(BLOCK, s2)); } } lex.get(); // '}' return body; }
private Stmnt parseSwitchBlock(SymbolTable tbl) throws CompileError { if (lex.get() != '{') throw new SyntaxError(lex); SymbolTable tbl2 = new SymbolTable(tbl); Stmnt s = parseStmntOrCase(tbl2); if (s == null) throw new CompileError("empty switch block", lex); int op = s.getOperator(); if (op != CASE && op != DEFAULT) throw new CompileError("no case or default in a switch block", lex); Stmnt body = new Stmnt(BLOCK, s); while (lex.lookAhead() != '}') { Stmnt s2 = parseStmntOrCase(tbl2); if (s2 != null) { int op2 = s2.getOperator(); if (op2 == CASE || op2 == DEFAULT) { body = (Stmnt)ASTList.concat(body, new Stmnt(BLOCK, s2)); s = s2; } else s = (Stmnt)ASTList.concat(s, new Stmnt(BLOCK, s2)); } } lex.get(); // '}' return body; }
int npairs = 0; for (ASTList list = body; list != null; list = list.tail()) if (((Stmnt)list.head()).getOperator() == CASE) ++npairs; for (ASTList list = body; list != null; list = list.tail()) { Stmnt label = (Stmnt)list.head(); int op = label.getOperator(); if (op == DEFAULT) defaultPc = bytecode.currentPc();
return; // empty int op = st.getOperator(); if (op == EXPR) { ASTree expr = st.getLeft();