Browse Source

Merge pull request #329 from herby/fillblock

Fixing and shortening block context setup.
Nicolas Petton 12 years ago
parent
commit
bb028de524
4 changed files with 12 additions and 4 deletions
  1. 1 1
      js/Compiler-IR.deploy.js
  2. 2 2
      js/Compiler-IR.js
  3. 8 0
      js/boot.js
  4. 1 1
      st/Compiler-IR.st

+ 1 - 1
js/Compiler-IR.deploy.js

@@ -2257,7 +2257,7 @@ $2=_st($1)._nextPutAll_(_st((smalltalk.String || String))._cr());
 _st(aBlock)._value();
 $3=self;
 _st($3)._nextPutAll_(_st(_st("}, function(").__comma(_st(_st(anIRClosure)._scope())._alias())).__comma(") {"));
-$4=_st($3)._nextPutAll_(_st(_st(_st(anIRClosure)._scope())._alias()).__comma(".fill(null, null, {})})"));
+$4=_st($3)._nextPutAll_(_st(_st(_st(anIRClosure)._scope())._alias()).__comma(".fillBlock()})"));
 return self}, function($ctx1) {$ctx1.fill(self,"nextPutBlockContextFor:during:", [anIRClosure,aBlock], {}, smalltalk.JSStream)})}
 }),
 smalltalk.JSStream);

+ 2 - 2
js/Compiler-IR.js

@@ -3032,10 +3032,10 @@ $2=_st($1)._nextPutAll_(_st((smalltalk.String || String))._cr());
 _st(aBlock)._value();
 $3=self;
 _st($3)._nextPutAll_(_st(_st("}, function(").__comma(_st(_st(anIRClosure)._scope())._alias())).__comma(") {"));
-$4=_st($3)._nextPutAll_(_st(_st(_st(anIRClosure)._scope())._alias()).__comma(".fill(null, null, {})})"));
+$4=_st($3)._nextPutAll_(_st(_st(_st(anIRClosure)._scope())._alias()).__comma(".fillBlock()})"));
 return self}, function($ctx1) {$ctx1.fill(self,"nextPutBlockContextFor:during:", [anIRClosure,aBlock], {}, smalltalk.JSStream)})},
 args: ["anIRClosure", "aBlock"],
-source: "nextPutBlockContextFor: anIRClosure during: aBlock\x0a\x09self \x0a    \x09nextPutAll: 'return smalltalk.withContext(function(', anIRClosure scope alias, ') {'; \x0a        nextPutAll: String cr.\x0a    aBlock value.\x0a    self \x0a    \x09nextPutAll: '}, function(', anIRClosure scope alias, ') {';\x0a        nextPutAll: anIRClosure scope alias, '.fill(null, null, {})})'",
+source: "nextPutBlockContextFor: anIRClosure during: aBlock\x0a\x09self \x0a    \x09nextPutAll: 'return smalltalk.withContext(function(', anIRClosure scope alias, ') {'; \x0a        nextPutAll: String cr.\x0a    aBlock value.\x0a    self \x0a    \x09nextPutAll: '}, function(', anIRClosure scope alias, ') {';\x0a        nextPutAll: anIRClosure scope alias, '.fillBlock()})'",
 messageSends: ["nextPutAll:", ",", "alias", "scope", "cr", "value"],
 referencedClasses: ["String"]
 }),

+ 8 - 0
js/boot.js

@@ -741,6 +741,14 @@ SmalltalkMethodContext.prototype.fill = function(receiver, selector, args, local
     this.lookupClass = lookupClass;
 };
 
+SmalltalkMethodContext.prototype.fillBlock = function() {
+    this.receiver    = null;
+    this.selector    = null;
+    this.args        = [];
+    this.locals      = {};
+    this.lookupClass = null;
+};
+
 SmalltalkMethodContext.prototype.init = function() {
 	var home = this.homeContext;
 	if(home) {home = home.init()}

+ 1 - 1
st/Compiler-IR.st

@@ -1031,7 +1031,7 @@ nextPutBlockContextFor: anIRClosure during: aBlock
     aBlock value.
     self 
     	nextPutAll: '}, function(', anIRClosure scope alias, ') {';
-        nextPutAll: anIRClosure scope alias, '.fill(null, null, {})})'
+        nextPutAll: anIRClosure scope alias, '.fillBlock()})'
 !
 
 nextPutClosureWith: aBlock arguments: anArray