public Send ( |
||
message | ||
Результат |
public STObject EvaluateUnarySend(STObject receiver, Node unarySend, Context context) { receiver = receiver.Dereference(); return receiver.Send(STSymbol.Get((unarySend.GetChildAt(0) as Token).Image)); }
public STObject EvaluateBinarySend(STObject receiver, Node binarySend, Context context) { STObject other = EvaluateReceiver(binarySend.GetChildAt(1), context).Dereference(); receiver = receiver.Dereference(); for (int i = 2, max = binarySend.GetChildCount(); i < max; ++i) other = EvaluateUnarySend(other, binarySend.GetChildAt(i), context); return receiver.Send(STSymbol.Get((binarySend.GetChildAt(0) as Token).Image), other); }
public STObject EvaluateKeywordSend(STObject receiver, Node keywordSend, Context context) { receiver = receiver.Dereference(); // keyword_send = ( KEYWORD receiver simple_send* )+; string keyword = null; STObject parm = null; StringBuilder selectorBuffer = new StringBuilder(); List<STObject> parms = new List<STObject>(); for (int i = 0, max = keywordSend.GetChildCount(); i < max; ++i) { var item = keywordSend.GetChildAt(i); if (item.Name == "KEYWORD") { if (keyword != null) { selectorBuffer.Append(keyword); parms.Add (parm); } keyword = (item as Token).Image; parm = EvaluateReceiver(keywordSend.GetChildAt(++i), context).Dereference(); } else if (item.Name == "simple_send") { parm = EvaluateSimpleSend(parm, item, context); } } selectorBuffer.Append(keyword); parms.Add (parm); STSymbol selector = STSymbol.Get(selectorBuffer.ToString()); return receiver.Send(selector, parms.ToArray()); }
public STObject New() { var obj = new STObject(); obj.Class = this; obj.Send(STSymbol.Get("initialize")); return obj; }