1
0
Просмотр исходного кода

Merge pull request #330 from herby/context-defaults

Using .prototype defaults to eschew setting in constructor.
Nicolas Petton 12 лет назад
Родитель
Сommit
54aec497e2
1 измененных файлов с 7 добавлено и 5 удалено
  1. 7 5
      js/boot.js

+ 7 - 5
js/boot.js

@@ -727,10 +727,15 @@ function SmalltalkMethodContext(home, setup) {
 	this.homeContext = home;
     this.setup       = setup || function() {};
     this.pc          = 0;
-    this.locals      = {};
-    this.args        = [];
 }
 
+// Fallbacks
+SmalltalkMethodContext.prototype.args = [];
+SmalltalkMethodContext.prototype.locals = {};
+SmalltalkMethodContext.prototype.receiver = null;
+SmalltalkMethodContext.prototype.selector = null;
+SmalltalkMethodContext.prototype.lookupClass = null;
+
 inherits(SmalltalkMethodContext, SmalltalkObject);
 
 SmalltalkMethodContext.prototype.fill = function(receiver, selector, args, locals, lookupClass) {
@@ -742,11 +747,8 @@ SmalltalkMethodContext.prototype.fill = function(receiver, selector, args, local
 };
 
 SmalltalkMethodContext.prototype.fillBlock = function(args, locals) {
-    this.receiver    = null;
-    this.selector    = null;
     this.args        = args || [];
     this.locals      = locals || {};
-    this.lookupClass = null;
 };
 
 SmalltalkMethodContext.prototype.init = function() {