Search in sources :

Example 1 with FunctionDescriptor

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);
}
Also used : FunctionDescriptor(cz.cuni.mff.d3s.trupple.parser.identifierstable.types.subroutine.FunctionDescriptor)

Example 2 with FunctionDescriptor

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);
    }
}
Also used : TypeDescriptor(cz.cuni.mff.d3s.trupple.parser.identifierstable.types.TypeDescriptor) FrameSlot(com.oracle.truffle.api.frame.FrameSlot) FunctionDescriptor(cz.cuni.mff.d3s.trupple.parser.identifierstable.types.subroutine.FunctionDescriptor)

Aggregations

FunctionDescriptor (cz.cuni.mff.d3s.trupple.parser.identifierstable.types.subroutine.FunctionDescriptor)2 FrameSlot (com.oracle.truffle.api.frame.FrameSlot)1 TypeDescriptor (cz.cuni.mff.d3s.trupple.parser.identifierstable.types.TypeDescriptor)1