fix(ivy): allow `FunctionExpression` to indicate a method declaration (#24897)
In some code formats (e.g. ES5) methods can actually be function expressions. For example: ```js function MyClass() {} // this static method is declared as a function expression MyClass.staticMethod = function() { ... }; ``` PR Close #24897
This commit is contained in:
parent
67588ec606
commit
6f1685ab98
|
@ -279,7 +279,7 @@ interface Context {
|
|||
absoluteModuleName: string|null;
|
||||
scope: Scope;
|
||||
foreignFunctionResolver?
|
||||
(ref: Reference<ts.FunctionDeclaration|ts.MethodDeclaration>,
|
||||
(ref: Reference<ts.FunctionDeclaration|ts.MethodDeclaration|ts.FunctionExpression>,
|
||||
args: ReadonlyArray<ts.Expression>): ts.Expression|null;
|
||||
}
|
||||
|
||||
|
@ -528,7 +528,7 @@ class StaticInterpreter {
|
|||
value = this.visitExpression(member.value, context);
|
||||
} else if (member.implementation !== null) {
|
||||
value = new NodeReference(member.implementation, absoluteModuleName);
|
||||
} else {
|
||||
} else if (member.node) {
|
||||
value = new NodeReference(member.node, absoluteModuleName);
|
||||
}
|
||||
}
|
||||
|
@ -670,7 +670,7 @@ class StaticInterpreter {
|
|||
}
|
||||
|
||||
function isFunctionOrMethodReference(ref: Reference<ts.Node>):
|
||||
ref is Reference<ts.FunctionDeclaration|ts.MethodDeclaration> {
|
||||
ref is Reference<ts.FunctionDeclaration|ts.MethodDeclaration|ts.FunctionExpression> {
|
||||
return ts.isFunctionDeclaration(ref.node) || ts.isMethodDeclaration(ref.node);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue