You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
747 B
25 lines
747 B
package chocopy.common.astnodes;
|
|
|
|
import chocopy.common.analysis.NodeAnalyzer;
|
|
import java_cup.runtime.ComplexSymbolFactory.Location;
|
|
|
|
/** An identifier with attached type annotation. */
|
|
public class TypedVar extends Node {
|
|
|
|
/** The typed identifier. */
|
|
public final Identifier identifier;
|
|
/** The declared type. */
|
|
public final TypeAnnotation type;
|
|
|
|
/** The AST for IDENTIFIER : TYPE. spanning source locations [LEFT..RIGHT]. */
|
|
public TypedVar(Location left, Location right, Identifier identifier, TypeAnnotation type) {
|
|
super(left, right);
|
|
this.identifier = identifier;
|
|
this.type = type;
|
|
}
|
|
|
|
public <T> T dispatch(NodeAnalyzer<T> analyzer) {
|
|
return analyzer.analyze(this);
|
|
}
|
|
}
|