-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: various fixes, jobject construction replace new operator
- Loading branch information
Showing
20 changed files
with
785 additions
and
309 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
exports._ = function _construct_jobject(callee, ...$args) { | ||
let c, | ||
r = new callee(...$args); | ||
if (callee === Proxy) { | ||
return r; | ||
} | ||
|
||
if (global.__jymfony !== void 0 && r instanceof __jymfony.JObject) { | ||
c = r.__construct(...$args); | ||
} | ||
|
||
if ( | ||
void 0 !== global.mixins && | ||
void 0 !== r[global.mixins.initializerSymbol] | ||
) { | ||
r[global.mixins.initializerSymbol](...$args); | ||
} | ||
|
||
if (c !== void 0 && r !== c) { | ||
return c; | ||
} | ||
|
||
let self = r; | ||
if ( | ||
global.__jymfony !== void 0 && | ||
r instanceof __jymfony.JObject && | ||
__jymfony.autoload !== void 0 && | ||
__jymfony.autoload.debug | ||
) { | ||
Reflect.preventExtensions(self); | ||
// self = new Proxy(self, { | ||
// get: (target, p) => { | ||
// if (p !== Symbol.toStringTag && ! Reflect.has(target, p)) { | ||
// throw new TypeError('Undefined property ' + p.toString() + ' on instance of ' + ReflectionClass.getClassName(target)); | ||
// } | ||
// | ||
// return Reflect.get(target, p); | ||
// }, | ||
// }); | ||
} | ||
|
||
if (Reflect.has(r, '__invoke')) { | ||
return new Proxy(self.__invoke, { | ||
get: (_, key) => { | ||
if (Symbol.for('jymfony.namespace.class') === key) { | ||
return self; | ||
} | ||
|
||
return Reflect.get(self, key); | ||
}, | ||
set(_, p, newValue, receiver) { | ||
return Reflect.set(self, p, newValue, receiver); | ||
}, | ||
has(_, p) { | ||
return Reflect.has(self, p); | ||
}, | ||
deleteProperty(_, p) { | ||
return Reflect.deleteProperty(self, p); | ||
}, | ||
defineProperty(_, property, attributes) { | ||
return Reflect.defineProperty(self, property, attributes); | ||
}, | ||
enumerate(_) { | ||
return Reflect.enumerate(self); | ||
}, | ||
ownKeys(_) { | ||
return Reflect.ownKeys(self); | ||
}, | ||
apply: (_, ctx, args) => { | ||
return self.__invoke(...args); | ||
}, | ||
construct(_, argArray, newTarget) { | ||
return Reflect.construct(self, argArray, newTarget); | ||
}, | ||
getPrototypeOf(_) { | ||
return Reflect.getPrototypeOf(self); | ||
}, | ||
setPrototypeOf(_, v) { | ||
return Reflect.setPrototypeOf(self, v); | ||
}, | ||
isExtensible(_) { | ||
return Reflect.isExtensible(self); | ||
}, | ||
preventExtensions(_) { | ||
Reflect.preventExtensions(self); | ||
|
||
return false; | ||
}, | ||
getOwnPropertyDescriptor(target, key) { | ||
if (Symbol.for('jymfony.namespace.class') === key) { | ||
return { | ||
configurable: true, | ||
enumerable: false, | ||
value: self, | ||
}; | ||
} | ||
|
||
return Reflect.getOwnPropertyDescriptor(self, key); | ||
}, | ||
}); | ||
} | ||
|
||
return self; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@jymfony/compiler", | ||
"version": "0.5.0-alpha.2", | ||
"version": "0.5.0-beta.1", | ||
"type": "commonjs", | ||
"author": "Alessandro Chitolina <[email protected]>", | ||
"license": "MIT", | ||
|
@@ -9,7 +9,7 @@ | |
"build": "wasm-pack build --out-name compiler --target nodejs --dev && RUSTFLAGS=\"-C target-feature=+simd128\" wasm-pack build --out-dir simd --out-name compiler --target nodejs --dev --features=simd --target-dir=simd-target", | ||
"pretest": "npm run build", | ||
"test": "mocha tests/wasm/", | ||
"prepublishOnly": "npm run build-release && bash -c 'rm {pkg,simd}/{.gitignore,package.json}'" | ||
"prepublishOnly": "npm run build-release && bash -c 'rm {pkg,simd}/{.gitignore,package.json,LICENSE}'" | ||
}, | ||
"main": "index.js", | ||
"types": "index.d.ts", | ||
|
@@ -23,6 +23,7 @@ | |
"index.js", | ||
"index.d.ts", | ||
"lib/_apply_decs_2203_r.js", | ||
"lib/_construct_jobject.js", | ||
"lib/reflection.js", | ||
"pkg/compiler.js", | ||
"pkg/compiler.d.ts", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.