fix(ivy): allow `FunctionExpression` to indicate a method declaration (#25406)

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 #25406
This commit is contained in:
Pete Bacon Darwin 2018-07-16 08:45:32 +01:00 committed by Matias Niemelä
parent f87b499dde
commit a528636f56
1 changed files with 2 additions and 1 deletions

View File

@ -671,7 +671,8 @@ class StaticInterpreter {
function isFunctionOrMethodReference(ref: Reference<ts.Node>):
ref is Reference<ts.FunctionDeclaration|ts.MethodDeclaration|ts.FunctionExpression> {
return ts.isFunctionDeclaration(ref.node) || ts.isMethodDeclaration(ref.node);
return ts.isFunctionDeclaration(ref.node) || ts.isMethodDeclaration(ref.node) ||
ts.isFunctionExpression(ref.node);
}
function literal(value: ResolvedValue): any {