Skip to content

Commit

Permalink
returns "recovered" for getConstructor name on error productions such…
Browse files Browse the repository at this point in the history
… that "is" operator and others work on error trees. This does reserve the constructor name "recovered" for use in error versions..
  • Loading branch information
jurgenvinju committed Nov 13, 2024
1 parent 7774c35 commit e964a65
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public Result<IBool> is(Name name) {
return ResultFactory.bool(Names.name(name).equals(consName), ctx);
}
}

return ResultFactory.bool(false, ctx);
}

Expand Down
11 changes: 8 additions & 3 deletions src/org/rascalmpl/values/parsetrees/ProductionAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,15 @@ private ProductionAdapter() {
* @return a constructor name if present or null otherwise
*/
public static String getConstructorName(IConstructor tree) {
IConstructor def = getDefined(tree);
if (isDefault(tree)) {
IConstructor def = getDefined(tree);

if (SymbolAdapter.isLabel(def)) {
return SymbolAdapter.getLabel(def);
if (SymbolAdapter.isLabel(def)) {
return SymbolAdapter.getLabel(def);
}
}
else if (isError(tree)) {
return "recovered";

Check warning on line 49 in src/org/rascalmpl/values/parsetrees/ProductionAdapter.java

View check run for this annotation

Codecov / codecov/patch

src/org/rascalmpl/values/parsetrees/ProductionAdapter.java#L49

Added line #L49 was not covered by tests
}

return null;
Expand Down

0 comments on commit e964a65

Please sign in to comment.