package st.gravel.support.compiler.ast;
/*
This file is automatically generated from typed smalltalk source. Do not edit by hand.
(C) AG5.com
*/
import java.math.BigInteger;
import st.gravel.support.jvm.NonLocalReturn;
import st.gravel.support.compiler.ast.MessageNode;
import st.gravel.support.compiler.ast.MessageNode.MessageNode_Factory;
import st.gravel.support.compiler.ast.Expression;
import st.gravel.support.compiler.ast.NodeVisitor;
import st.gravel.support.compiler.ast.Node;
import st.gravel.support.compiler.ast.SourcePrinter;
import st.gravel.support.compiler.ast.SourcePosition;
public class KeywordMessageNode extends MessageNode implements Cloneable {
public static KeywordMessageNode_Factory factory = new KeywordMessageNode_Factory();
Expression[] _arguments;
public static class KeywordMessageNode_Factory extends MessageNode_Factory {
public KeywordMessageNode basicNew() {
KeywordMessageNode newInstance = new KeywordMessageNode();
newInstance.initialize();
return newInstance;
}
@Override
public KeywordMessageNode receiver_selector_(final Expression _aNode, final String _aString) {
return ((KeywordMessageNode) this.basicNew().initializeReceiver_selector_(_aNode, _aString));
}
public KeywordMessageNode receiver_selector_arguments_(final Expression _aNode, final String _aString, final Expression[] _anArray) {
return ((KeywordMessageNode) this.basicNew().initializeReceiver_selector_arguments_(_aNode, _aString, _anArray));
}
public KeywordMessageNode receiver_selector_argument_(final Expression _aNode, final String _aSymbol, final Expression _argNode1) {
return ((KeywordMessageNode) this.receiver_selector_arguments_(_aNode, _aSymbol, st.gravel.support.jvm.ArrayFactory.with_(_argNode1)));
}
}
static public KeywordMessageNode _receiver_selector_(Object receiver, final Expression _aNode, final String _aString) {
return factory.receiver_selector_(_aNode, _aString);
}
static public KeywordMessageNode _receiver_selector_arguments_(Object receiver, final Expression _aNode, final String _aString, final Expression[] _anArray) {
return factory.receiver_selector_arguments_(_aNode, _aString, _anArray);
}
static public KeywordMessageNode _receiver_selector_argument_(Object receiver, final Expression _aNode, final String _aSymbol, final Expression _argNode1) {
return factory.receiver_selector_argument_(_aNode, _aSymbol, _argNode1);
}
@Override
public <X> X accept_(final NodeVisitor<X> _visitor) {
return _visitor.visitKeywordMessageNode_(this);
}
@Override
public KeywordMessageNode allNodesDo_(final st.gravel.support.jvm.Block1<Object, Node> _aBlock) {
this.nodesDo_(new st.gravel.support.jvm.Block1<Object, Node>() {
@Override
public Object value_(final Node _each) {
return _each.withAllNodesDo_(_aBlock);
}
});
return this;
}
@Override
public KeywordMessageNode allNodesDo_pruneWhere_(final st.gravel.support.jvm.Block1<Object, Node> _aBlock, final st.gravel.support.jvm.Block1<Boolean, Node> _pruneBlock) {
this.nodesDo_(new st.gravel.support.jvm.Block1<Object, Node>() {
@Override
public Object value_(final Node _each) {
if (!_pruneBlock.value_(_each)) {
return _each.withAllNodesDo_pruneWhere_(_aBlock, _pruneBlock);
}
return KeywordMessageNode.this;
}
});
return this;
}
@Override
public Expression argument() {
return _arguments[0];
}
@Override
public Expression[] arguments() {
return _arguments;
}
public KeywordMessageNode copy() {
try {
KeywordMessageNode _temp1 = (KeywordMessageNode) this.clone();
_temp1.postCopy();
return _temp1;
} catch (CloneNotSupportedException e) {
throw new RuntimeException(e);
}
}
@Override
public boolean equals(final Object _anObject) {
if (!super.equals(_anObject)) {
return false;
}
if (this._arguments == null) {
if (!(((KeywordMessageNode) _anObject)._arguments == null)) {
return false;
}
} else {
if (!st.gravel.support.jvm.ArrayExtensions.equals_(this._arguments, ((KeywordMessageNode) _anObject)._arguments)) {
return false;
}
}
return true;
}
public KeywordMessageNode_Factory factory() {
return factory;
}
@Override
public int hashCode() {
return (super.hashCode() ^ java.util.Arrays.hashCode(_arguments));
}
@Override
public KeywordMessageNode initializeReceiver_selector_(final Expression _anIntegerLiteralNode, final String _aString) {
_receiver = _anIntegerLiteralNode;
_selector = _aString;
this.initialize();
return this;
}
public KeywordMessageNode initializeReceiver_selector_arguments_(final Expression _anIntegerLiteralNode, final String _aString, final Expression[] _anArray) {
_receiver = _anIntegerLiteralNode;
_selector = _aString;
_arguments = _anArray;
this.initialize();
return this;
}
@Override
public KeywordMessageNode innerSourceOn_(final StringBuilder _aStream) {
_receiver.sourceOn_(_aStream);
this.sourceSendOn_(_aStream);
return this;
}
@Override
public KeywordMessageNode innerSourceSendOn_(final StringBuilder _aStream) {
final String[] _keywords;
_keywords = st.gravel.support.jvm.StringExtensions.tokensBasedOn_(_selector, ':');
for (int _i = 1; _i <= _arguments.length; _i++) {
final String _keyword;
final Expression _argument;
_keyword = _keywords[_i - 1];
_argument = _arguments[_i - 1];
if (!st.gravel.support.jvm.IntegerExtensions.equals_(_i, 1)) {
_aStream.append(' ');
}
_aStream.append(_keyword);
_aStream.append(':');
_aStream.append(' ');
_argument.sourceOn_(_aStream);
}
return this;
}
@Override
public boolean isTraitRequirementMessage() {
return _receiver.isSelfNode() && st.gravel.support.jvm.StringExtensions.equals_(_selector, "traitRequirementNotDefined:");
}
@Override
public KeywordMessageNode localVarNamesDo_(final st.gravel.support.jvm.Block1<Object, String> _aBlock) {
return this;
}
@Override
public KeywordMessageNode nodesDo_(final st.gravel.support.jvm.Block1<Object, Node> _aBlock) {
_aBlock.value_(_receiver);
for (final Expression _temp1 : _arguments) {
_aBlock.value_(_temp1);
}
return this;
}
@Override
public int numArgs() {
return _arguments.length;
}
@Override
public int precedence() {
return 3;
}
@Override
public KeywordMessageNode prettySourceOn_(final StringBuilder _aStream) {
SourcePrinter.factory.on_(_aStream).visit_(this);
return this;
}
@Override
public KeywordMessageNode printOn_(final StringBuilder _aStream) {
final String _title;
_title = this.factory().toString();
_aStream.append(st.gravel.support.jvm.CharacterExtensions.isVowel(_title.charAt(0)) ? "an " : "a ");
_aStream.append(_title);
_aStream.append('[');
this.sourceOn_(_aStream);
_aStream.append(']');
return this;
}
public KeywordMessageNode pvtSetArguments_(final Expression[] _anArray) {
_arguments = _anArray;
return this;
}
public KeywordMessageNode pvtSetSelector_(final String _aString) {
_selector = _aString;
return this;
}
@Override
public KeywordMessageNode pvtSetSourcePosition_(final SourcePosition _aSourcePosition) {
_sourcePosition = _aSourcePosition;
return this;
}
@Override
public KeywordMessageNode sourceOn_(final StringBuilder _aStream) {
if (!this.needsBrackets()) {
return KeywordMessageNode.this.innerSourceOn_(_aStream);
}
_aStream.append('(');
this.innerSourceOn_(_aStream);
_aStream.append(')');
return this;
}
@Override
public KeywordMessageNode sourceSendOn_(final StringBuilder _aStream) {
_aStream.append(' ');
this.innerSourceSendOn_(_aStream);
return this;
}
@Override
public KeywordMessageNode withAllNodesDo_(final st.gravel.support.jvm.Block1<Object, Node> _aBlock) {
_aBlock.value_(this);
this.allNodesDo_(_aBlock);
return this;
}
@Override
public KeywordMessageNode withAllNodesDo_pruneWhere_(final st.gravel.support.jvm.Block1<Object, Node> _aBlock, final st.gravel.support.jvm.Block1<Boolean, Node> _pruneBlock) {
_aBlock.value_(this);
this.allNodesDo_pruneWhere_(_aBlock, _pruneBlock);
return this;
}
@Override
public KeywordMessageNode withArguments_(final Expression[] _anArray) {
st.gravel.support.jvm.ObjectExtensions.assert_(this, st.gravel.support.jvm.IntegerExtensions.equals_(_anArray.length, _arguments.length));
return this.copy().pvtSetArguments_(_anArray);
}
public KeywordMessageNode withSelector_(final String _aString) {
return this.copy().pvtSetSelector_(_aString);
}
@Override
public KeywordMessageNode withSourcePosition_(final SourcePosition _aSourcePosition) {
if (_sourcePosition == _aSourcePosition) {
return KeywordMessageNode.this;
}
return this.copy().pvtSetSourcePosition_(_aSourcePosition);
}
}