This enables us to add all local variable Definitions to the DAST so that downstream visitors don't need to compute the local variables of a function again.
24 lines
656 B
Java
24 lines
656 B
Java
package de.hsrm.compiler.Klang.nodes;
|
|
|
|
import de.hsrm.compiler.Klang.nodes.statements.VariableDeclaration;
|
|
import de.hsrm.compiler.Klang.visitors.Visitor;
|
|
|
|
public class FunctionDefinition extends Node {
|
|
|
|
public String name;
|
|
public Parameter[] parameters;
|
|
public VariableDeclaration[] localVariables;
|
|
public Block block;
|
|
|
|
public FunctionDefinition(String name, Parameter[] parameters, VariableDeclaration[] localVariables, Block block) {
|
|
this.name = name;
|
|
this.parameters = parameters;
|
|
this.block = block;
|
|
this.localVariables = localVariables;
|
|
}
|
|
|
|
@Override
|
|
public <R> R welcome(Visitor<R> v) {
|
|
return v.visit(this);
|
|
}
|
|
} |