Browse Source

Fix review

Benjamin Van Ryseghem 11 years ago
parent
commit
7f9719441e
4 changed files with 54 additions and 58 deletions
  1. 8 8
      js/Helios-Commands-Browser.js
  2. 35 39
      js/Helios-Helpers.js
  3. 4 4
      st/Helios-Commands-Browser.st
  4. 7 7
      st/Helios-Helpers.st

+ 8 - 8
js/Helios-Commands-Browser.js

@@ -443,7 +443,7 @@ smalltalk.HLGenerateCommand.klass);
 
 
 smalltalk.addClass('HLGenerateAccessorsCommand', smalltalk.HLGenerateCommand, [], 'Helios-Commands-Browser');
-smalltalk.HLGenerateAccessorsCommand.comment="I am the command used to generate the `initialize` method depending of the selected class";
+smalltalk.HLGenerateAccessorsCommand.comment="I am the command used to generate the `getter` and the `setter` methods depending of the selected class";
 smalltalk.addMethod(
 smalltalk.method({
 selector: "execute",
@@ -462,7 +462,7 @@ _st($2)._class_(targetClass);
 _st($2)._generate();
 $3=_st($2)._output();
 output=$3;
-_st(output)._serialize();
+_st(output)._compile();
 first=_st(_st(output)._sourceCodes())._first();
 $4=self._model();
 _st($4)._selectedProtocol_(_st(output)._protocol());
@@ -470,8 +470,8 @@ _st($4)._selectedMethod_(_st(targetClass).__gt_gt(_st(first)._selector()));
 $5=_st($4)._focusOnSourceCode();
 return self}, function($ctx1) {$ctx1.fill(self,"execute",{targetClass:targetClass,output:output,first:first},smalltalk.HLGenerateAccessorsCommand)})},
 args: [],
-source: "execute\x0a\x09| targetClass output first |\x0a\x09targetClass := self model selectedClass.\x0a\x0a\x09output := HLInitializeGenerator new\x0a\x09\x09class: targetClass;\x0a\x09\x09generate;\x0a\x09\x09output.\x0a\x09\x09\x0a\x09output serialize.\x0a\x09first := output sourceCodes first.\x0a\x09self model\x0a\x09\x09selectedProtocol: output protocol;\x0a\x09\x09selectedMethod:(targetClass>>first selector);\x0a\x09\x09focusOnSourceCode",
-messageSends: ["selectedClass", "model", "class:", "new", "generate", "output", "serialize", "first", "sourceCodes", "selectedProtocol:", "protocol", "selectedMethod:", ">>", "selector", "focusOnSourceCode"],
+source: "execute\x0a\x09| targetClass output first |\x0a\x09targetClass := self model selectedClass.\x0a\x0a\x09output := HLInitializeGenerator new\x0a\x09\x09class: targetClass;\x0a\x09\x09generate;\x0a\x09\x09output.\x0a\x09\x09\x0a\x09output compile.\x0a\x09first := output sourceCodes first.\x0a\x09self model\x0a\x09\x09selectedProtocol: output protocol;\x0a\x09\x09selectedMethod:(targetClass>>first selector);\x0a\x09\x09focusOnSourceCode",
+messageSends: ["selectedClass", "model", "class:", "new", "generate", "output", "compile", "first", "sourceCodes", "selectedProtocol:", "protocol", "selectedMethod:", ">>", "selector", "focusOnSourceCode"],
 referencedClasses: ["HLInitializeGenerator"]
 }),
 smalltalk.HLGenerateAccessorsCommand);
@@ -511,7 +511,7 @@ smalltalk.HLGenerateAccessorsCommand.klass);
 
 
 smalltalk.addClass('HLGenerateInitializeCommand', smalltalk.HLGenerateCommand, [], 'Helios-Commands-Browser');
-smalltalk.HLGenerateInitializeCommand.comment="I am the command used to generate the `gettet` and the `setter` methods depending of the selected class";
+smalltalk.HLGenerateInitializeCommand.comment="I am the command used to generate the `initialize` method depending of the selected class";
 smalltalk.addMethod(
 smalltalk.method({
 selector: "execute",
@@ -530,12 +530,12 @@ _st($2)._class_(targetClass);
 _st($2)._generate();
 $3=_st($2)._output();
 output=$3;
-_st(output)._serialize();
+_st(output)._compile();
 _st(self._model())._selectedProtocol_(_st(output)._protocol());
 return self}, function($ctx1) {$ctx1.fill(self,"execute",{targetClass:targetClass,output:output},smalltalk.HLGenerateInitializeCommand)})},
 args: [],
-source: "execute\x0a\x09| targetClass output |\x0a\x09targetClass := self model selectedClass.\x0a\x0a\x09output := HLAccessorsGenerator new\x0a\x09\x09class: targetClass;\x0a\x09\x09generate;\x0a\x09\x09output.\x0a\x09\x09\x0a\x09output serialize.\x0a\x09self model selectedProtocol: output protocol",
-messageSends: ["selectedClass", "model", "class:", "new", "generate", "output", "serialize", "selectedProtocol:", "protocol"],
+source: "execute\x0a\x09| targetClass output |\x0a\x09targetClass := self model selectedClass.\x0a\x0a\x09output := HLAccessorsGenerator new\x0a\x09\x09class: targetClass;\x0a\x09\x09generate;\x0a\x09\x09output.\x0a\x09\x09\x0a\x09output compile.\x0a\x09self model selectedProtocol: output protocol",
+messageSends: ["selectedClass", "model", "class:", "new", "generate", "output", "compile", "selectedProtocol:", "protocol"],
 referencedClasses: ["HLAccessorsGenerator"]
 }),
 smalltalk.HLGenerateInitializeCommand);

+ 35 - 39
js/Helios-Helpers.js

@@ -223,7 +223,7 @@ smalltalk.HLGenerator);
 
 smalltalk.addMethod(
 smalltalk.method({
-selector: "generate",
+selector: "compile",
 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,"generate",{},smalltalk.HLGenerator)})},
+return self}, function($ctx1) {$ctx1.fill(self,"compile",{},smalltalk.HLGenerator)})},
 args: [],
-source: "generate\x0a\x0a\x09output targetClass ifNil: [ self error: 'class should not be nil'].",
+source: "compile\x0a\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: "generate",
+selector: "compile",
 protocol: 'protocol',
 fn: function (){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
 var $1,$2;
-smalltalk.HLAccessorsGenerator.superclass.fn.prototype._generate.apply(_st(self), []);
+smalltalk.HLAccessorsGenerator.superclass.fn.prototype._compile.apply(_st(self), []);
 $1=_st(self["@output"])._targetClass();
 _st($1)._accessorsSourceCodesWith_(self);
 $2=_st($1)._accessorProtocolWith_(self);
-return self}, function($ctx1) {$ctx1.fill(self,"generate",{},smalltalk.HLAccessorsGenerator)})},
+return self}, function($ctx1) {$ctx1.fill(self,"compile",{},smalltalk.HLAccessorsGenerator)})},
 args: [],
-source: "generate\x0a\x09super generate.\x0a\x09\x0a\x09output targetClass \x0a\x09\x09accessorsSourceCodesWith: self;\x0a\x09\x09accessorProtocolWith: self",
-messageSends: ["generate", "accessorsSourceCodesWith:", "targetClass", "accessorProtocolWith:"],
+source: "compile\x0a\x09super compile.\x0a\x09\x0a\x09output targetClass \x0a\x09\x09accessorsSourceCodesWith: self;\x0a\x09\x09accessorProtocolWith: self",
+messageSends: ["compile", "accessorsSourceCodesWith:", "targetClass", "accessorProtocolWith:"],
 referencedClasses: []
 }),
 smalltalk.HLAccessorsGenerator);
@@ -356,16 +356,14 @@ var self=this;
 function $HLMethodSourceCode(){return smalltalk.HLMethodSourceCode||(typeof HLMethodSourceCode=="undefined"?nil:HLMethodSourceCode)}
 function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
 return smalltalk.withContext(function($ctx1) { 
-var $2,$4,$3,$1;
+var $2,$3,$1;
 $2=_st($HLMethodSourceCode())._new();
 _st($2)._selector_(anInstanceVariable);
 $3=_st($2)._sourceCode_(_st($String())._streamContents_((function(stream){
 return smalltalk.withContext(function($ctx2) {
 _st(stream).__lt_lt(anInstanceVariable);
 $ctx2.sendIdx["<<"]=1;
-$4=_st(_st(stream)._cr())._cr();
-$ctx2.sendIdx["cr"]=1;
-_st($4)._tab();
+_st(_st(stream)._cr())._tab();
 return _st(_st(stream).__lt_lt("^ ")).__lt_lt(anInstanceVariable);
 $ctx2.sendIdx["<<"]=2;
 }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)})})));
@@ -373,7 +371,7 @@ $1=$3;
 return $1;
 }, function($ctx1) {$ctx1.fill(self,"getterFor:",{anInstanceVariable:anInstanceVariable},smalltalk.HLAccessorsGenerator)})},
 args: ["anInstanceVariable"],
-source: "getterFor: anInstanceVariable\x0a\x09^ HLMethodSourceCode new\x0a\x09\x09selector:anInstanceVariable;\x0a\x09\x09sourceCode: (String streamContents: [ :stream |\x0a\x09\x09stream << anInstanceVariable.\x0a\x09\x09stream cr cr tab.\x0a\x09\x09stream << '^ ' << anInstanceVariable ])",
+source: "getterFor: anInstanceVariable\x0a\x09^ HLMethodSourceCode new\x0a\x09\x09selector:anInstanceVariable;\x0a\x09\x09sourceCode: (String streamContents: [ :stream |\x0a\x09\x09stream << anInstanceVariable.\x0a\x09\x09stream cr tab.\x0a\x09\x09stream << '^ ' << anInstanceVariable ])",
 messageSends: ["selector:", "new", "sourceCode:", "streamContents:", "<<", "tab", "cr"],
 referencedClasses: ["HLMethodSourceCode", "String"]
 }),
@@ -388,7 +386,7 @@ var self=this;
 function $HLMethodSourceCode(){return smalltalk.HLMethodSourceCode||(typeof HLMethodSourceCode=="undefined"?nil:HLMethodSourceCode)}
 function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
 return smalltalk.withContext(function($ctx1) { 
-var $2,$4,$5,$3,$1;
+var $2,$4,$3,$1;
 $2=_st($HLMethodSourceCode())._new();
 _st($2)._selector_(_st(anInstanceVariable).__comma(":"));
 $3=_st($2)._sourceCode_(_st($String())._streamContents_((function(stream){
@@ -397,9 +395,7 @@ $4=_st(stream).__lt_lt(anInstanceVariable);
 $ctx2.sendIdx["<<"]=2;
 _st($4).__lt_lt(": anObject");
 $ctx2.sendIdx["<<"]=1;
-$5=_st(_st(stream)._cr())._cr();
-$ctx2.sendIdx["cr"]=1;
-_st($5)._tab();
+_st(_st(stream)._cr())._tab();
 return _st(_st(stream).__lt_lt(anInstanceVariable)).__lt_lt(" := anObject");
 $ctx2.sendIdx["<<"]=3;
 }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)})})));
@@ -407,7 +403,7 @@ $1=$3;
 return $1;
 }, function($ctx1) {$ctx1.fill(self,"setterFor:",{anInstanceVariable:anInstanceVariable},smalltalk.HLAccessorsGenerator)})},
 args: ["anInstanceVariable"],
-source: "setterFor: anInstanceVariable\x0a\x09^ HLMethodSourceCode new\x0a\x09\x09selector: anInstanceVariable, ':';\x0a\x09\x09sourceCode: (String streamContents: [ :stream |\x0a\x09\x09stream << anInstanceVariable << ': anObject'.\x0a\x09\x09stream cr cr tab.\x0a\x09\x09stream << anInstanceVariable << ' := anObject' ])",
+source: "setterFor: anInstanceVariable\x0a\x09^ HLMethodSourceCode new\x0a\x09\x09selector: anInstanceVariable, ':';\x0a\x09\x09sourceCode: (String streamContents: [ :stream |\x0a\x09\x09stream << anInstanceVariable << ': anObject'.\x0a\x09\x09stream cr tab.\x0a\x09\x09stream << anInstanceVariable << ' := anObject' ])",
 messageSends: ["selector:", "new", ",", "sourceCode:", "streamContents:", "<<", "tab", "cr"],
 referencedClasses: ["HLMethodSourceCode", "String"]
 }),
@@ -417,6 +413,27 @@ 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",
@@ -446,27 +463,6 @@ 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",

+ 4 - 4
st/Helios-Commands-Browser.st

@@ -175,7 +175,7 @@ HLGenerateCommand subclass: #HLGenerateAccessorsCommand
 	instanceVariableNames: ''
 	package: 'Helios-Commands-Browser'!
 !HLGenerateAccessorsCommand commentStamp!
-I am the command used to generate the `initialize` method depending of the selected class!
+I am the command used to generate the `getter` and the `setter` methods depending of the selected class!
 
 !HLGenerateAccessorsCommand methodsFor: 'executing'!
 
@@ -188,7 +188,7 @@ execute
 		generate;
 		output.
 		
-	output serialize.
+	output compile.
 	first := output sourceCodes first.
 	self model
 		selectedProtocol: output protocol;
@@ -210,7 +210,7 @@ HLGenerateCommand subclass: #HLGenerateInitializeCommand
 	instanceVariableNames: ''
 	package: 'Helios-Commands-Browser'!
 !HLGenerateInitializeCommand commentStamp!
-I am the command used to generate the `gettet` and the `setter` methods depending of the selected class!
+I am the command used to generate the `initialize` method depending of the selected class!
 
 !HLGenerateInitializeCommand methodsFor: 'executing'!
 
@@ -223,7 +223,7 @@ execute
 		generate;
 		output.
 		
-	output serialize.
+	output compile.
 	self model selectedProtocol: output protocol
 ! !
 

+ 7 - 7
st/Helios-Helpers.st

@@ -100,7 +100,7 @@ initialize
 
 !HLGenerator methodsFor: 'protocol'!
 
-generate
+compile
 
 	output targetClass ifNil: [ self error: 'class should not be nil'].
 ! !
@@ -135,7 +135,7 @@ getterFor: anInstanceVariable
 		selector:anInstanceVariable;
 		sourceCode: (String streamContents: [ :stream |
 		stream << anInstanceVariable.
-		stream cr cr tab.
+		stream cr tab.
 		stream << '^ ' << anInstanceVariable ])
 !
 
@@ -144,14 +144,14 @@ setterFor: anInstanceVariable
 		selector: anInstanceVariable, ':';
 		sourceCode: (String streamContents: [ :stream |
 		stream << anInstanceVariable << ': anObject'.
-		stream cr cr tab.
+		stream cr tab.
 		stream << anInstanceVariable << ' := anObject' ])
 ! !
 
 !HLAccessorsGenerator methodsFor: 'protocol'!
 
-generate
-	super generate.
+compile
+	super compile.
 	
 	output targetClass 
 		accessorsSourceCodesWith: self;
@@ -235,8 +235,8 @@ retrieveProtocolForObject
 
 !HLInitializeGenerator methodsFor: 'protocol'!
 
-generate
-	super generate.
+compile
+	super compile.
 	
 	output targetClass 
 		initializeSourceCodesWith: self;