Skip to content

Commit

Permalink
detected unsupported combination of pattern operators. splices should…
Browse files Browse the repository at this point in the history
… be top-level in a list. fixes #1124
  • Loading branch information
jurgenvinju committed Sep 15, 2017
1 parent b5c4a3a commit 19ceecd
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/org/rascalmpl/semantics/dynamic/Expression.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
import org.rascalmpl.interpreter.staticErrors.UninitializedPatternMatch;
import org.rascalmpl.interpreter.staticErrors.UninitializedVariable;
import org.rascalmpl.interpreter.staticErrors.UnsupportedOperation;
import org.rascalmpl.interpreter.staticErrors.UnsupportedPattern;
import org.rascalmpl.interpreter.types.FunctionType;
import org.rascalmpl.interpreter.types.NonTerminalType;
import org.rascalmpl.interpreter.types.OverloadedFunctionType;
Expand Down Expand Up @@ -2851,7 +2852,12 @@ public VariableBecomes(ISourceLocation __param1, IConstructor tree, Name __param

@Override
public IMatchingResult buildMatcher(IEvaluatorContext eval) {
IMatchingResult pat = this.getPattern().buildMatcher(eval);
org.rascalmpl.ast.Expression pattern = this.getPattern();

if (pattern instanceof Splice) {
throw new UnsupportedPattern("named splices (i.e. name:*pattern)", this);
}
IMatchingResult pat = pattern.buildMatcher(eval);
LinkedList<Name> names = new LinkedList<Name>();
names.add(this.getName());
IMatchingResult var = new QualifiedNamePattern(eval, this, ASTBuilder.<org.rascalmpl.ast.QualifiedName> make("QualifiedName", "Default", this.getLocation(), names));
Expand Down

0 comments on commit 19ceecd

Please sign in to comment.