Browse Source

Remove optimization.

Dangerous in world of new JS value types.
Herbert Vojčík 7 years ago
parent
commit
c86c4ca6a1
1 changed files with 2 additions and 9 deletions
  1. 2 9
      support/boot.js

+ 2 - 9
support/boot.js

@@ -667,15 +667,8 @@ define(['require', './brikz', './compatibility'], function (require, Brikz) {
          */
         this.asReceiver = function (o) {
             if (o == null) return nil;
-            if (typeof o === "object" || typeof o === "function") {
-                return o.klass != null ? o : globals.JSObjectProxy._on_(o);
-            }
-            // IMPORTANT: This optimization (return o if typeof !== "object")
-            // assumes all primitive types are coupled with some
-            // (detached root) Smalltalk class so they can be returned as-is,
-            // without boxing and looking for .klass.
-            // KEEP THE primitives-are-coupled INVARIANT!
-            return o;
+            else if (o.klass != null) return o;
+            else return globals.JSObjectProxy._on_(o);
         };
     }