Commit d5199937 authored by Sarah Grebing's avatar Sarah Grebing
Browse files

Highlighting of next ASTNode, revealed a bug in copy method of ASTNodes

parent a6919087
Pipeline #14960 failed with stage
in 2 minutes and 48 seconds
......@@ -61,6 +61,7 @@ public class AssignmentStatement
s.lhs = lhs.copy();
s.rhs = rhs.copy();
s.type = type;
s.setRuleContext(this.ruleContext);
return s;
}
......
......@@ -58,6 +58,7 @@ public class BinaryExpression extends Expression<ParserRuleContext> {
@Override
public BinaryExpression copy() {
BinaryExpression be = new BinaryExpression(left.copy(), operator, right.copy());
be.setRuleContext(this.ruleContext);
return be;
}
......
......@@ -63,6 +63,9 @@ public class CallStatement extends Statement<ScriptLanguageParser.ScriptCommandC
*/
@Override
public CallStatement copy() {
return new CallStatement(command, parameters.copy());
CallStatement s = new CallStatement(command, parameters.copy());
s.setRuleContext(this.getRuleContext());
return s;
}
}
......@@ -52,6 +52,8 @@ public class CaseStatement extends Statement<ScriptLanguageParser.CasesListConte
* {@inheritDoc}
*/
@Override public CaseStatement copy() {
return new CaseStatement(isClosedStmt, body.copy());
CaseStatement cs = new CaseStatement(isClosedStmt, body.copy());
cs.setRuleContext(this.ruleContext);
return cs;
}
}
......@@ -60,6 +60,7 @@ public class CasesStatement extends Statement<ScriptLanguageParser.CasesStmtCont
// c.defaultCase = defaultCase.copy();
if (defCaseStmt != null)
c.defCaseStmt = defCaseStmt.copy();
c.setRuleContext(this.ruleContext);
return c;
}
}
......@@ -42,7 +42,9 @@ public class ClosesCase extends CaseStatement {
*/
@Override
public ClosesCase copy() {
return new ClosesCase(closesScript.copy(), body.copy());
ClosesCase cs = new ClosesCase(closesScript.copy(), body.copy());
cs.setRuleContext(this.ruleContext);
return cs;
}
}
......@@ -31,7 +31,9 @@ public class DefaultCaseStatement extends Statement<ScriptLanguageParser.StmtLis
*/
@Override
public DefaultCaseStatement copy() {
return new DefaultCaseStatement(body.copy());
DefaultCaseStatement dcs = new DefaultCaseStatement(body.copy());
dcs.setRuleContext(this.ruleContext);
return dcs;
}
}
......
......@@ -52,6 +52,8 @@ public class ForeachStatement extends GoalSelector<ScriptLanguageParser.ForEachS
* {@inheritDoc}
*/
@Override public ForeachStatement copy() {
return new ForeachStatement(getBody().copy());
ForeachStatement fs = new ForeachStatement(getBody().copy());
fs.setRuleContext(this.ruleContext);
return fs;
}
}
......@@ -67,6 +67,7 @@ public class MatchExpression extends Expression<ScriptLanguageParser.MatchPatter
if (signature != null)
me.signature = signature.copy();
me.pattern = pattern.copy();
me.setRuleContext(this.ruleContext);
return me;
}
......
......@@ -53,6 +53,7 @@ public class Parameters extends ASTNode<ScriptLanguageParser.ParametersContext>
@Override public Parameters copy() {
Parameters p = new Parameters();
forEach((k, v) -> p.put(k.copy(), v.copy()));
p.setRuleContext(this.getRuleContext());
return p;
}
......
......@@ -54,6 +54,7 @@ public class ProofScript extends ASTNode<ScriptLanguageParser.ScriptContext> {
ps.setName(getName());
ps.setBody(body.copy());
ps.setSignature(signature.copy());
ps.setRuleContext(this.ruleContext);
return ps;
}
......
......@@ -54,6 +54,8 @@ public class RepeatStatement extends GoalSelector<ScriptLanguageParser.RepeatStm
*/
@Override
public RepeatStatement copy() {
return new RepeatStatement(getBody().copy());
RepeatStatement rs = new RepeatStatement(getBody().copy());
rs.setRuleContext(this.ruleContext);
return rs;
}
}
......@@ -54,6 +54,7 @@ public class Signature extends ASTNode<ScriptLanguageParser.ArgListContext> impl
@Override public Signature copy() {
Signature signature = new Signature();
forEach((k, v) -> signature.put(k.copy(), v));
signature.setRuleContext(this.ruleContext);
return signature;
}
......
......@@ -33,7 +33,9 @@ public class SimpleCaseStatement extends CaseStatement {
*/
@Override
public SimpleCaseStatement copy() {
return new SimpleCaseStatement(guard.copy(), body.copy());
SimpleCaseStatement scs = new SimpleCaseStatement(guard.copy(), body.copy());
scs.setRuleContext(this.ruleContext);
return scs;
}
......
......@@ -174,7 +174,12 @@ public class Statements extends ASTNode<ScriptLanguageParser.StmtListContext>
@Override public Statements copy() {
Statements s = new Statements();
forEach(e -> s.add(e.copy()));
forEach(e -> {
Statement ecopy = e.copy();
ecopy.setRuleContext(e.getRuleContext());
s.add(ecopy);
});
s.setRuleContext(this.getRuleContext());
return s;
}
}
......@@ -39,6 +39,7 @@ public class SubstituteExpression extends Expression<ScriptLanguageParser.ExprSu
SubstituteExpression se = new SubstituteExpression();
se.sub = sub.copy();
se.substitution = new LinkedHashMap<>(substitution);
se.setRuleContext(this.ruleContext);
return se;
}
......
......@@ -54,6 +54,8 @@ public class TheOnlyStatement extends GoalSelector<ScriptLanguageParser.TheOnlyS
*/
@Override
public TheOnlyStatement copy() {
return new TheOnlyStatement(getBody().copy());
TheOnlyStatement tos = new TheOnlyStatement(getBody().copy());
tos.setRuleContext(this.ruleContext);
return tos;
}
}
......@@ -29,6 +29,8 @@ public class TryCase extends CaseStatement {
*/
@Override
public TryCase copy() {
return new TryCase(body.copy());
TryCase tc = new TryCase(body.copy());
tc.setRuleContext(this.getRuleContext());
return tc;
}
}
......@@ -61,6 +61,7 @@ public class UnaryExpression extends Expression<ParserRuleContext> {
@Override
public UnaryExpression copy() {
UnaryExpression u = new UnaryExpression(operator, expression.copy());
u.setRuleContext(this.getRuleContext());
return u;
}
......
......@@ -117,7 +117,7 @@ public class InterpreterBuilder {
}
public InterpreterBuilder onEntry(Visitor v) {
interpreter.getEntryListeners().add(v);
interpreter.getEntryListeners().add(0, v);
return this;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment