Result<IValue> r = eval.getEvaluator().getCurrentEnvt().getSimpleVariable(name);
if (r != null) {
if (r.getValue() != null) {
// Previously declared and initialized variable
return new QualifiedNamePattern(eval, this, name);
}
Type type = r.getType();
if (type instanceof NonTerminalType) {
NonTerminalType cType = (NonTerminalType) type;
if (cType.isConcreteListType()) {
return new ConcreteListVariablePattern(eval, this, type, ((Default) name).lastName());
}
}
return new QualifiedNamePattern(eval, this, name);
}
// TODO: I don't understand which feature this code implements
// if (eval.getCurrentEnvt().isTreeConstructorName(name, signature)) {
// return new NodePattern(eval, this, null, name, new ArrayList<IMatchingResult>());
// }
// Completely fresh variable
return new QualifiedNamePattern(eval, this, name);
// return new AbstractPatternTypedVariable(vf, env,
// ev.tf.valueType(), name);
}