use of cz.cuni.mff.d3s.trupple.parser.identifierstable.types.subroutine.FunctionDescriptor in project TrufflePascal by Aspect26.
the class NodeFactory method createFunctionFormalParameter.
public FormalParameter createFunctionFormalParameter(FunctionHeading heading) {
String identifier = this.getIdentifierFromToken(heading.identifierToken);
FunctionDescriptor descriptor = new FunctionDescriptor(heading.formalParameters, heading.returnTypeDescriptor);
return new FormalParameter(identifier, descriptor, false, heading.descriptor);
}
use of cz.cuni.mff.d3s.trupple.parser.identifierstable.types.subroutine.FunctionDescriptor in project TrufflePascal by Aspect26.
the class NodeFactory method createInvokeNode.
private ExpressionNode createInvokeNode(String identifier, SubroutineDescriptor descriptor, LexicalScope subroutineScope, List<ExpressionNode> argumentNodes) {
ExpressionNode[] arguments = argumentNodes.toArray(new ExpressionNode[argumentNodes.size()]);
TypeDescriptor returnType = (descriptor instanceof FunctionDescriptor) ? ((FunctionDescriptor) descriptor).getReturnDescriptor() : null;
if (subroutineScope instanceof UnitLexicalScope) {
String unitIdentifier = subroutineScope.getName();
return ContextInvokeNodeGen.create(identifier, unitIdentifier, arguments, returnType);
} else {
FrameSlot subroutineSlot = subroutineScope.getLocalSlot(identifier);
return InvokeNodeGen.create(subroutineSlot, arguments, returnType);
}
}
Aggregations