Skip to content

Commit

Permalink
made has operator robust before the dot
Browse files Browse the repository at this point in the history
  • Loading branch information
jurgenvinju committed Nov 13, 2024
1 parent 6050c36 commit 7774c35
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/org/rascalmpl/interpreter/result/ConcreteSyntaxResult.java
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,22 @@ public Result<IBool> has(Name name) {
}
}
}
else if (ProductionAdapter.isError(prod)) {
var eprod = ProductionAdapter.getErrorProd(prod);
int dot = ProductionAdapter.getErrorDot(prod);
IList syms = ProductionAdapter.getSymbols(eprod);
String tmp = Names.name(name);

// only look before the dot.
for (int i = 0; i < dot; i++) {
var sym = syms.get(i);
if (SymbolAdapter.isLabel((IConstructor) sym)) {
if (SymbolAdapter.getLabel((IConstructor) sym).equals(tmp)) {
return ResultFactory.bool(true, ctx);
}
}
}
}
}
return super.has(name);
}
Expand Down

0 comments on commit 7774c35

Please sign in to comment.