Browse Source

#transformersDictionary to config transformers.

Herbert Vojčík 8 years ago
parent
commit
6922e8462e
4 changed files with 93 additions and 27 deletions
  1. 52 8
      src/Compiler-Core.js
  2. 12 6
      src/Compiler-Core.st
  3. 23 5
      src/Compiler-Inlining.js
  4. 6 8
      src/Compiler-Inlining.st

+ 52 - 8
src/Compiler-Core.js

@@ -192,18 +192,51 @@ selector: "transformers",
 protocol: 'compiling',
 fn: function (){
 var self=this;
+var dict;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+dict=self._transformersDictionary();
+return $recv($recv($recv($recv(dict)._keys())._asArray())._sort())._collect_((function(each){
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx2) {
+//>>excludeEnd("ctx");
+return $recv(dict)._at_(each);
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
+//>>excludeEnd("ctx");
+}));
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"transformers",{dict:dict},$globals.AbstractCodeGenerator)});
+//>>excludeEnd("ctx");
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: [],
+source: "transformers\x0a\x09| dict |\x0a\x09dict := self transformersDictionary.\x0a\x09^ dict keys asArray sort collect: [ :each | dict at: each ] ",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: ["transformersDictionary", "collect:", "sort", "asArray", "keys", "at:"]
+}),
+$globals.AbstractCodeGenerator);
+
+$core.addMethod(
+$core.method({
+selector: "transformersDictionary",
+protocol: 'compiling',
+fn: function (){
+var self=this;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
 self._subclassResponsibility();
 return self;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx1) {$ctx1.fill(self,"transformers",{},$globals.AbstractCodeGenerator)});
+}, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{},$globals.AbstractCodeGenerator)});
 //>>excludeEnd("ctx");
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: [],
-source: "transformers\x0a\x09self subclassResponsibility",
+source: "transformersDictionary\x0a\x09self subclassResponsibility",
 referencedClasses: [],
 //>>excludeEnd("ide");
 messageSends: ["subclassResponsibility"]
@@ -288,24 +321,35 @@ $globals.CodeGenerator);
 
 $core.addMethod(
 $core.method({
-selector: "transformers",
+selector: "transformersDictionary",
 protocol: 'compiling',
 fn: function (){
 var self=this;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
-return [self._semanticAnalyzer(),self._translator(),self._irTranslator()];
+var $1;
+$1=$recv($globals.Dictionary)._new();
+$recv($1)._at_put_("2000-semantic",self._semanticAnalyzer());
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+$ctx1.sendIdx["at:put:"]=1;
+//>>excludeEnd("ctx");
+$recv($1)._at_put_("5000-astToIr",self._translator());
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx1) {$ctx1.fill(self,"transformers",{},$globals.CodeGenerator)});
+$ctx1.sendIdx["at:put:"]=2;
+//>>excludeEnd("ctx");
+$recv($1)._at_put_("8000-irToJs",self._irTranslator());
+return $recv($1)._yourself();
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{},$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\x0a\x09}",
-referencedClasses: [],
+source: "transformersDictionary\x0a\x09^ Dictionary new\x0a\x09\x09at: '2000-semantic' put: self semanticAnalyzer;\x0a\x09\x09at: '5000-astToIr' put: self translator;\x0a\x09\x09at: '8000-irToJs' put: self irTranslator;\x0a\x09\x09yourself",
+referencedClasses: ["Dictionary"],
 //>>excludeEnd("ide");
-messageSends: ["semanticAnalyzer", "translator", "irTranslator"]
+messageSends: ["at:put:", "new", "semanticAnalyzer", "translator", "irTranslator", "yourself"]
 }),
 $globals.CodeGenerator);
 

+ 12 - 6
src/Compiler-Core.st

@@ -44,6 +44,12 @@ compileNode: aNode
 !
 
 transformers
+	| dict |
+	dict := self transformersDictionary.
+	^ dict keys asArray sort collect: [ :each | dict at: each ]
+!
+
+transformersDictionary
 	self subclassResponsibility
 ! !
 
@@ -72,12 +78,12 @@ semanticAnalyzer
 		yourself
 !
 
-transformers
-	^ {
-		self semanticAnalyzer.
-		self translator.
-		self irTranslator
-	}
+transformersDictionary
+	^ Dictionary new
+		at: '2000-semantic' put: self semanticAnalyzer;
+		at: '5000-astToIr' put: self translator;
+		at: '8000-irToJs' put: self irTranslator;
+		yourself
 !
 
 translator

+ 23 - 5
src/Compiler-Inlining.js

@@ -2187,24 +2187,42 @@ $globals.InliningCodeGenerator);
 
 $core.addMethod(
 $core.method({
-selector: "transformers",
+selector: "transformersDictionary",
 protocol: 'compiling',
 fn: function (){
 var self=this;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
-return [self._semanticAnalyzer(),self._preInliner(),self._translator(),self._inliner(),self._irTranslator()];
+var $1;
+$1=(
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+$ctx1.supercall = true,
+//>>excludeEnd("ctx");
+($globals.InliningCodeGenerator.superclass||$boot.nilAsClass).fn.prototype._transformersDictionary.apply($recv(self), []));
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+$ctx1.supercall = false;
+//>>excludeEnd("ctx");;
+$recv($1)._at_put_("3000-inlinerTagging",self._preInliner());
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+$ctx1.sendIdx["at:put:"]=1;
+//>>excludeEnd("ctx");
+$recv($1)._at_put_("6000-inliner",self._inliner());
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+$ctx1.sendIdx["at:put:"]=2;
+//>>excludeEnd("ctx");
+$recv($1)._at_put_("8000-irToJs",self._irTranslator());
+return $recv($1)._yourself();
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx1) {$ctx1.fill(self,"transformers",{},$globals.InliningCodeGenerator)});
+}, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{},$globals.InliningCodeGenerator)});
 //>>excludeEnd("ctx");
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: [],
-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}",
+source: "transformersDictionary\x0a\x09^ super transformersDictionary\x0a\x09\x09at: '3000-inlinerTagging' put: self preInliner;\x0a\x09\x09at: '6000-inliner' put: self inliner;\x0a\x09\x09at: '8000-irToJs' put: self irTranslator;\x0a\x09\x09yourself",
 referencedClasses: [],
 //>>excludeEnd("ide");
-messageSends: ["semanticAnalyzer", "preInliner", "translator", "inliner", "irTranslator"]
+messageSends: ["at:put:", "transformersDictionary", "preInliner", "inliner", "irTranslator", "yourself"]
 }),
 $globals.InliningCodeGenerator);
 

+ 6 - 8
src/Compiler-Inlining.st

@@ -573,14 +573,12 @@ preInliner
 	^ ASTPreInliner new
 !
 
-transformers
-	^ {
-		self semanticAnalyzer.
-		self preInliner.
-		self translator.
-		self inliner.
-		self irTranslator
-	}
+transformersDictionary
+	^ super transformersDictionary
+		at: '3000-inlinerTagging' put: self preInliner;
+		at: '6000-inliner' put: self inliner;
+		at: '8000-irToJs' put: self irTranslator;
+		yourself
 ! !
 
 SemanticError subclass: #InliningError