Browse Source

kernel: Move JSObjectProxy wrapping to runtime.

Herbert Vojčík 7 years ago
parent
commit
ba2bdc0b7c
2 changed files with 9 additions and 4 deletions
  1. 2 3
      support/boot.js
  2. 7 1
      support/kernel-runtime.js

+ 2 - 3
support/boot.js

@@ -760,9 +760,8 @@ define(['require', './brikz', './compatibility'], function (require, Brikz) {
 
     /* Defines asReceiver to be present at load time */
     /* (logically it belongs more to PrimitiveBrik) */
-    AsReceiverBrik.deps = ["smalltalkGlobals", "root"];
+    AsReceiverBrik.deps = ["root"];
     function AsReceiverBrik (brikz, st) {
-        var globals = brikz.smalltalkGlobals.globals;
         var nilAsReceiver = brikz.root.nilAsReceiver;
 
         /**
@@ -777,7 +776,7 @@ define(['require', './brikz', './compatibility'], function (require, Brikz) {
         this.asReceiver = function (o) {
             if (o == null) return nilAsReceiver;
             else if (o.klass != null) return o;
-            else return globals.JSObjectProxy._on_(o);
+            else return st.wrapJavaScript(o);
         };
     }
 

+ 7 - 1
support/kernel-runtime.js

@@ -441,6 +441,12 @@ define(function () {
             );
         }
 
+        function wrapJavaScript (o) {
+            return globals.JSObjectProxy._on_(o);
+        }
+
+        st.wrapJavaScript = wrapJavaScript;
+
         /* Handles #dnu: *and* JavaScript method calls.
          if the receiver has no klass, we consider it a JS object (outside of the
          Amber system). Else assume that the receiver understands #doesNotUnderstand: */
@@ -459,7 +465,7 @@ define(function () {
              Else try wrapping a JSObjectProxy around the receiver. */
             var propertyName = st.st2prop(stSelector);
             if (!(propertyName in receiver)) {
-                return invokeDnuMethod(globals.JSObjectProxy._on_(receiver), stSelector, args);
+                return invokeDnuMethod(wrapJavaScript(receiver), stSelector, args);
             }
             return accessJavaScript(receiver, propertyName, args);
         }