fix bug where importing variables with special free names is broken
This commit is contained in:
parent
73bddc4d19
commit
90c2392b29
|
@ -2131,17 +2131,17 @@ class JavascriptParser {
|
|||
const callee = this.evaluateExpression(expression.callee);
|
||||
if (callee.isIdentifier()) {
|
||||
const result1 = this.callHooksForInfo(
|
||||
this.hooks.call,
|
||||
callee.identifier,
|
||||
expression
|
||||
);
|
||||
if (result1 === true) return;
|
||||
const result2 = this.callHooksForInfo(
|
||||
this.hooks.callMemberChain,
|
||||
callee.rootInfo,
|
||||
expression,
|
||||
callee.getMembers()
|
||||
);
|
||||
if (result1 === true) return;
|
||||
const result2 = this.callHooksForInfo(
|
||||
this.hooks.call,
|
||||
callee.identifier,
|
||||
expression
|
||||
);
|
||||
if (result2 === true) return;
|
||||
}
|
||||
|
||||
|
@ -2167,17 +2167,17 @@ class JavascriptParser {
|
|||
|
||||
walkMemberExpressionWithExpressionName(expression, name, rootInfo, members) {
|
||||
const result1 = this.callHooksForInfo(
|
||||
this.hooks.expression,
|
||||
name,
|
||||
expression
|
||||
);
|
||||
if (result1 === true) return;
|
||||
const result2 = this.callHooksForInfo(
|
||||
this.hooks.expressionMemberChain,
|
||||
rootInfo,
|
||||
expression,
|
||||
members
|
||||
);
|
||||
if (result1 === true) return;
|
||||
const result2 = this.callHooksForInfo(
|
||||
this.hooks.expression,
|
||||
name,
|
||||
expression
|
||||
);
|
||||
if (result2 === true) return;
|
||||
if (expression.object.type === "MemberExpression") {
|
||||
// optimize case where expression.object is a MemberExpression too.
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
import define from "./module";
|
||||
|
||||
const i = x => x;
|
||||
|
||||
it("should allow to import a variable named define (call)", () => {
|
||||
expect(define()).toBe("ok");
|
||||
});
|
||||
|
||||
it("should allow to import a variable named define (expresion)", () => {
|
||||
const d = i(define);
|
||||
expect(d()).toBe("ok");
|
||||
});
|
|
@ -0,0 +1,3 @@
|
|||
export const define = () => "ok";
|
||||
|
||||
export { define as default };
|
Loading…
Reference in New Issue