mirror of
https://github.com/facebookarchive/prepack.git
synced 2024-11-10 14:09:42 +03:00
Fixing code generation.
This commit is contained in:
parent
fb9272da50
commit
ab51aa2b5e
@ -284,7 +284,7 @@ export class PreludeGenerator {
|
|||||||
globalReference(key: string, globalScope: boolean = false) {
|
globalReference(key: string, globalScope: boolean = false) {
|
||||||
if (globalScope && t.isValidIdentifier(key)) return t.identifier(key);
|
if (globalScope && t.isValidIdentifier(key)) return t.identifier(key);
|
||||||
let keyNode = t.isValidIdentifier(key) ? t.identifier(key) : t.stringLiteral(key);
|
let keyNode = t.isValidIdentifier(key) ? t.identifier(key) : t.stringLiteral(key);
|
||||||
return t.memberExpression(this.memoizeReference("::global"), keyNode);
|
return t.memberExpression(this.memoizeReference("::global"), keyNode, !t.isIdentifier(keyNode));
|
||||||
}
|
}
|
||||||
|
|
||||||
memoizeReference(key: string): BabelNodeIdentifier | BabelNodeMemberExpression | BabelNodeThisExpression {
|
memoizeReference(key: string): BabelNodeIdentifier | BabelNodeMemberExpression | BabelNodeThisExpression {
|
||||||
|
10
test/serializer/basic/UniqueNames.js
Normal file
10
test/serializer/basic/UniqueNames.js
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
(function() {
|
||||||
|
function bar() {
|
||||||
|
try {
|
||||||
|
return _0.name;
|
||||||
|
} catch(e) {
|
||||||
|
return "exception";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
inspect = function() { return bar(); }
|
||||||
|
})();
|
Loading…
Reference in New Issue
Block a user