Browse Source

asBranchSendNode

Herbert Vojčík 8 years ago
parent
commit
55c4c2095c
4 changed files with 39 additions and 6 deletions
  1. 28 0
      src/Compiler-AST.js
  2. 7 0
      src/Compiler-AST.st
  3. 2 3
      support/parser.js
  4. 2 3
      support/parser.pegjs

+ 28 - 0
src/Compiler-AST.js

@@ -1925,6 +1925,34 @@ $core.addClass('QuasiSendNode', $globals.Node, ['receiver'], 'Compiler-AST');
 //>>excludeStart("ide", pragmas.excludeIdeData);
 $globals.QuasiSendNode.comment="I am a node that has a receiver.\x0a\x0aMy subclasses are `SendNode`, `CascadeNode` and `BranchSendNode`.";
 //>>excludeEnd("ide");
+$core.addMethod(
+$core.method({
+selector: "asBranchSendNode",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $BranchSendNode(){return $globals.BranchSendNode||(typeof BranchSendNode=="undefined"?nil:BranchSendNode)}
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+var $1;
+$1=$recv($BranchSendNode())._new();
+$recv($1)._nodes_([self]);
+$recv($1)._position_(self._position());
+return $recv($1)._source_(self._source());
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"asBranchSendNode",{},$globals.QuasiSendNode)});
+//>>excludeEnd("ctx");
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: [],
+source: "asBranchSendNode\x0a\x09^ BranchSendNode new\x0a\x09\x09nodes: {self};\x0a\x09\x09position: self position;\x0a\x09\x09source: self source",
+referencedClasses: ["BranchSendNode"],
+//>>excludeEnd("ide");
+messageSends: ["nodes:", "new", "position:", "position", "source:", "source"]
+}),
+$globals.QuasiSendNode);
+
 $core.addMethod(
 $core.method({
 selector: "receiver",

+ 7 - 0
src/Compiler-AST.st

@@ -446,6 +446,13 @@ My subclasses are `SendNode`, `CascadeNode` and `BranchSendNode`.!
 
 !QuasiSendNode methodsFor: 'accessing'!
 
+asBranchSendNode
+	^ BranchSendNode new
+		nodes: {self};
+		position: self position;
+		source: self source
+!
+
 receiver
 	^ receiver
 !

+ 2 - 3
support/parser.js

@@ -244,10 +244,9 @@ $globals.SmalltalkParser = (function() {
                                         ._source_(text())
                                         ._nodes_(messages);
         					 }
-        					 return $globals.BranchSendNode._new()
+        					 return send._asBranchSendNode()
                                     ._location_(location())
-                                    ._source_(text())
-                                    ._nodes_([send]);
+                                    ._source_(text());
                          },
         peg$c115 = function(message, tail) {
                              if(tail) {

+ 2 - 3
support/parser.pegjs

@@ -172,10 +172,9 @@ augment = "(" send:(wsBinaryTail / wsKeywordMessage / wsUnaryTail) messages:(ws
                                 ._source_(text())
                                 ._nodes_(messages);
 					 }
-					 return $globals.BranchSendNode._new()
+					 return send._asBranchSendNode()
                             ._location_(location())
-                            ._source_(text())
-                            ._nodes_([send]);
+                            ._source_(text());
                  }
 
 wsAugmentTail      = ws message:augment tail:wsAugmentTail? {