Search in sources :

Example 1 with BlockTypeNode

use of st.gravel.support.compiler.ast.BlockTypeNode in project gravel by gravel-st.

the class Parser method parseTypeExpressionBlockAndClose.

public BlockTypeNode parseTypeExpressionBlockAndClose() {
    TypeNode[] _args;
    TypeNode _returnType;
    _args = new TypeNode[] {};
    _returnType = null;
    boolean _temp1 = true;
    while (_temp1) {
        Parser.this.eatWhitespace();
        if (st.gravel.support.jvm.ReadStreamExtensions.peekFor_(_stream, '^')) {
            _returnType = Parser.this.parseTypeNode();
        } else {
            _args = st.gravel.support.jvm.ArrayExtensions.copyWith_(_args, Parser.this.parseTypeNode());
        }
        Parser.this.eatWhitespace();
        _temp1 = st.gravel.support.jvm.ReadStreamExtensions.peekFor_(_stream, ',');
    }
    st.gravel.support.jvm.ObjectExtensions.assert_(this, st.gravel.support.jvm.ReadStreamExtensions.peekFor_(_stream, ']'));
    return BlockTypeNode.factory.arguments_returnType_(_args, _returnType);
}
Also used : BlockTypeNode(st.gravel.support.compiler.ast.BlockTypeNode) SelfTypeNode(st.gravel.support.compiler.ast.SelfTypeNode) InstanceTypeNode(st.gravel.support.compiler.ast.InstanceTypeNode) TypeNode(st.gravel.support.compiler.ast.TypeNode)

Example 2 with BlockTypeNode

use of st.gravel.support.compiler.ast.BlockTypeNode in project gravel by gravel-st.

the class Parser method parseTypeExpressionListAndClose.

public TypeNode[] parseTypeExpressionListAndClose() {
    final BlockTypeNode _block;
    _block = this.parseTypeExpressionBlockAndClose();
    st.gravel.support.jvm.ObjectExtensions.assert_(this, _block.returnType() == null);
    return _block.arguments();
}
Also used : BlockTypeNode(st.gravel.support.compiler.ast.BlockTypeNode)

Example 3 with BlockTypeNode

use of st.gravel.support.compiler.ast.BlockTypeNode in project gravel by gravel-st.

the class SourcePrinter method visitBlockTypeNode_.

@Override
public SourcePrinter visitBlockTypeNode_(final BlockTypeNode _aNode) {
    _stream.append('[');
    boolean _temp1 = true;
    for (final TypeNode _each : _aNode.arguments()) {
        if (_temp1) {
            _temp1 = false;
        } else {
            _stream.append(',');
            _stream.append(' ');
        }
        if (_each == null) {
            _stream.append("Unknown");
        } else {
            SourcePrinter.this.visit_(_each);
        }
    }
    if (_aNode.returnType() != null) {
        if (_aNode.arguments().length != 0) {
            _stream.append(',');
            _stream.append(' ');
        }
        SourcePrinter.this.visit_(_aNode.returnType());
    }
    _stream.append(']');
    return this;
}
Also used : BlockTypeNode(st.gravel.support.compiler.ast.BlockTypeNode) BottomTypeNode(st.gravel.support.compiler.ast.BottomTypeNode) ClassTypeNode(st.gravel.support.compiler.ast.ClassTypeNode) SelfTypeNode(st.gravel.support.compiler.ast.SelfTypeNode) InstanceTypeNode(st.gravel.support.compiler.ast.InstanceTypeNode) TypeNode(st.gravel.support.compiler.ast.TypeNode)

Aggregations

BlockTypeNode (st.gravel.support.compiler.ast.BlockTypeNode)3 InstanceTypeNode (st.gravel.support.compiler.ast.InstanceTypeNode)2 SelfTypeNode (st.gravel.support.compiler.ast.SelfTypeNode)2 TypeNode (st.gravel.support.compiler.ast.TypeNode)2 BottomTypeNode (st.gravel.support.compiler.ast.BottomTypeNode)1 ClassTypeNode (st.gravel.support.compiler.ast.ClassTypeNode)1