Sfoglia il codice sorgente

kernel: fill{,Block} w/ more fallbacks

Herbert Vojčík 7 anni fa
parent
commit
f91e737bd9
1 ha cambiato i file con 6 aggiunte e 4 eliminazioni
  1. 6 4
      support/kernel-runtime.js

+ 6 - 4
support/kernel-runtime.js

@@ -268,24 +268,26 @@ define(function () {
         }
 
         // Fallbacks
-        SmalltalkMethodContext.prototype.locals = {};
+        SmalltalkMethodContext.prototype.locals = Object.freeze({});
         SmalltalkMethodContext.prototype.receiver = null;
         SmalltalkMethodContext.prototype.selector = null;
         SmalltalkMethodContext.prototype.lookupClass = null;
+        SmalltalkMethodContext.prototype.outerContext = null;
+        SmalltalkMethodContext.prototype.index = 0;
 
         defineMethod(SmalltalkMethodContext, "fill", function (receiver, selector, locals, lookupClass) {
             this.receiver = receiver;
             this.selector = selector;
-            this.locals = locals || {};
+            if (locals != null) this.locals = locals;
             this.lookupClass = lookupClass;
             if (this.homeContext) {
                 this.homeContext.evaluatedSelector = selector;
             }
         });
         defineMethod(SmalltalkMethodContext, "fillBlock", function (locals, ctx, index) {
-            this.locals = locals || {};
+            if (locals != null) this.locals = locals;
             this.outerContext = ctx;
-            this.index = index || 0;
+            if (index) this.index = index;
         });
         defineMethod(SmalltalkMethodContext, "init", function () {
             var frame = this;