Search in sources :

Example 31 with Statement

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

the class ParserTest method testParseUnaryBlockNoTemps.

@Test
public void testParseUnaryBlockNoTemps() {
    final Statement _node;
    _node = Parser.factory.source_("[:a | a foo. 2 bar]").parseExpression();
    assertTrue(st.gravel.support.jvm.ObjectExtensions.equals_(_node.factory(), BlockNode.factory));
    assertEquals((String) "\n[:a | \na foo.\n2 bar]", (String) _node.prettySourceString());
}
Also used : Statement(st.gravel.support.compiler.ast.Statement) Test(org.junit.Test)

Example 32 with Statement

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

the class MessageSendRewriter method visitBinaryMessageNode_.

@Override
public Statement visitBinaryMessageNode_(final BinaryMessageNode _anObject) {
    final st.gravel.core.Symbol _selector;
    final st.gravel.support.jvm.Block1<Statement, MessageNode> _res;
    _selector = st.gravel.core.Symbol.value(_anObject.selector());
    st.gravel.support.jvm.Block1<Statement, MessageNode> _temp1 = _specialSelectors.get(_selector);
    _res = ((st.gravel.support.jvm.Block1<Statement, MessageNode>) _temp1);
    if (_res != null) {
        final Statement _trans;
        _trans = _res.value_(_anObject);
        if (_trans != null) {
            return _trans;
        }
    }
    return super.visitBinaryMessageNode_(_anObject);
}
Also used : BinaryMessageNode(st.gravel.support.compiler.ast.BinaryMessageNode) MessageNode(st.gravel.support.compiler.ast.MessageNode) UnaryMessageNode(st.gravel.support.compiler.ast.UnaryMessageNode) KeywordMessageNode(st.gravel.support.compiler.ast.KeywordMessageNode) Statement(st.gravel.support.compiler.ast.Statement)

Example 33 with Statement

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

the class MessageSendRewriter method visitUnaryMessageNode_.

@Override
public Statement visitUnaryMessageNode_(final UnaryMessageNode _anObject) {
    final st.gravel.core.Symbol _selector;
    final st.gravel.support.jvm.Block1<Statement, MessageNode> _res;
    _selector = st.gravel.core.Symbol.value(_anObject.selector());
    st.gravel.support.jvm.Block1<Statement, MessageNode> _temp1 = _specialSelectors.get(_selector);
    _res = ((st.gravel.support.jvm.Block1<Statement, MessageNode>) _temp1);
    if (_res != null) {
        final Statement _trans;
        _trans = _res.value_(_anObject);
        if (_trans != null) {
            return _trans;
        }
    }
    return super.visitUnaryMessageNode_(_anObject);
}
Also used : BinaryMessageNode(st.gravel.support.compiler.ast.BinaryMessageNode) MessageNode(st.gravel.support.compiler.ast.MessageNode) UnaryMessageNode(st.gravel.support.compiler.ast.UnaryMessageNode) KeywordMessageNode(st.gravel.support.compiler.ast.KeywordMessageNode) Statement(st.gravel.support.compiler.ast.Statement)

Example 34 with Statement

use of st.gravel.support.compiler.ast.Statement 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)

Aggregations

Statement (st.gravel.support.compiler.ast.Statement)34 Test (org.junit.Test)21 VariableDeclarationNode (st.gravel.support.compiler.ast.VariableDeclarationNode)5 BinaryMessageNode (st.gravel.support.compiler.ast.BinaryMessageNode)3 Expression (st.gravel.support.compiler.ast.Expression)3 KeywordMessageNode (st.gravel.support.compiler.ast.KeywordMessageNode)3 MessageNode (st.gravel.support.compiler.ast.MessageNode)3 UnaryMessageNode (st.gravel.support.compiler.ast.UnaryMessageNode)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 SequenceNode (st.gravel.support.compiler.ast.SequenceNode)2 HashMap (java.util.HashMap)1 Map (java.util.Map)1 IntermediateStatement (st.gravel.support.compiler.ast.IntermediateStatement)1 PragmaNode (st.gravel.support.compiler.ast.PragmaNode)1 TypeNode (st.gravel.support.compiler.ast.TypeNode)1 VariableNode (st.gravel.support.compiler.ast.VariableNode)1 VariableScopeAnalyzerState (st.gravel.support.compiler.ast.VariableScopeAnalyzerState)1