|
@@ -579,8 +579,117 @@ smalltalk.HLGenerationOutputWithIndex);
|
|
|
|
|
|
|
|
|
|
|
|
-smalltalk.addClass('HLGenerator', smalltalk.Object, ['output'], 'Helios-Helpers');
|
|
|
-smalltalk.HLGenerator.comment="I am the abstract super class of the generators.\x0a\x0aMy main method is `generate` which produce an `output` object";
|
|
|
+smalltalk.addClass('HLMethodClassifier', smalltalk.Object, ['firstLink'], 'Helios-Helpers');
|
|
|
+smalltalk.HLMethodClassifier.comment="I am in charge of categorizing methods following this strategy:\x0a\x0a- is it an accessor?\x0a- is it overriding a superclass method?\x0a- is it starting with a know prefix?\x0a- how are categorized the other implementations?";
|
|
|
+smalltalk.addMethod(
|
|
|
+smalltalk.method({
|
|
|
+selector: "addLink:",
|
|
|
+protocol: 'private',
|
|
|
+fn: function (aLink){
|
|
|
+var self=this;
|
|
|
+return smalltalk.withContext(function($ctx1) {
|
|
|
+_st(aLink)._next_(self["@firstLink"]);
|
|
|
+self["@firstLink"]=aLink;
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"addLink:",{aLink:aLink},smalltalk.HLMethodClassifier)})},
|
|
|
+args: ["aLink"],
|
|
|
+source: "addLink: aLink\x0a\x09aLink next: firstLink.\x0a\x09firstLink := aLink",
|
|
|
+messageSends: ["next:"],
|
|
|
+referencedClasses: []
|
|
|
+}),
|
|
|
+smalltalk.HLMethodClassifier);
|
|
|
+
|
|
|
+smalltalk.addMethod(
|
|
|
+smalltalk.method({
|
|
|
+selector: "buildChainOfResponsibility",
|
|
|
+protocol: 'initialization',
|
|
|
+fn: function (){
|
|
|
+var self=this;
|
|
|
+function $HLImplementorClassifierLink(){return smalltalk.HLImplementorClassifierLink||(typeof HLImplementorClassifierLink=="undefined"?nil:HLImplementorClassifierLink)}
|
|
|
+function $HLPrefixClassifierLink(){return smalltalk.HLPrefixClassifierLink||(typeof HLPrefixClassifierLink=="undefined"?nil:HLPrefixClassifierLink)}
|
|
|
+function $HLSuperclassClassifierLink(){return smalltalk.HLSuperclassClassifierLink||(typeof HLSuperclassClassifierLink=="undefined"?nil:HLSuperclassClassifierLink)}
|
|
|
+function $HLAccessorClassifierLink(){return smalltalk.HLAccessorClassifierLink||(typeof HLAccessorClassifierLink=="undefined"?nil:HLAccessorClassifierLink)}
|
|
|
+return smalltalk.withContext(function($ctx1) {
|
|
|
+var $1,$2,$3;
|
|
|
+$1=_st($HLImplementorClassifierLink())._new();
|
|
|
+$ctx1.sendIdx["new"]=1;
|
|
|
+self._addLink_($1);
|
|
|
+$ctx1.sendIdx["addLink:"]=1;
|
|
|
+$2=_st($HLPrefixClassifierLink())._new();
|
|
|
+$ctx1.sendIdx["new"]=2;
|
|
|
+self._addLink_($2);
|
|
|
+$ctx1.sendIdx["addLink:"]=2;
|
|
|
+$3=_st($HLSuperclassClassifierLink())._new();
|
|
|
+$ctx1.sendIdx["new"]=3;
|
|
|
+self._addLink_($3);
|
|
|
+$ctx1.sendIdx["addLink:"]=3;
|
|
|
+self._addLink_(_st($HLAccessorClassifierLink())._new());
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"buildChainOfResponsibility",{},smalltalk.HLMethodClassifier)})},
|
|
|
+args: [],
|
|
|
+source: "buildChainOfResponsibility\x0a\x09self addLink: HLImplementorClassifierLink new.\x0a\x09self addLink: HLPrefixClassifierLink new.\x0a\x09self addLink: HLSuperclassClassifierLink new.\x0a\x09self addLink: HLAccessorClassifierLink new",
|
|
|
+messageSends: ["addLink:", "new"],
|
|
|
+referencedClasses: ["HLImplementorClassifierLink", "HLPrefixClassifierLink", "HLSuperclassClassifierLink", "HLAccessorClassifierLink"]
|
|
|
+}),
|
|
|
+smalltalk.HLMethodClassifier);
|
|
|
+
|
|
|
+smalltalk.addMethod(
|
|
|
+smalltalk.method({
|
|
|
+selector: "classify:",
|
|
|
+protocol: 'protocol',
|
|
|
+fn: function (aMethod){
|
|
|
+var self=this;
|
|
|
+return smalltalk.withContext(function($ctx1) {
|
|
|
+var $1,$2;
|
|
|
+$1=self["@firstLink"];
|
|
|
+_st($1)._method_(aMethod);
|
|
|
+$2=_st($1)._classify();
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"classify:",{aMethod:aMethod},smalltalk.HLMethodClassifier)})},
|
|
|
+args: ["aMethod"],
|
|
|
+source: "classify: aMethod\x0a\x09firstLink\x0a\x09\x09method: aMethod;\x0a\x09\x09classify",
|
|
|
+messageSends: ["method:", "classify"],
|
|
|
+referencedClasses: []
|
|
|
+}),
|
|
|
+smalltalk.HLMethodClassifier);
|
|
|
+
|
|
|
+smalltalk.addMethod(
|
|
|
+smalltalk.method({
|
|
|
+selector: "classifyAll:",
|
|
|
+protocol: 'protocol',
|
|
|
+fn: function (aCollectionOfMethods){
|
|
|
+var self=this;
|
|
|
+return smalltalk.withContext(function($ctx1) {
|
|
|
+_st(aCollectionOfMethods)._do_((function(method){
|
|
|
+return smalltalk.withContext(function($ctx2) {
|
|
|
+return self._classify_(method);
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({method:method},$ctx1,1)})}));
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"classifyAll:",{aCollectionOfMethods:aCollectionOfMethods},smalltalk.HLMethodClassifier)})},
|
|
|
+args: ["aCollectionOfMethods"],
|
|
|
+source: "classifyAll: aCollectionOfMethods\x0a\x09aCollectionOfMethods do: [ :method |\x0a\x09\x09self classify: method ]",
|
|
|
+messageSends: ["do:", "classify:"],
|
|
|
+referencedClasses: []
|
|
|
+}),
|
|
|
+smalltalk.HLMethodClassifier);
|
|
|
+
|
|
|
+smalltalk.addMethod(
|
|
|
+smalltalk.method({
|
|
|
+selector: "initialize",
|
|
|
+protocol: 'initialization',
|
|
|
+fn: function (){
|
|
|
+var self=this;
|
|
|
+return smalltalk.withContext(function($ctx1) {
|
|
|
+smalltalk.HLMethodClassifier.superclass.fn.prototype._initialize.apply(_st(self), []);
|
|
|
+self._buildChainOfResponsibility();
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.HLMethodClassifier)})},
|
|
|
+args: [],
|
|
|
+source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09self buildChainOfResponsibility",
|
|
|
+messageSends: ["initialize", "buildChainOfResponsibility"],
|
|
|
+referencedClasses: []
|
|
|
+}),
|
|
|
+smalltalk.HLMethodClassifier);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+smalltalk.addClass('HLMethodGenerator', smalltalk.Object, ['output'], 'Helios-Helpers');
|
|
|
+smalltalk.HLMethodGenerator.comment="I am the abstract super class of the method generators.\x0a\x0aMy main method is `generate` which produce an `output` object";
|
|
|
smalltalk.addMethod(
|
|
|
smalltalk.method({
|
|
|
selector: "class:",
|
|
@@ -589,13 +698,13 @@ fn: function (aClass){
|
|
|
var self=this;
|
|
|
return smalltalk.withContext(function($ctx1) {
|
|
|
_st(self["@output"])._targetClass_(aClass);
|
|
|
-return self}, function($ctx1) {$ctx1.fill(self,"class:",{aClass:aClass},smalltalk.HLGenerator)})},
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"class:",{aClass:aClass},smalltalk.HLMethodGenerator)})},
|
|
|
args: ["aClass"],
|
|
|
source: "class: aClass\x0a\x09output targetClass: aClass",
|
|
|
messageSends: ["targetClass:"],
|
|
|
referencedClasses: []
|
|
|
}),
|
|
|
-smalltalk.HLGenerator);
|
|
|
+smalltalk.HLMethodGenerator);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
|
smalltalk.method({
|
|
@@ -611,13 +720,13 @@ 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,"generate",{},smalltalk.HLMethodGenerator)})},
|
|
|
args: [],
|
|
|
source: "generate\x0a\x09output targetClass ifNil: [ self error: 'class should not be nil'].",
|
|
|
messageSends: ["ifNil:", "targetClass", "error:"],
|
|
|
referencedClasses: []
|
|
|
}),
|
|
|
-smalltalk.HLGenerator);
|
|
|
+smalltalk.HLMethodGenerator);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
|
smalltalk.method({
|
|
@@ -627,15 +736,15 @@ fn: function (){
|
|
|
var self=this;
|
|
|
function $HLGenerationOutput(){return smalltalk.HLGenerationOutput||(typeof HLGenerationOutput=="undefined"?nil:HLGenerationOutput)}
|
|
|
return smalltalk.withContext(function($ctx1) {
|
|
|
-smalltalk.HLGenerator.superclass.fn.prototype._initialize.apply(_st(self), []);
|
|
|
+smalltalk.HLMethodGenerator.superclass.fn.prototype._initialize.apply(_st(self), []);
|
|
|
self["@output"]=_st($HLGenerationOutput())._new();
|
|
|
-return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.HLGenerator)})},
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.HLMethodGenerator)})},
|
|
|
args: [],
|
|
|
source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09output := HLGenerationOutput new",
|
|
|
messageSends: ["initialize", "new"],
|
|
|
referencedClasses: ["HLGenerationOutput"]
|
|
|
}),
|
|
|
-smalltalk.HLGenerator);
|
|
|
+smalltalk.HLMethodGenerator);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
|
smalltalk.method({
|
|
@@ -647,17 +756,17 @@ return smalltalk.withContext(function($ctx1) {
|
|
|
var $1;
|
|
|
$1=self["@output"];
|
|
|
return $1;
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"output",{},smalltalk.HLGenerator)})},
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"output",{},smalltalk.HLMethodGenerator)})},
|
|
|
args: [],
|
|
|
source: "output\x0a\x09^ output",
|
|
|
messageSends: [],
|
|
|
referencedClasses: []
|
|
|
}),
|
|
|
-smalltalk.HLGenerator);
|
|
|
+smalltalk.HLMethodGenerator);
|
|
|
|
|
|
|
|
|
|
|
|
-smalltalk.addClass('HLAccessorsGenerator', smalltalk.HLGenerator, [], 'Helios-Helpers');
|
|
|
+smalltalk.addClass('HLAccessorsGenerator', smalltalk.HLMethodGenerator, [], 'Helios-Helpers');
|
|
|
smalltalk.HLAccessorsGenerator.comment="I am a generator used to compile the getters/setters of a class";
|
|
|
smalltalk.addMethod(
|
|
|
smalltalk.method({
|
|
@@ -677,7 +786,7 @@ smalltalk.HLAccessorsGenerator);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
|
smalltalk.method({
|
|
|
-selector: "accessorsSourceCodesForObject",
|
|
|
+selector: "accessorsForObject",
|
|
|
protocol: 'double-dispatch',
|
|
|
fn: function (){
|
|
|
var self=this;
|
|
@@ -695,9 +804,9 @@ $2=_st($1)._add_(self._setterFor_(each));
|
|
|
return $2;
|
|
|
}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
|
|
|
_st(self["@output"])._sourceCodes_(sources);
|
|
|
-return self}, function($ctx1) {$ctx1.fill(self,"accessorsSourceCodesForObject",{sources:sources},smalltalk.HLAccessorsGenerator)})},
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"accessorsForObject",{sources:sources},smalltalk.HLAccessorsGenerator)})},
|
|
|
args: [],
|
|
|
-source: "accessorsSourceCodesForObject\x0a\x09| sources |\x0a\x09\x0a\x09sources := OrderedCollection new.\x0a\x09output targetClass instanceVariableNames sorted do: [ :each | \x0a\x09\x09sources \x0a\x09\x09\x09add: (self getterFor: each);\x0a\x09\x09\x09add: (self setterFor: each) ].\x0a\x09output sourceCodes: sources",
|
|
|
+source: "accessorsForObject\x0a\x09| sources |\x0a\x09\x0a\x09sources := OrderedCollection new.\x0a\x09output targetClass instanceVariableNames sorted do: [ :each | \x0a\x09\x09sources \x0a\x09\x09\x09add: (self getterFor: each);\x0a\x09\x09\x09add: (self setterFor: each) ].\x0a\x09output sourceCodes: sources",
|
|
|
messageSends: ["new", "do:", "sorted", "instanceVariableNames", "targetClass", "add:", "getterFor:", "setterFor:", "sourceCodes:"],
|
|
|
referencedClasses: ["OrderedCollection"]
|
|
|
}),
|
|
@@ -787,37 +896,8 @@ smalltalk.HLAccessorsGenerator);
|
|
|
|
|
|
|
|
|
|
|
|
-smalltalk.addClass('HLInitializeGenerator', smalltalk.HLGenerator, [], 'Helios-Helpers');
|
|
|
+smalltalk.addClass('HLInitializeGenerator', smalltalk.HLMethodGenerator, [], '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: "computeIndexForObject",
|
|
|
-protocol: 'private',
|
|
|
-fn: function (){
|
|
|
-var self=this;
|
|
|
-var instVars,headerSize,firstInstVarSize;
|
|
|
-return smalltalk.withContext(function($ctx1) {
|
|
|
-var $1;
|
|
|
-headerSize=(32);
|
|
|
-instVars=_st(_st(self["@output"])._targetClass())._instanceVariableNames();
|
|
|
-firstInstVarSize=_st(_st(instVars)._sorted())._ifEmpty_ifNotEmpty_((function(){
|
|
|
-return smalltalk.withContext(function($ctx2) {
|
|
|
-return (0);
|
|
|
-}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),(function(){
|
|
|
-return smalltalk.withContext(function($ctx2) {
|
|
|
-return _st(_st(_st(instVars)._first())._size()).__plus((4));
|
|
|
-$ctx2.sendIdx["+"]=1;
|
|
|
-}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
|
|
|
-$1=_st(headerSize).__plus(firstInstVarSize);
|
|
|
-return $1;
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"computeIndexForObject",{instVars:instVars,headerSize:headerSize,firstInstVarSize:firstInstVarSize},smalltalk.HLInitializeGenerator)})},
|
|
|
-args: [],
|
|
|
-source: "computeIndexForObject\x0a\x09| instVars headerSize firstInstVarSize |\x0a\x09\x0a\x09\x2232 is the size of the `initiliaze super initialize` part\x22\x0a\x09headerSize := 32.\x0a\x09instVars := output targetClass instanceVariableNames.\x0a\x09firstInstVarSize := instVars sorted\x0a\x09\x09ifEmpty: [ 0 ]\x0a\x09\x09ifNotEmpty:[ instVars first size + 4 ].\x0a\x09^ headerSize + firstInstVarSize",
|
|
|
-messageSends: ["instanceVariableNames", "targetClass", "ifEmpty:ifNotEmpty:", "sorted", "+", "size", "first"],
|
|
|
-referencedClasses: []
|
|
|
-}),
|
|
|
-smalltalk.HLInitializeGenerator);
|
|
|
-
|
|
|
smalltalk.addMethod(
|
|
|
smalltalk.method({
|
|
|
selector: "generate",
|
|
@@ -829,12 +909,11 @@ 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:"],
|
|
|
+source: "generate\x0a\x09super generate.\x0a\x09\x0a\x09output targetClass \x0a\x09\x09initializeSourceCodesWith: self;\x0a\x09\x09initializeProtocolWith: self",
|
|
|
+messageSends: ["generate", "initializeSourceCodesWith:", "targetClass", "initializeProtocolWith:"],
|
|
|
referencedClasses: []
|
|
|
}),
|
|
|
smalltalk.HLInitializeGenerator);
|
|
@@ -898,25 +977,23 @@ smalltalk.HLInitializeGenerator);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
|
smalltalk.method({
|
|
|
-selector: "initialize",
|
|
|
-protocol: 'initialization',
|
|
|
+selector: "initializeForObject",
|
|
|
+protocol: 'double-dispatch',
|
|
|
fn: function (){
|
|
|
var self=this;
|
|
|
-function $HLGenerationOutputWithIndex(){return smalltalk.HLGenerationOutputWithIndex||(typeof HLGenerationOutputWithIndex=="undefined"?nil:HLGenerationOutputWithIndex)}
|
|
|
return smalltalk.withContext(function($ctx1) {
|
|
|
-smalltalk.HLInitializeGenerator.superclass.fn.prototype._initialize.apply(_st(self), []);
|
|
|
-self["@output"]=_st($HLGenerationOutputWithIndex())._new();
|
|
|
-return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.HLInitializeGenerator)})},
|
|
|
+_st(self["@output"])._addSourceCode_(self._initializeMethodForObject());
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"initializeForObject",{},smalltalk.HLInitializeGenerator)})},
|
|
|
args: [],
|
|
|
-source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09output := HLGenerationOutputWithIndex new",
|
|
|
-messageSends: ["initialize", "new"],
|
|
|
-referencedClasses: ["HLGenerationOutputWithIndex"]
|
|
|
+source: "initializeForObject\x0a\x09output addSourceCode: self initializeMethodForObject",
|
|
|
+messageSends: ["addSourceCode:", "initializeMethodForObject"],
|
|
|
+referencedClasses: []
|
|
|
}),
|
|
|
smalltalk.HLInitializeGenerator);
|
|
|
|
|
|
smalltalk.addMethod(
|
|
|
smalltalk.method({
|
|
|
-selector: "initializeCodeForObject",
|
|
|
+selector: "initializeMethodForObject",
|
|
|
protocol: 'private',
|
|
|
fn: function (){
|
|
|
var self=this;
|
|
@@ -929,46 +1006,14 @@ _st($2)._sourceCode_(self._generateInitializeCodeForObject());
|
|
|
$3=_st($2)._yourself();
|
|
|
$1=$3;
|
|
|
return $1;
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"initializeCodeForObject",{},smalltalk.HLInitializeGenerator)})},
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"initializeMethodForObject",{},smalltalk.HLInitializeGenerator)})},
|
|
|
args: [],
|
|
|
-source: "initializeCodeForObject\x09\x0a\x09^ HLMethodSourceCode new\x0a\x09\x09selector: 'initialize';\x0a\x09\x09sourceCode: self generateInitializeCodeForObject;\x0a\x09\x09yourself",
|
|
|
+source: "initializeMethodForObject\x09\x0a\x09^ HLMethodSourceCode new\x0a\x09\x09selector: 'initialize';\x0a\x09\x09sourceCode: self generateInitializeCodeForObject;\x0a\x09\x09yourself",
|
|
|
messageSends: ["selector:", "new", "sourceCode:", "generateInitializeCodeForObject", "yourself"],
|
|
|
referencedClasses: ["HLMethodSourceCode"]
|
|
|
}),
|
|
|
smalltalk.HLInitializeGenerator);
|
|
|
|
|
|
-smalltalk.addMethod(
|
|
|
-smalltalk.method({
|
|
|
-selector: "initializeForObject",
|
|
|
-protocol: 'double-dispatch',
|
|
|
-fn: function (){
|
|
|
-var self=this;
|
|
|
-return smalltalk.withContext(function($ctx1) {
|
|
|
-_st(self["@output"])._addSourceCode_(self._initializeCodeForObject());
|
|
|
-return self}, function($ctx1) {$ctx1.fill(self,"initializeForObject",{},smalltalk.HLInitializeGenerator)})},
|
|
|
-args: [],
|
|
|
-source: "initializeForObject\x0a\x09output addSourceCode: self initializeCodeForObject",
|
|
|
-messageSends: ["addSourceCode:", "initializeCodeForObject"],
|
|
|
-referencedClasses: []
|
|
|
-}),
|
|
|
-smalltalk.HLInitializeGenerator);
|
|
|
-
|
|
|
-smalltalk.addMethod(
|
|
|
-smalltalk.method({
|
|
|
-selector: "initializeIndexForObject",
|
|
|
-protocol: 'double-dispatch',
|
|
|
-fn: function (){
|
|
|
-var self=this;
|
|
|
-return smalltalk.withContext(function($ctx1) {
|
|
|
-_st(self["@output"])._index_(self._computeIndexForObject());
|
|
|
-return self}, function($ctx1) {$ctx1.fill(self,"initializeIndexForObject",{},smalltalk.HLInitializeGenerator)})},
|
|
|
-args: [],
|
|
|
-source: "initializeIndexForObject\x0a\x09output index: self computeIndexForObject",
|
|
|
-messageSends: ["index:", "computeIndexForObject"],
|
|
|
-referencedClasses: []
|
|
|
-}),
|
|
|
-smalltalk.HLInitializeGenerator);
|
|
|
-
|
|
|
smalltalk.addMethod(
|
|
|
smalltalk.method({
|
|
|
selector: "initializeProtocolForObject",
|
|
@@ -976,142 +1021,17 @@ protocol: 'double-dispatch',
|
|
|
fn: function (){
|
|
|
var self=this;
|
|
|
return smalltalk.withContext(function($ctx1) {
|
|
|
-_st(self["@output"])._protocol_(self._retrieveProtocolForObject());
|
|
|
+_st(self["@output"])._protocol_("initialization");
|
|
|
return self}, function($ctx1) {$ctx1.fill(self,"initializeProtocolForObject",{},smalltalk.HLInitializeGenerator)})},
|
|
|
args: [],
|
|
|
-source: "initializeProtocolForObject\x0a\x09output protocol: self retrieveProtocolForObject",
|
|
|
-messageSends: ["protocol:", "retrieveProtocolForObject"],
|
|
|
-referencedClasses: []
|
|
|
-}),
|
|
|
-smalltalk.HLInitializeGenerator);
|
|
|
-
|
|
|
-smalltalk.addMethod(
|
|
|
-smalltalk.method({
|
|
|
-selector: "retrieveProtocolForObject",
|
|
|
-protocol: 'private',
|
|
|
-fn: function (){
|
|
|
-var self=this;
|
|
|
-return smalltalk.withContext(function($ctx1) {
|
|
|
-return "initialization";
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"retrieveProtocolForObject",{},smalltalk.HLInitializeGenerator)})},
|
|
|
-args: [],
|
|
|
-source: "retrieveProtocolForObject\x0a\x09^ 'initialization'",
|
|
|
-messageSends: [],
|
|
|
+source: "initializeProtocolForObject\x0a\x09output protocol: 'initialization'",
|
|
|
+messageSends: ["protocol:"],
|
|
|
referencedClasses: []
|
|
|
}),
|
|
|
smalltalk.HLInitializeGenerator);
|
|
|
|
|
|
|
|
|
|
|
|
-smalltalk.addClass('HLMethodClassifier', smalltalk.Object, ['firstLink'], 'Helios-Helpers');
|
|
|
-smalltalk.HLMethodClassifier.comment="I am in charge of categorizing methods following this strategy:\x0a\x0a- is it an accessor?\x0a- is it overriding a superclass method?\x0a- is it starting with a know prefix?\x0a- how are categorized the other implementations?";
|
|
|
-smalltalk.addMethod(
|
|
|
-smalltalk.method({
|
|
|
-selector: "addLink:",
|
|
|
-protocol: 'private',
|
|
|
-fn: function (aLink){
|
|
|
-var self=this;
|
|
|
-return smalltalk.withContext(function($ctx1) {
|
|
|
-_st(aLink)._next_(self["@firstLink"]);
|
|
|
-self["@firstLink"]=aLink;
|
|
|
-return self}, function($ctx1) {$ctx1.fill(self,"addLink:",{aLink:aLink},smalltalk.HLMethodClassifier)})},
|
|
|
-args: ["aLink"],
|
|
|
-source: "addLink: aLink\x0a\x09aLink next: firstLink.\x0a\x09firstLink := aLink",
|
|
|
-messageSends: ["next:"],
|
|
|
-referencedClasses: []
|
|
|
-}),
|
|
|
-smalltalk.HLMethodClassifier);
|
|
|
-
|
|
|
-smalltalk.addMethod(
|
|
|
-smalltalk.method({
|
|
|
-selector: "buildChainOfResponsibility",
|
|
|
-protocol: 'initialization',
|
|
|
-fn: function (){
|
|
|
-var self=this;
|
|
|
-function $HLImplementorClassifierLink(){return smalltalk.HLImplementorClassifierLink||(typeof HLImplementorClassifierLink=="undefined"?nil:HLImplementorClassifierLink)}
|
|
|
-function $HLPrefixClassifierLink(){return smalltalk.HLPrefixClassifierLink||(typeof HLPrefixClassifierLink=="undefined"?nil:HLPrefixClassifierLink)}
|
|
|
-function $HLSuperclassClassifierLink(){return smalltalk.HLSuperclassClassifierLink||(typeof HLSuperclassClassifierLink=="undefined"?nil:HLSuperclassClassifierLink)}
|
|
|
-function $HLAccessorClassifierLink(){return smalltalk.HLAccessorClassifierLink||(typeof HLAccessorClassifierLink=="undefined"?nil:HLAccessorClassifierLink)}
|
|
|
-return smalltalk.withContext(function($ctx1) {
|
|
|
-var $1,$2,$3;
|
|
|
-$1=_st($HLImplementorClassifierLink())._new();
|
|
|
-$ctx1.sendIdx["new"]=1;
|
|
|
-self._addLink_($1);
|
|
|
-$ctx1.sendIdx["addLink:"]=1;
|
|
|
-$2=_st($HLPrefixClassifierLink())._new();
|
|
|
-$ctx1.sendIdx["new"]=2;
|
|
|
-self._addLink_($2);
|
|
|
-$ctx1.sendIdx["addLink:"]=2;
|
|
|
-$3=_st($HLSuperclassClassifierLink())._new();
|
|
|
-$ctx1.sendIdx["new"]=3;
|
|
|
-self._addLink_($3);
|
|
|
-$ctx1.sendIdx["addLink:"]=3;
|
|
|
-self._addLink_(_st($HLAccessorClassifierLink())._new());
|
|
|
-return self}, function($ctx1) {$ctx1.fill(self,"buildChainOfResponsibility",{},smalltalk.HLMethodClassifier)})},
|
|
|
-args: [],
|
|
|
-source: "buildChainOfResponsibility\x0a\x09self addLink: HLImplementorClassifierLink new.\x0a\x09self addLink: HLPrefixClassifierLink new.\x0a\x09self addLink: HLSuperclassClassifierLink new.\x0a\x09self addLink: HLAccessorClassifierLink new",
|
|
|
-messageSends: ["addLink:", "new"],
|
|
|
-referencedClasses: ["HLImplementorClassifierLink", "HLPrefixClassifierLink", "HLSuperclassClassifierLink", "HLAccessorClassifierLink"]
|
|
|
-}),
|
|
|
-smalltalk.HLMethodClassifier);
|
|
|
-
|
|
|
-smalltalk.addMethod(
|
|
|
-smalltalk.method({
|
|
|
-selector: "classify:",
|
|
|
-protocol: 'protocol',
|
|
|
-fn: function (aMethod){
|
|
|
-var self=this;
|
|
|
-return smalltalk.withContext(function($ctx1) {
|
|
|
-var $1,$2;
|
|
|
-$1=self["@firstLink"];
|
|
|
-_st($1)._method_(aMethod);
|
|
|
-$2=_st($1)._classify();
|
|
|
-return self}, function($ctx1) {$ctx1.fill(self,"classify:",{aMethod:aMethod},smalltalk.HLMethodClassifier)})},
|
|
|
-args: ["aMethod"],
|
|
|
-source: "classify: aMethod\x0a\x09firstLink\x0a\x09\x09method: aMethod;\x0a\x09\x09classify",
|
|
|
-messageSends: ["method:", "classify"],
|
|
|
-referencedClasses: []
|
|
|
-}),
|
|
|
-smalltalk.HLMethodClassifier);
|
|
|
-
|
|
|
-smalltalk.addMethod(
|
|
|
-smalltalk.method({
|
|
|
-selector: "classifyAll:",
|
|
|
-protocol: 'protocol',
|
|
|
-fn: function (aCollectionOfMethods){
|
|
|
-var self=this;
|
|
|
-return smalltalk.withContext(function($ctx1) {
|
|
|
-_st(aCollectionOfMethods)._do_((function(method){
|
|
|
-return smalltalk.withContext(function($ctx2) {
|
|
|
-return self._classify_(method);
|
|
|
-}, function($ctx2) {$ctx2.fillBlock({method:method},$ctx1,1)})}));
|
|
|
-return self}, function($ctx1) {$ctx1.fill(self,"classifyAll:",{aCollectionOfMethods:aCollectionOfMethods},smalltalk.HLMethodClassifier)})},
|
|
|
-args: ["aCollectionOfMethods"],
|
|
|
-source: "classifyAll: aCollectionOfMethods\x0a\x09aCollectionOfMethods do: [ :method |\x0a\x09\x09self classify: method ]",
|
|
|
-messageSends: ["do:", "classify:"],
|
|
|
-referencedClasses: []
|
|
|
-}),
|
|
|
-smalltalk.HLMethodClassifier);
|
|
|
-
|
|
|
-smalltalk.addMethod(
|
|
|
-smalltalk.method({
|
|
|
-selector: "initialize",
|
|
|
-protocol: 'initialization',
|
|
|
-fn: function (){
|
|
|
-var self=this;
|
|
|
-return smalltalk.withContext(function($ctx1) {
|
|
|
-smalltalk.HLMethodClassifier.superclass.fn.prototype._initialize.apply(_st(self), []);
|
|
|
-self._buildChainOfResponsibility();
|
|
|
-return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.HLMethodClassifier)})},
|
|
|
-args: [],
|
|
|
-source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09self buildChainOfResponsibility",
|
|
|
-messageSends: ["initialize", "buildChainOfResponsibility"],
|
|
|
-referencedClasses: []
|
|
|
-}),
|
|
|
-smalltalk.HLMethodClassifier);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
smalltalk.addClass('HLMethodSourceCode', smalltalk.Object, ['selector', 'sourceCode'], 'Helios-Helpers');
|
|
|
smalltalk.HLMethodSourceCode.comment="I am a simple data object keeping track of the information about a method that will be compiled at the end of the generation process";
|
|
|
smalltalk.addMethod(
|