|
@@ -3465,6 +3465,64 @@ $globals.IRVisitor);
|
|
|
|
|
|
|
|
|
$core.addClass("IRJSTranslator", $globals.IRVisitor, ["stream", "currentClass"], "Compiler-IR");
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "buildMethodDeclaration:with:",
|
|
|
+protocol: "building",
|
|
|
+fn: function (aMethod,aBlock){
|
|
|
+var self=this,$self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+var $1,$2,$3,$4,$5;
|
|
|
+$1=$recv(aMethod)._selector();
|
|
|
+$2=$recv(aMethod)._source();
|
|
|
+$3=$recv((function(){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+$recv(aBlock)._value();
|
|
|
+
|
|
|
+$ctx2.sendIdx["value"]=2;
|
|
|
+
|
|
|
+return $self._contents();
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
|
|
|
+
|
|
|
+}))._value();
|
|
|
+
|
|
|
+$ctx1.sendIdx["value"]=1;
|
|
|
+
|
|
|
+$4=$recv($recv(aMethod)._messageSends())._asArray();
|
|
|
+
|
|
|
+$ctx1.sendIdx["asArray"]=1;
|
|
|
+
|
|
|
+$5=$recv($recv($recv(aMethod)._arguments())._collect_((function(each){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+return $recv(each)._value();
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
|
|
|
+
|
|
|
+})))._asArray();
|
|
|
+
|
|
|
+$ctx1.sendIdx["asArray"]=2;
|
|
|
+
|
|
|
+return $globals.HashedCollection._newFromPairs_(["selector",$1,"source",$2,"fn",$3,"messageSends",$4,"args",$5,"referencedClasses",$recv($recv(aMethod)._classReferences())._asArray()]);
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"buildMethodDeclaration:with:",{aMethod:aMethod,aBlock:aBlock},$globals.IRJSTranslator)});
|
|
|
+
|
|
|
+},
|
|
|
+
|
|
|
+args: ["aMethod", "aBlock"],
|
|
|
+source: "buildMethodDeclaration: aMethod with: aBlock\x0a\x09^ #{\x0a\x09\x09#selector -> aMethod selector.\x0a\x09\x09#source -> aMethod source.\x0a\x09\x09#fn -> [ aBlock value. self contents ] value.\x0a\x09\x09#messageSends -> aMethod messageSends asArray.\x0a\x09\x09#args -> (aMethod arguments collect: [ :each | each value ]) asArray.\x0a\x09\x09#referencedClasses -> aMethod classReferences asArray.\x0a\x09}",
|
|
|
+referencedClasses: [],
|
|
|
+
|
|
|
+messageSends: ["selector", "source", "value", "contents", "asArray", "messageSends", "collect:", "arguments", "classReferences"]
|
|
|
+}),
|
|
|
+$globals.IRJSTranslator);
|
|
|
+
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
|
selector: "contents",
|
|
@@ -3759,28 +3817,24 @@ var self=this,$self=this;
|
|
|
|
|
|
return $core.withContext(function($ctx1) {
|
|
|
|
|
|
-var $1,$2,$3,$4,$5,$6,$7;
|
|
|
-$1=$self._stream();
|
|
|
-
|
|
|
-$ctx1.sendIdx["stream"]=1;
|
|
|
-
|
|
|
-$recv($1)._nextPutMethodDeclaration_with_(anIRMethod,(function(){
|
|
|
+var $1,$2,$3,$4,$5,$6;
|
|
|
+return $self._buildMethodDeclaration_with_(anIRMethod,(function(){
|
|
|
|
|
|
return $core.withContext(function($ctx2) {
|
|
|
|
|
|
-$2=$self._stream();
|
|
|
+$1=$self._stream();
|
|
|
|
|
|
-$ctx2.sendIdx["stream"]=2;
|
|
|
+$ctx2.sendIdx["stream"]=1;
|
|
|
|
|
|
-return $recv($2)._nextPutFunctionWith_arguments_((function(){
|
|
|
+return $recv($1)._nextPutFunctionWith_arguments_((function(){
|
|
|
|
|
|
return $core.withContext(function($ctx3) {
|
|
|
|
|
|
-$3=$self._stream();
|
|
|
+$2=$self._stream();
|
|
|
|
|
|
-$ctx3.sendIdx["stream"]=3;
|
|
|
+$ctx3.sendIdx["stream"]=2;
|
|
|
|
|
|
-$4=$recv($recv(anIRMethod)._tempDeclarations())._collect_((function(each){
|
|
|
+$3=$recv($recv(anIRMethod)._tempDeclarations())._collect_((function(each){
|
|
|
|
|
|
return $core.withContext(function($ctx4) {
|
|
|
|
|
@@ -3792,15 +3846,15 @@ return $recv($recv(each)._name())._asVariableName();
|
|
|
|
|
|
$ctx3.sendIdx["collect:"]=1;
|
|
|
|
|
|
-$recv($3)._nextPutVars_($4);
|
|
|
+$recv($2)._nextPutVars_($3);
|
|
|
|
|
|
$ctx3.sendIdx["nextPutVars:"]=1;
|
|
|
|
|
|
-$5=$self._stream();
|
|
|
+$4=$self._stream();
|
|
|
|
|
|
-$ctx3.sendIdx["stream"]=4;
|
|
|
+$ctx3.sendIdx["stream"]=3;
|
|
|
|
|
|
-return $recv($5)._nextPutContextFor_during_(anIRMethod,(function(){
|
|
|
+return $recv($4)._nextPutContextFor_during_(anIRMethod,(function(){
|
|
|
|
|
|
return $core.withContext(function($ctx4) {
|
|
|
|
|
@@ -3808,11 +3862,11 @@ $recv($recv(anIRMethod)._internalVariables())._ifNotEmpty_((function(internalVar
|
|
|
|
|
|
return $core.withContext(function($ctx5) {
|
|
|
|
|
|
-$6=$self._stream();
|
|
|
+$5=$self._stream();
|
|
|
|
|
|
-$ctx5.sendIdx["stream"]=5;
|
|
|
+$ctx5.sendIdx["stream"]=4;
|
|
|
|
|
|
-return $recv($6)._nextPutVars_($recv($recv(internalVars)._asSet())._collect_((function(each){
|
|
|
+return $recv($5)._nextPutVars_($recv($recv(internalVars)._asSet())._collect_((function(each){
|
|
|
|
|
|
return $core.withContext(function($ctx6) {
|
|
|
|
|
@@ -3825,8 +3879,8 @@ return $recv($recv(each)._variable())._alias();
|
|
|
}, function($ctx5) {$ctx5.fillBlock({internalVars:internalVars},$ctx4,5)});
|
|
|
|
|
|
}));
|
|
|
-$7=$recv($recv(anIRMethod)._scope())._hasNonLocalReturn();
|
|
|
-if($core.assert($7)){
|
|
|
+$6=$recv($recv(anIRMethod)._scope())._hasNonLocalReturn();
|
|
|
+if($core.assert($6)){
|
|
|
return $recv($self._stream())._nextPutNonLocalReturnHandlingWith_((function(){
|
|
|
|
|
|
return $core.withContext(function($ctx5) {
|
|
@@ -3868,17 +3922,16 @@ $ctx4.supercall = false;
|
|
|
}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
|
|
|
|
|
|
}));
|
|
|
-return $self._contents();
|
|
|
|
|
|
}, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRJSTranslator)});
|
|
|
|
|
|
},
|
|
|
|
|
|
args: ["anIRMethod"],
|
|
|
-source: "visitIRMethod: anIRMethod\x0a\x0a\x09self stream\x0a\x09\x09nextPutMethodDeclaration: anIRMethod\x0a\x09\x09with: [ self stream\x0a\x09\x09\x09nextPutFunctionWith: [\x0a\x09\x09\x09\x09self stream nextPutVars: (anIRMethod tempDeclarations collect: [ :each |\x0a\x09\x09\x09\x09\x09each name asVariableName ]).\x0a\x09\x09\x09\x09self stream nextPutContextFor: anIRMethod during: [\x0a\x09\x09\x09\x09\x09anIRMethod internalVariables ifNotEmpty: [ :internalVars |\x0a\x09\x09\x09\x09\x09\x09self stream nextPutVars: \x0a\x09\x09\x09\x09\x09\x09\x09(internalVars asSet collect: [ :each | each variable alias ]) ].\x0a\x09\x09\x09\x09anIRMethod scope hasNonLocalReturn\x0a\x09\x09\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x09\x09self stream nextPutNonLocalReturnHandlingWith: [\x0a\x09\x09\x09\x09\x09\x09\x09super visitIRMethod: anIRMethod ] ]\x0a\x09\x09\x09\x09\x09ifFalse: [ super visitIRMethod: anIRMethod ] ]]\x0a\x09\x09\x09arguments: anIRMethod arguments ].\x0a\x09^ self contents",
|
|
|
+source: "visitIRMethod: anIRMethod\x0a\x0a\x09^ self\x0a\x09\x09buildMethodDeclaration: anIRMethod\x0a\x09\x09with: [ self stream\x0a\x09\x09\x09nextPutFunctionWith: [\x0a\x09\x09\x09\x09self stream nextPutVars: (anIRMethod tempDeclarations collect: [ :each |\x0a\x09\x09\x09\x09\x09each name asVariableName ]).\x0a\x09\x09\x09\x09self stream nextPutContextFor: anIRMethod during: [\x0a\x09\x09\x09\x09\x09anIRMethod internalVariables ifNotEmpty: [ :internalVars |\x0a\x09\x09\x09\x09\x09\x09self stream nextPutVars: \x0a\x09\x09\x09\x09\x09\x09\x09(internalVars asSet collect: [ :each | each variable alias ]) ].\x0a\x09\x09\x09\x09anIRMethod scope hasNonLocalReturn\x0a\x09\x09\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x09\x09self stream nextPutNonLocalReturnHandlingWith: [\x0a\x09\x09\x09\x09\x09\x09\x09super visitIRMethod: anIRMethod ] ]\x0a\x09\x09\x09\x09\x09ifFalse: [ super visitIRMethod: anIRMethod ] ]]\x0a\x09\x09\x09arguments: anIRMethod arguments ]",
|
|
|
referencedClasses: [],
|
|
|
|
|
|
-messageSends: ["nextPutMethodDeclaration:with:", "stream", "nextPutFunctionWith:arguments:", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "nextPutContextFor:during:", "ifNotEmpty:", "internalVariables", "asSet", "alias", "variable", "ifTrue:ifFalse:", "hasNonLocalReturn", "scope", "nextPutNonLocalReturnHandlingWith:", "visitIRMethod:", "arguments", "contents"]
|
|
|
+messageSends: ["buildMethodDeclaration:with:", "nextPutFunctionWith:arguments:", "stream", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "nextPutContextFor:during:", "ifNotEmpty:", "internalVariables", "asSet", "alias", "variable", "ifTrue:ifFalse:", "hasNonLocalReturn", "scope", "nextPutNonLocalReturnHandlingWith:", "visitIRMethod:", "arguments"]
|
|
|
}),
|
|
|
$globals.IRJSTranslator);
|
|
|
|
|
@@ -4982,7 +5035,7 @@ var self=this,$self=this;
|
|
|
return $core.withContext(function($ctx1) {
|
|
|
|
|
|
var $1,$2,$3,$4,$5;
|
|
|
-$recv($self.stream)._nextPutAll_("fn: function (");
|
|
|
+$recv($self.stream)._nextPutAll_("(function (");
|
|
|
|
|
|
$ctx1.sendIdx["nextPutAll:"]=1;
|
|
|
|
|
@@ -5027,7 +5080,7 @@ $ctx1.sendIdx["lf"]=2;
|
|
|
$recv(aBlock)._value();
|
|
|
$5=$self.stream;
|
|
|
$recv($5)._lf();
|
|
|
-$recv($5)._nextPutAll_("}");
|
|
|
+$recv($5)._nextPutAll_("})");
|
|
|
return self;
|
|
|
|
|
|
}, function($ctx1) {$ctx1.fill(self,"nextPutFunctionWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)});
|
|
@@ -5035,7 +5088,7 @@ return self;
|
|
|
},
|
|
|
|
|
|
args: ["aBlock", "anArray"],
|
|
|
-source: "nextPutFunctionWith: aBlock arguments: anArray\x0a\x09stream nextPutAll: 'fn: function ('.\x0a\x09anArray\x0a\x09\x09do: [ :each | stream nextPutAll: each asVariableName ]\x0a\x09\x09separatedBy: [ stream nextPut: ',' ].\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09stream nextPutAll: 'var self=this,$self=this;'; lf.\x0a\x09aBlock value.\x0a\x09stream lf; nextPutAll: '}'",
|
|
|
+source: "nextPutFunctionWith: aBlock arguments: anArray\x0a\x09stream nextPutAll: '(function ('.\x0a\x09anArray\x0a\x09\x09do: [ :each | stream nextPutAll: each asVariableName ]\x0a\x09\x09separatedBy: [ stream nextPut: ',' ].\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09stream nextPutAll: 'var self=this,$self=this;'; lf.\x0a\x09aBlock value.\x0a\x09stream lf; nextPutAll: '})'",
|
|
|
referencedClasses: [],
|
|
|
|
|
|
messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
|