1
0
Quellcode durchsuchen

Normalized transformers method code.

Herbert Vojčík vor 8 Jahren
Ursprung
Commit
6d09908b4e
4 geänderte Dateien mit 70 neuen und 35 gelöschten Zeilen
  1. 27 12
      src/Compiler-Core.js
  2. 8 2
      src/Compiler-Core.st
  3. 27 17
      src/Compiler-Inlining.js
  4. 8 4
      src/Compiler-Inlining.st

+ 27 - 12
src/Compiler-Core.js

@@ -225,17 +225,38 @@ var self=this;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
-return $recv($globals.IRJSTranslator)._new();
+var $1;
+$1=$recv(self._irTranslatorClass())._new();
+$recv($1)._currentClass_(self._currentClass());
+return $recv($1)._yourself();
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx1) {$ctx1.fill(self,"irTranslator",{},$globals.CodeGenerator)});
 //>>excludeEnd("ctx");
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: [],
-source: "irTranslator\x0a\x09^ IRJSTranslator new",
+source: "irTranslator\x0a\x09^ self irTranslatorClass new\x0a\x09\x09currentClass: self currentClass;\x0a\x09\x09yourself",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: ["currentClass:", "new", "irTranslatorClass", "currentClass", "yourself"]
+}),
+$globals.CodeGenerator);
+
+$core.addMethod(
+$core.method({
+selector: "irTranslatorClass",
+protocol: 'compiling',
+fn: function (){
+var self=this;
+return $globals.IRJSTranslator;
+
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: [],
+source: "irTranslatorClass\x0a\x09^ IRJSTranslator",
 referencedClasses: ["IRJSTranslator"],
 //>>excludeEnd("ide");
-messageSends: ["new"]
+messageSends: []
 }),
 $globals.CodeGenerator);
 
@@ -274,23 +295,17 @@ var self=this;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
-var $1,$2,$4,$3;
-$1=self._semanticAnalyzer();
-$2=self._translator();
-$4=self._irTranslator();
-$recv($4)._currentClass_(self._currentClass());
-$3=$recv($4)._yourself();
-return [$1,$2,$3];
+return [self._semanticAnalyzer(),self._translator(),self._irTranslator()];
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx1) {$ctx1.fill(self,"transformers",{},$globals.CodeGenerator)});
 //>>excludeEnd("ctx");
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: [],
-source: "transformers\x0a\x09^ {\x0a\x09\x09self semanticAnalyzer.\x0a\x09\x09self translator.\x0a\x09\x09self irTranslator currentClass: self currentClass; yourself\x0a\x09}",
+source: "transformers\x0a\x09^ {\x0a\x09\x09self semanticAnalyzer.\x0a\x09\x09self translator.\x0a\x09\x09self irTranslator\x0a\x09}",
 referencedClasses: [],
 //>>excludeEnd("ide");
-messageSends: ["semanticAnalyzer", "translator", "currentClass:", "irTranslator", "currentClass", "yourself"]
+messageSends: ["semanticAnalyzer", "translator", "irTranslator"]
 }),
 $globals.CodeGenerator);
 

+ 8 - 2
src/Compiler-Core.st

@@ -57,7 +57,13 @@ See `InliningCodeGenerator` for an optimized JavaScript code generation.!
 !CodeGenerator methodsFor: 'compiling'!
 
 irTranslator
-	^ IRJSTranslator new
+	^ self irTranslatorClass new
+		currentClass: self currentClass;
+		yourself
+!
+
+irTranslatorClass
+	^ IRJSTranslator
 !
 
 semanticAnalyzer
@@ -70,7 +76,7 @@ transformers
 	^ {
 		self semanticAnalyzer.
 		self translator.
-		self irTranslator currentClass: self currentClass; yourself
+		self irTranslator
 	}
 !
 

+ 27 - 17
src/Compiler-Inlining.js

@@ -2146,22 +2146,40 @@ $globals.InliningCodeGenerator);
 
 $core.addMethod(
 $core.method({
-selector: "irTranslator",
+selector: "irTranslatorClass",
+protocol: 'compiling',
+fn: function (){
+var self=this;
+return $globals.IRInliningJSTranslator;
+
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: [],
+source: "irTranslatorClass\x0a\x09^ IRInliningJSTranslator",
+referencedClasses: ["IRInliningJSTranslator"],
+//>>excludeEnd("ide");
+messageSends: []
+}),
+$globals.InliningCodeGenerator);
+
+$core.addMethod(
+$core.method({
+selector: "preInliner",
 protocol: 'compiling',
 fn: function (){
 var self=this;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
-return $recv($globals.IRInliningJSTranslator)._new();
+return $recv($globals.ASTPreInliner)._new();
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx1) {$ctx1.fill(self,"irTranslator",{},$globals.InliningCodeGenerator)});
+}, function($ctx1) {$ctx1.fill(self,"preInliner",{},$globals.InliningCodeGenerator)});
 //>>excludeEnd("ctx");
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: [],
-source: "irTranslator\x0a\x09^ IRInliningJSTranslator new",
-referencedClasses: ["IRInliningJSTranslator"],
+source: "preInliner\x0a\x09^ ASTPreInliner new",
+referencedClasses: ["ASTPreInliner"],
 //>>excludeEnd("ide");
 messageSends: ["new"]
 }),
@@ -2176,25 +2194,17 @@ var self=this;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
-var $1,$2,$3,$4,$6,$5;
-$1=self._semanticAnalyzer();
-$2=$recv($globals.ASTPreInliner)._new();
-$3=self._translator();
-$4=self._inliner();
-$6=self._irTranslator();
-$recv($6)._currentClass_(self._currentClass());
-$5=$recv($6)._yourself();
-return [$1,$2,$3,$4,$5];
+return [self._semanticAnalyzer(),self._preInliner(),self._translator(),self._inliner(),self._irTranslator()];
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx1) {$ctx1.fill(self,"transformers",{},$globals.InliningCodeGenerator)});
 //>>excludeEnd("ctx");
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: [],
-source: "transformers\x0a\x09^ {\x0a\x09\x09self semanticAnalyzer.\x0a\x09\x09ASTPreInliner new.\x0a\x09\x09self translator.\x0a\x09\x09self inliner.\x0a\x09\x09self irTranslator currentClass: self currentClass; yourself\x0a\x09}",
-referencedClasses: ["ASTPreInliner"],
+source: "transformers\x0a\x09^ {\x0a\x09\x09self semanticAnalyzer.\x0a\x09\x09self preInliner.\x0a\x09\x09self translator.\x0a\x09\x09self inliner.\x0a\x09\x09self irTranslator\x0a\x09}",
+referencedClasses: [],
 //>>excludeEnd("ide");
-messageSends: ["semanticAnalyzer", "new", "translator", "inliner", "currentClass:", "irTranslator", "currentClass", "yourself"]
+messageSends: ["semanticAnalyzer", "preInliner", "translator", "inliner", "irTranslator"]
 }),
 $globals.InliningCodeGenerator);
 

+ 8 - 4
src/Compiler-Inlining.st

@@ -565,17 +565,21 @@ inliner
 	^ IRInliner new
 !
 
-irTranslator
-	^ IRInliningJSTranslator new
+irTranslatorClass
+	^ IRInliningJSTranslator
+!
+
+preInliner
+	^ ASTPreInliner new
 !
 
 transformers
 	^ {
 		self semanticAnalyzer.
-		ASTPreInliner new.
+		self preInliner.
 		self translator.
 		self inliner.
-		self irTranslator currentClass: self currentClass; yourself
+		self irTranslator
 	}
 ! !