Browse Source

Small fixes for helios generators

Nicolas Petton 11 years ago
parent
commit
999c230f5a
2 changed files with 58 additions and 59 deletions
  1. 52 52
      js/Helios-Helpers.js
  2. 6 7
      st/Helios-Helpers.st

+ 52 - 52
js/Helios-Helpers.js

@@ -20,6 +20,29 @@ referencedClasses: []
 }),
 smalltalk.HLGenerationOutput);
 
+smalltalk.addMethod(
+smalltalk.method({
+selector: "compile",
+protocol: 'protocol',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+_st(self["@sourceCodes"])._do_((function(methodSourceCode){
+return smalltalk.withContext(function($ctx2) {
+$1=_st(self["@targetClass"])._includesSelector_(_st(methodSourceCode)._selector());
+if(! smalltalk.assert($1)){
+return _st(self["@targetClass"])._compile_protocol_(_st(methodSourceCode)._sourceCode(),self["@protocol"]);
+};
+}, function($ctx2) {$ctx2.fillBlock({methodSourceCode:methodSourceCode},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"compile",{},smalltalk.HLGenerationOutput)})},
+args: [],
+source: "compile\x0a\x09sourceCodes do: [ :methodSourceCode |\x0a\x09\x09(targetClass includesSelector: methodSourceCode selector)\x0a\x09\x09\x09ifFalse: [ \x0a\x09\x09\x09\x09targetClass \x0a\x09\x09\x09\x09\x09compile: methodSourceCode sourceCode\x0a\x09\x09\x09\x09\x09protocol: protocol ] ]",
+messageSends: ["do:", "ifFalse:", "includesSelector:", "selector", "compile:protocol:", "sourceCode"],
+referencedClasses: []
+}),
+smalltalk.HLGenerationOutput);
+
 smalltalk.addMethod(
 smalltalk.method({
 selector: "initialize",
@@ -72,29 +95,6 @@ referencedClasses: []
 }),
 smalltalk.HLGenerationOutput);
 
-smalltalk.addMethod(
-smalltalk.method({
-selector: "serialize",
-protocol: 'protocol',
-fn: function (){
-var self=this;
-return smalltalk.withContext(function($ctx1) { 
-var $1;
-_st(self["@sourceCodes"])._do_((function(methodSourceCode){
-return smalltalk.withContext(function($ctx2) {
-$1=_st(self["@targetClass"])._includesSelector_(_st(methodSourceCode)._selector());
-if(! smalltalk.assert($1)){
-return _st(self["@targetClass"])._compile_protocol_(_st(methodSourceCode)._sourceCode(),self["@protocol"]);
-};
-}, function($ctx2) {$ctx2.fillBlock({methodSourceCode:methodSourceCode},$ctx1,1)})}));
-return self}, function($ctx1) {$ctx1.fill(self,"serialize",{},smalltalk.HLGenerationOutput)})},
-args: [],
-source: "serialize\x0a\x09sourceCodes do: [ :methodSourceCode |\x0a\x09\x09(targetClass includesSelector: methodSourceCode selector)\x0a\x09\x09\x09ifFalse: [ \x0a\x09\x09\x09\x09targetClass \x0a\x09\x09\x09\x09\x09compile: methodSourceCode sourceCode\x0a\x09\x09\x09\x09\x09protocol: protocol ] ]",
-messageSends: ["do:", "ifFalse:", "includesSelector:", "selector", "compile:protocol:", "sourceCode"],
-referencedClasses: []
-}),
-smalltalk.HLGenerationOutput);
-
 smalltalk.addMethod(
 smalltalk.method({
 selector: "sourceCodes",
@@ -223,7 +223,7 @@ smalltalk.HLGenerator);
 
 smalltalk.addMethod(
 smalltalk.method({
-selector: "compile",
+selector: "generate",
 protocol: 'protocol',
 fn: function (){
 var self=this;
@@ -235,9 +235,9 @@ self._error_("class should not be nil");
 } else {
 $1;
 };
-return self}, function($ctx1) {$ctx1.fill(self,"compile",{},smalltalk.HLGenerator)})},
+return self}, function($ctx1) {$ctx1.fill(self,"generate",{},smalltalk.HLGenerator)})},
 args: [],
-source: "compile\x0a\x0a\x09output targetClass ifNil: [ self error: 'class should not be nil'].",
+source: "generate\x0a\x09output targetClass ifNil: [ self error: 'class should not be nil'].",
 messageSends: ["ifNil:", "targetClass", "error:"],
 referencedClasses: []
 }),
@@ -329,20 +329,20 @@ smalltalk.HLAccessorsGenerator);
 
 smalltalk.addMethod(
 smalltalk.method({
-selector: "compile",
+selector: "generate",
 protocol: 'protocol',
 fn: function (){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
 var $1,$2;
-smalltalk.HLAccessorsGenerator.superclass.fn.prototype._compile.apply(_st(self), []);
+smalltalk.HLAccessorsGenerator.superclass.fn.prototype._generate.apply(_st(self), []);
 $1=_st(self["@output"])._targetClass();
 _st($1)._accessorsSourceCodesWith_(self);
 $2=_st($1)._accessorProtocolWith_(self);
-return self}, function($ctx1) {$ctx1.fill(self,"compile",{},smalltalk.HLAccessorsGenerator)})},
+return self}, function($ctx1) {$ctx1.fill(self,"generate",{},smalltalk.HLAccessorsGenerator)})},
 args: [],
-source: "compile\x0a\x09super compile.\x0a\x09\x0a\x09output targetClass \x0a\x09\x09accessorsSourceCodesWith: self;\x0a\x09\x09accessorProtocolWith: self",
-messageSends: ["compile", "accessorsSourceCodesWith:", "targetClass", "accessorProtocolWith:"],
+source: "generate\x0a\x09super generate.\x0a\x09\x0a\x09output targetClass \x0a\x09\x09accessorsSourceCodesWith: self;\x0a\x09\x09accessorProtocolWith: self",
+messageSends: ["generate", "accessorsSourceCodesWith:", "targetClass", "accessorProtocolWith:"],
 referencedClasses: []
 }),
 smalltalk.HLAccessorsGenerator);
@@ -413,27 +413,6 @@ smalltalk.HLAccessorsGenerator);
 
 smalltalk.addClass('HLInitializeGenerator', smalltalk.HLGenerator, [], 'Helios-Helpers');
 smalltalk.HLInitializeGenerator.comment="I am used to double-dispatch the `initialize` method(s) generation.\x0a\x0aUsage:\x0a\x0a    ^ HLInitializeGenerator new\x0a        class: aClass;\x0a        generate;\x0a        output\x0a\x0aI am a disposable object";
-smalltalk.addMethod(
-smalltalk.method({
-selector: "compile",
-protocol: 'protocol',
-fn: function (){
-var self=this;
-return smalltalk.withContext(function($ctx1) { 
-var $1,$2;
-smalltalk.HLInitializeGenerator.superclass.fn.prototype._compile.apply(_st(self), []);
-$1=_st(self["@output"])._targetClass();
-_st($1)._initializeSourceCodesWith_(self);
-_st($1)._initializeIndexWith_(self);
-$2=_st($1)._initializeProtocolWith_(self);
-return self}, function($ctx1) {$ctx1.fill(self,"compile",{},smalltalk.HLInitializeGenerator)})},
-args: [],
-source: "compile\x0a\x09super compile.\x0a\x09\x0a\x09output targetClass \x0a\x09\x09initializeSourceCodesWith: self;\x0a\x09\x09initializeIndexWith: self;\x0a\x09\x09initializeProtocolWith: self",
-messageSends: ["compile", "initializeSourceCodesWith:", "targetClass", "initializeIndexWith:", "initializeProtocolWith:"],
-referencedClasses: []
-}),
-smalltalk.HLInitializeGenerator);
-
 smalltalk.addMethod(
 smalltalk.method({
 selector: "computeIndexForObject",
@@ -463,6 +442,27 @@ referencedClasses: []
 }),
 smalltalk.HLInitializeGenerator);
 
+smalltalk.addMethod(
+smalltalk.method({
+selector: "generate",
+protocol: 'protocol',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+smalltalk.HLInitializeGenerator.superclass.fn.prototype._generate.apply(_st(self), []);
+$1=_st(self["@output"])._targetClass();
+_st($1)._initializeSourceCodesWith_(self);
+_st($1)._initializeIndexWith_(self);
+$2=_st($1)._initializeProtocolWith_(self);
+return self}, function($ctx1) {$ctx1.fill(self,"generate",{},smalltalk.HLInitializeGenerator)})},
+args: [],
+source: "generate\x0a\x09super generate.\x0a\x09\x0a\x09output targetClass \x0a\x09\x09initializeSourceCodesWith: self;\x0a\x09\x09initializeIndexWith: self;\x0a\x09\x09initializeProtocolWith: self",
+messageSends: ["generate", "initializeSourceCodesWith:", "targetClass", "initializeIndexWith:", "initializeProtocolWith:"],
+referencedClasses: []
+}),
+smalltalk.HLInitializeGenerator);
+
 smalltalk.addMethod(
 smalltalk.method({
 selector: "generateInitializeCodeForObject",

+ 6 - 7
st/Helios-Helpers.st

@@ -45,7 +45,7 @@ addSourceCode: aString
 	sourceCodes add: aString
 !
 
-serialize
+compile
 	sourceCodes do: [ :methodSourceCode |
 		(targetClass includesSelector: methodSourceCode selector)
 			ifFalse: [ 
@@ -100,8 +100,7 @@ initialize
 
 !HLGenerator methodsFor: 'protocol'!
 
-compile
-
+generate
 	output targetClass ifNil: [ self error: 'class should not be nil'].
 ! !
 
@@ -150,8 +149,8 @@ setterFor: anInstanceVariable
 
 !HLAccessorsGenerator methodsFor: 'protocol'!
 
-compile
-	super compile.
+generate
+	super generate.
 	
 	output targetClass 
 		accessorsSourceCodesWith: self;
@@ -235,8 +234,8 @@ retrieveProtocolForObject
 
 !HLInitializeGenerator methodsFor: 'protocol'!
 
-compile
-	super compile.
+generate
+	super generate.
 	
 	output targetClass 
 		initializeSourceCodesWith: self;