use of st.gravel.support.compiler.ast.MessageNode in project gravel by gravel-st.
the class Parser method parseMessageChain_.
public Expression parseMessageChain_(final Expression _receiver) {
final Expression _exp;
List<MessageNode> _messages;
_exp = this.parseNoCascadeMessageChain_(_receiver);
this.eatWhitespace();
if (st.gravel.support.jvm.ReadStreamExtensions.peekFor_(_stream, ';')) {
final MessageNode _baseMsg;
_messages = new java.util.ArrayList();
_baseMsg = ((MessageNode) _exp);
_messages.add(_baseMsg);
boolean _temp1 = true;
while (_temp1) {
final MessageNode _msg;
_msg = ((MessageNode) Parser.this.parseNoCascadeMessageChain_(_baseMsg.receiver()));
_messages.add(_msg);
_temp1 = st.gravel.support.jvm.ReadStreamExtensions.peekFor_(_stream, ';');
}
return CascadeNode.factory.messages_(_messages.toArray(new MessageNode[_messages.size()]));
}
return _exp;
}
use of st.gravel.support.compiler.ast.MessageNode in project gravel by gravel-st.
the class SourcePrinter method visitPragmaNode_.
@Override
public SourcePrinter visitPragmaNode_(final PragmaNode _aPragmaNode) {
final MessageNode _aNode;
_stream.append('<');
_aNode = _aPragmaNode.expression();
if (st.gravel.support.jvm.IntegerExtensions.equals_(_aNode.arguments().length, 0)) {
_stream.append(_aNode.selector());
} else {
st.gravel.support.jvm.ArrayExtensions.with_do_separatedBy_(_aNode.keywords(), _aNode.arguments(), new st.gravel.support.jvm.Block2<Object, String, Expression>() {
@Override
public Object value_value_(final String _key, final Expression _value) {
_stream.append(_key);
_stream.append(' ');
return SourcePrinter.this.visit_(_value);
}
}, new st.gravel.support.jvm.Block0<Object>() {
@Override
public Object value() {
return _stream.append(' ');
}
});
}
_stream.append('>');
return this;
}
use of st.gravel.support.compiler.ast.MessageNode in project gravel by gravel-st.
the class JVMMethodCompiler method produceSuperSend_.
public JVMMethodCompiler produceSuperSend_(final MessageNode _messageNode) {
final st.gravel.core.Symbol _selector;
final SuperNode _superNode;
final String _functionName;
String _superFN;
_superNode = ((SuperNode) _messageNode.receiver());
this.produceVarRead_("self");
for (final Node _arg : _messageNode.arguments()) {
JVMMethodCompiler.this.visit_(_arg);
}
_selector = st.gravel.core.Symbol.value(_messageNode.selector());
_functionName = _parent.selectorConverter().selectorAsFunctionName_(_selector);
if (_isBlock) {
final JVMMethodType _superSig;
JVMMethodCompiler.this.ensureCast_(_parent.selfType());
_superFN = "access$" + _functionName;
_superSig = JVMMethodType.factory.dynamic_(_messageNode.numArgs()).copyWithFirst_(_parent.selfType());
JVMMethodCompiler.this.emit_(InvokeStatic.factory.ownerType_name_signature_(_parent.ownerType(), _superFN, _superSig));
_parent.addInvokeSuper_functionName_numArgs_superReference_superSig_(_superFN, _functionName, _selector.numArgs(), _superNode.reference().toString(), _superSig);
} else {
JVMMethodCompiler.this.emit_(DynamicSuperSend.factory.functionName_numArgs_superReference_(_functionName, _selector.numArgs(), _superNode.reference().toString()));
}
return this;
}
use of st.gravel.support.compiler.ast.MessageNode in project gravel by gravel-st.
the class CascadeNode method innerSourceOn_.
@Override
public CascadeNode innerSourceOn_(final StringBuilder _aStream) {
this.receiver().sourceOn_(_aStream);
boolean _temp1 = true;
for (final MessageNode _msg : _messages) {
if (_temp1) {
_temp1 = false;
} else {
_aStream.append(';');
_aStream.append(' ');
}
_msg.sourceSendOn_(_aStream);
}
return this;
}
use of st.gravel.support.compiler.ast.MessageNode 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);
}
Aggregations