Forráskód Böngészése

Move js statement node into sequence.

Herby Vojčík 6 éve
szülő
commit
b0fd9ce5aa
4 módosított fájl, 184 hozzáadás és 209 törlés
  1. 7 20
      src/Compiler-IR.js
  2. 2 3
      src/Compiler-IR.st
  3. 174 183
      support/parser.js
  4. 1 3
      support/parser.pegjs

+ 7 - 20
src/Compiler-IR.js

@@ -832,7 +832,7 @@ $recv($15)._add_($16);
 $ctx1.sendIdx["add:"]=3;
 //>>excludeEnd("ctx");
 $23=$recv($globals.IRVerbatim)._new();
-$recv($23)._source_("");
+$recv($23)._source_(";".__comma($recv($globals.String)._lf()));
 $22=$recv($23)._yourself();
 $recv($15)._add_($22);
 }
@@ -843,10 +843,10 @@ return $self._method();
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: ["aNode"],
-source: "visitMethodNode: aNode\x0a\x0a\x09self method: (IRMethod new\x0a\x09\x09source: self source crlfSanitized;\x0a\x09\x09theClass: self theClass;\x0a\x09\x09arguments: aNode arguments;\x0a\x09\x09selector: aNode selector;\x0a\x09\x09sendIndexes: aNode sendIndexes;\x0a\x09\x09requiresSmalltalkContext: aNode requiresSmalltalkContext;\x0a\x09\x09classReferences: aNode classReferences;\x0a\x09\x09scope: aNode scope;\x0a\x09\x09yourself).\x0a\x0a\x09aNode scope temps do: [ :each |\x0a\x09\x09self method add: (IRTempDeclaration new\x0a\x09\x09\x09name: each name;\x0a\x09\x09\x09scope: aNode scope;\x0a\x09\x09\x09yourself) ].\x0a\x0a\x09aNode dagChildren do: [ :each | self method add: (self visit: each) ].\x0a\x0a\x09aNode scope hasLocalReturn ifFalse: [self method\x0a\x09\x09add: (IRReturn new\x0a\x09\x09\x09add: (IRVariable new\x0a\x09\x09\x09\x09variable: (aNode scope pseudoVars at: 'self');\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself);\x0a\x09\x09add: (IRVerbatim new source: ''; yourself) ].\x0a\x0a\x09^ self method",
-referencedClasses: ["IRMethod", "IRTempDeclaration", "IRReturn", "IRVariable", "IRVerbatim"],
+source: "visitMethodNode: aNode\x0a\x0a\x09self method: (IRMethod new\x0a\x09\x09source: self source crlfSanitized;\x0a\x09\x09theClass: self theClass;\x0a\x09\x09arguments: aNode arguments;\x0a\x09\x09selector: aNode selector;\x0a\x09\x09sendIndexes: aNode sendIndexes;\x0a\x09\x09requiresSmalltalkContext: aNode requiresSmalltalkContext;\x0a\x09\x09classReferences: aNode classReferences;\x0a\x09\x09scope: aNode scope;\x0a\x09\x09yourself).\x0a\x0a\x09aNode scope temps do: [ :each |\x0a\x09\x09self method add: (IRTempDeclaration new\x0a\x09\x09\x09name: each name;\x0a\x09\x09\x09scope: aNode scope;\x0a\x09\x09\x09yourself) ].\x0a\x0a\x09aNode dagChildren do: [ :each | self method add: (self visit: each) ].\x0a\x0a\x09aNode scope hasLocalReturn ifFalse: [self method\x0a\x09\x09add: (IRReturn new\x0a\x09\x09\x09add: (IRVariable new\x0a\x09\x09\x09\x09variable: (aNode scope pseudoVars at: 'self');\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself);\x0a\x09\x09add: (IRVerbatim new source: ';', String lf; yourself) ].\x0a\x0a\x09^ self method",
+referencedClasses: ["IRMethod", "IRTempDeclaration", "IRReturn", "IRVariable", "IRVerbatim", "String"],
 //>>excludeEnd("ide");
-messageSends: ["method:", "source:", "new", "crlfSanitized", "source", "theClass:", "theClass", "arguments:", "arguments", "selector:", "selector", "sendIndexes:", "sendIndexes", "requiresSmalltalkContext:", "requiresSmalltalkContext", "classReferences:", "classReferences", "scope:", "scope", "yourself", "do:", "temps", "add:", "method", "name:", "name", "dagChildren", "visit:", "ifFalse:", "hasLocalReturn", "variable:", "at:", "pseudoVars"]
+messageSends: ["method:", "source:", "new", "crlfSanitized", "source", "theClass:", "theClass", "arguments:", "arguments", "selector:", "selector", "sendIndexes:", "sendIndexes", "requiresSmalltalkContext:", "requiresSmalltalkContext", "classReferences:", "classReferences", "scope:", "scope", "yourself", "do:", "temps", "add:", "method", "name:", "name", "dagChildren", "visit:", "ifFalse:", "hasLocalReturn", "variable:", "at:", "pseudoVars", ",", "lf"]
 }),
 $globals.IRASTTranslator);
 
@@ -4125,20 +4125,7 @@ var self=this,$self=this;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
-var $1;
-$1=$self._stream();
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-$ctx1.sendIdx["stream"]=1;
-//>>excludeEnd("ctx");
-$recv($1)._nextPutStatementWith_((function(){
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-return $core.withContext(function($ctx2) {
-//>>excludeEnd("ctx");
-return $recv($self._stream())._nextPutAll_($recv(anIRVerbatim)._source());
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
-//>>excludeEnd("ctx");
-}));
+$recv($self._stream())._nextPutAll_($recv(anIRVerbatim)._source());
 return self;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRJSTranslator)});
@@ -4146,10 +4133,10 @@ return self;
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: ["anIRVerbatim"],
-source: "visitIRVerbatim: anIRVerbatim\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self stream nextPutAll: anIRVerbatim source ]",
+source: "visitIRVerbatim: anIRVerbatim\x0a\x09self stream nextPutAll: anIRVerbatim source",
 referencedClasses: [],
 //>>excludeEnd("ide");
-messageSends: ["nextPutStatementWith:", "stream", "nextPutAll:", "source"]
+messageSends: ["nextPutAll:", "stream", "source"]
 }),
 $globals.IRJSTranslator);
 

+ 2 - 3
src/Compiler-IR.st

@@ -199,7 +199,7 @@ visitMethodNode: aNode
 				variable: (aNode scope pseudoVars at: 'self');
 				yourself);
 			yourself);
-		add: (IRVerbatim new source: ''; yourself) ].
+		add: (IRVerbatim new source: ';', String lf; yourself) ].
 
 	^ self method
 !
@@ -993,8 +993,7 @@ visitIRVariable: anIRVariable
 !
 
 visitIRVerbatim: anIRVerbatim
-	self stream nextPutStatementWith: [
-		self stream nextPutAll: anIRVerbatim source ]
+	self stream nextPutAll: anIRVerbatim source
 !
 
 visitInstructionList: anArray enclosedBetween: aString and: anotherString

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 174 - 183
support/parser.js


+ 1 - 3
support/parser.pegjs

@@ -190,9 +190,7 @@ wsStatements =
 	} /
 	expressions:wsExpressions? {return expressions || [];}
 
-wsSequenceWs = (ws js:jsSequence ws {return js;}) / wsStSequenceWs
-
-wsStSequenceWs = ws temps:temps? statements:wsStatements? maybeDotsWs {
+wsSequenceWs = ws temps:temps? statements:(ws js:jsSequence ws {return [js];} / st:wsStatements maybeDotsWs {return st;})? {
 	return $globals.SequenceNode._new()
 		._location_(location())
 		._source_(text())

Nem az összes módosított fájl került megjelenítésre, mert túl sok fájl változott