Browse Source

parser/compiler: set cascade receiver later

During semantic analysis, not during parsing.
Herbert Vojčík 8 years ago
parent
commit
dffc22a68c
4 changed files with 37 additions and 2 deletions
  1. 32 0
      src/Compiler-Semantic.js
  2. 5 0
      src/Compiler-Semantic.st
  3. 0 1
      support/parser.js
  4. 0 1
      support/parser.pegjs

+ 32 - 0
src/Compiler-Semantic.js

@@ -2260,6 +2260,38 @@ messageSends: ["pushScope:", "newBlockScope", "scope:", "node:", "blockIndex:",
 }),
 $globals.SemanticAnalyzer);
 
+$core.addMethod(
+$core.method({
+selector: "visitCascadeNode:",
+protocol: 'visiting',
+fn: function (aNode){
+var self=this;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+$recv(aNode)._receiver_($recv($recv($recv(aNode)._nodes())._first())._receiver());
+(
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+$ctx1.supercall = true, 
+//>>excludeEnd("ctx");
+($globals.SemanticAnalyzer.superclass||$boot.dnu).fn.prototype._visitCascadeNode_.apply($recv(self), [aNode]));
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+$ctx1.supercall = false;
+//>>excludeEnd("ctx");;
+return self;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
+//>>excludeEnd("ctx");
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: ["aNode"],
+source: "visitCascadeNode: aNode\x0a\x09aNode receiver: aNode nodes first receiver.\x0a\x09super visitCascadeNode: aNode",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: ["receiver:", "receiver", "first", "nodes", "visitCascadeNode:"]
+}),
+$globals.SemanticAnalyzer);
+
 $core.addMethod(
 $core.method({
 selector: "visitMethodNode:",

+ 5 - 0
src/Compiler-Semantic.st

@@ -549,6 +549,11 @@ visitBlockNode: aNode
 	self popScope
 !
 
+visitCascadeNode: aNode
+	aNode receiver: aNode nodes first receiver.
+	super visitCascadeNode: aNode
+!
+
 visitMethodNode: aNode
 	self pushScope: self newMethodScope.
 	aNode scope: currentScope.

+ 0 - 1
support/parser.js

@@ -292,7 +292,6 @@ $globals.SmalltalkParser = (function() {
                              return $globals.CascadeNode._new()
                                     ._position_((line()).__at(column()))
                                     ._source_(text())
-                                    ._receiver_(send._receiver())
                                     ._nodes_(messages);
                          },
         peg$c126 = "<",

+ 0 - 1
support/parser.pegjs

@@ -248,7 +248,6 @@ cascade        = send:keywordSend & { return send._isSendNode(); } messages:(ws
                      return $globals.CascadeNode._new()
                             ._position_((line()).__at(column()))
                             ._source_(text())
-                            ._receiver_(send._receiver())
                             ._nodes_(messages);
                  }