package chocopy.common.astnodes; import chocopy.common.analysis.NodeAnalyzer; import java_cup.runtime.ComplexSymbolFactory.Location; import java.util.List; /** Def statements. */ public class FuncDef extends Declaration { /** Defined name. */ public final Identifier name; /** Formal parameters. */ public final List params; /** Return type annotation. */ public final TypeAnnotation returnType; /** Local-variable,inner-function, global, and nonlocal declarations. */ public final List declarations; /** Other statements. */ public final List statements; /** * The AST for def NAME(PARAMS) -> RETURNTYPE: DECLARATIONS STATEMENTS spanning source locations * [LEFT..RIGHT]. */ public FuncDef( Location left, Location right, Identifier name, List params, TypeAnnotation returnType, List declarations, List statements) { super(left, right); this.name = name; this.params = params; this.returnType = returnType; this.declarations = declarations; this.statements = statements; } public T dispatch(NodeAnalyzer analyzer) { return analyzer.analyze(this); } @Override public Identifier getIdentifier() { return this.name; } }