sptc 0.0.10 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/engine/interpreter.js +13 -3
- package/package.json +1 -1
- package/tests/www/dd.s +2 -0
- package/tests/www/index.s +4 -0
package/engine/interpreter.js
CHANGED
|
@@ -239,7 +239,18 @@ function buildContext(ctx0, option) {
|
|
|
239
239
|
isEntry: false,
|
|
240
240
|
})
|
|
241
241
|
const ret=executeVm(_vm, _ctx, priv)
|
|
242
|
-
return
|
|
242
|
+
return new Proxy(_ctx._exports, {
|
|
243
|
+
get: (target, prop, receiver)=>{
|
|
244
|
+
if(false===prop in target) {
|
|
245
|
+
try{
|
|
246
|
+
return ret.constructor('return '+prop)()
|
|
247
|
+
}catch(e) {
|
|
248
|
+
return undefined
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
return target[prop]
|
|
252
|
+
},
|
|
253
|
+
})
|
|
243
254
|
}
|
|
244
255
|
|
|
245
256
|
ctx.__autoload=fn=>{
|
|
@@ -259,8 +270,7 @@ function buildContext(ctx0, option) {
|
|
|
259
270
|
if(priv.__autoload_func) {
|
|
260
271
|
let inc_fn=priv.__autoload_func(prop)
|
|
261
272
|
if(inc_fn) {
|
|
262
|
-
|
|
263
|
-
return priv.__autoload_vars[prop]=e.default || e.__getter__(prop)
|
|
273
|
+
return priv.__autoload_vars[prop]=ctx.include(inc_fn)[prop]
|
|
264
274
|
}
|
|
265
275
|
}
|
|
266
276
|
}
|
package/package.json
CHANGED
package/tests/www/dd.s
ADDED