Search in sources :

Example 16 with Expression

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

the class LiteralSendInliner method visitNonLocalReturnNode_.

@Override
public Statement visitNonLocalReturnNode_(final NonLocalReturnNode _anObject) {
    Statement _value;
    _value = ((Statement) this.visit_(_anObject.value()));
    if (_value.isNonLocalReturnNode()) {
        return _value;
    }
    if (_value.isReturnNode()) {
        _value = _value.returnValue();
    }
    if ((_localNlrMarker != null) && st.gravel.support.jvm.StringExtensions.equals_(_localNlrMarker, _anObject.marker())) {
        return ReturnNode.factory.value_(((Expression) _value));
    }
    return NonLocalReturnNode.factory.marker_value_(_anObject.marker(), ((Expression) _value));
}
Also used : Expression(st.gravel.support.compiler.ast.Expression) Statement(st.gravel.support.compiler.ast.Statement)

Example 17 with Expression

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

the class InlineExpressionCollection method innerSourceOn_.

@Override
public InlineExpressionCollection innerSourceOn_(final StringBuilder _aStream) {
    _aStream.append("{");
    boolean _temp1 = true;
    for (final Expression _each : _expressions) {
        if (_temp1) {
            _temp1 = false;
        } else {
            _aStream.append(". ");
        }
        _each.innerSourceOn_(_aStream);
    }
    _aStream.append("]}");
    return this;
}
Also used : Expression(st.gravel.support.compiler.ast.Expression)

Example 18 with Expression

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

the class IntermediateNodeRewriter method produce_or_.

public BooleanOrNode produce_or_(final Node _receiver, final Expression _testExpr) {
    final BlockNode _testBlockNode;
    if (!_testExpr.isBlockNode()) {
        return null;
    }
    _testBlockNode = ((BlockNode) _testExpr);
    return BooleanOrNode.factory.left_right_(((Expression) this.visit_(_receiver)), ((SequenceNode) this.visit_(_testBlockNode.body())));
}
Also used : BlockNode(st.gravel.support.compiler.ast.BlockNode) Expression(st.gravel.support.compiler.ast.Expression) SequenceNode(st.gravel.support.compiler.ast.SequenceNode)

Example 19 with Expression

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

the class Parser method parseBinaryMessageChain_receiver_.

public Expression parseBinaryMessageChain_receiver_(final String _aString, final Expression _rec) {
    final Expression _arg;
    final BinaryMessageNode _receiver;
    this.eatWhitespace();
    _arg = this.parseUnaryMessage();
    this.eatWhitespace();
    _receiver = BinaryMessageNode.factory.receiver_selector_argument_(_rec, _aString, _arg);
    return this.parseBinaryOrUnaryMessage_(_receiver);
}
Also used : BinaryMessageNode(st.gravel.support.compiler.ast.BinaryMessageNode) Expression(st.gravel.support.compiler.ast.Expression)

Example 20 with Expression

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

the class VariableAccessToFieldAccessConverter method visitAssignmentNode_.

@Override
public Expression visitAssignmentNode_(final AssignmentNode _anObject) {
    final VariableDeclarationNode _instVar;
    if (this.includesLocalName_(_anObject.variable().name())) {
        return LocalWriteNode.factory.name_value_(_anObject.variable().name(), ((Expression) VariableAccessToFieldAccessConverter.this.visit_(_anObject.value())));
    }
    _instVar = this.instVarAt_(_anObject.variable().name());
    if (_instVar != null) {
        return FieldWriteNode.factory.owner_field_type_value_(_owner, _instVar.name(), _instVar.type(), ((Expression) VariableAccessToFieldAccessConverter.this.visit_(_anObject.value())));
    }
    return GlobalWriteNode.factory.namespace_name_value_(_namespace, _anObject.variable().name(), ((Expression) this.visit_(_anObject.value())));
}
Also used : VariableDeclarationNode(st.gravel.support.compiler.ast.VariableDeclarationNode) Expression(st.gravel.support.compiler.ast.Expression)

Aggregations

Expression (st.gravel.support.compiler.ast.Expression)25 SequenceNode (st.gravel.support.compiler.ast.SequenceNode)7 BlockNode (st.gravel.support.compiler.ast.BlockNode)6 ArrayList (java.util.ArrayList)3 BinaryMessageNode (st.gravel.support.compiler.ast.BinaryMessageNode)3 MessageNode (st.gravel.support.compiler.ast.MessageNode)3 Statement (st.gravel.support.compiler.ast.Statement)3 VariableDeclarationNode (st.gravel.support.compiler.ast.VariableDeclarationNode)3 ArrayLiteralNode (st.gravel.support.compiler.ast.ArrayLiteralNode)2 StringLiteralNode (st.gravel.support.compiler.ast.StringLiteralNode)2 List (java.util.List)1 ArrayAtNode (st.gravel.support.compiler.ast.ArrayAtNode)1 ArrayAtPutNode (st.gravel.support.compiler.ast.ArrayAtPutNode)1 ArraySizeNode (st.gravel.support.compiler.ast.ArraySizeNode)1 BlockTypeNode (st.gravel.support.compiler.ast.BlockTypeNode)1 BooleanAndNode (st.gravel.support.compiler.ast.BooleanAndNode)1 BooleanLiteralNode (st.gravel.support.compiler.ast.BooleanLiteralNode)1 BooleanOrNode (st.gravel.support.compiler.ast.BooleanOrNode)1 ByteArrayLiteralNode (st.gravel.support.compiler.ast.ByteArrayLiteralNode)1 CascadeNode (st.gravel.support.compiler.ast.CascadeNode)1