Infer function expressions in matching contexts (#514)

* legalizes omitting types on function expressions within function type contexts
* legalizes omitting any number of arguments
This commit is contained in:
Daniel Wirtz
2019-02-27 21:45:36 +01:00
committed by GitHub
parent 2945af6557
commit e8b0767143
29 changed files with 1349 additions and 701 deletions

View File

@ -47,6 +47,7 @@ import {
TypeParameterNode,
CommonTypeNode,
TypeNode,
ArrowKind,
Expression,
IdentifierExpression,
@ -424,7 +425,7 @@ export class Program extends DiagnosticEmitter {
),
null, false, range)
),
null, null, flags, range
null, null, flags, ArrowKind.NONE, range
);
}
@ -2387,6 +2388,11 @@ export class FunctionPrototype extends DeclaredElement {
return (<FunctionDeclaration>this.declaration).body;
}
/** Gets the arrow function kind. */
get arrowKind(): ArrowKind {
return (<FunctionDeclaration>this.declaration).arrowKind;
}
/** Tests if this prototype is bound to a class. */
get isBound(): bool {
var parent = this.parent;
@ -2464,6 +2470,8 @@ export class Function extends TypedElement {
/** Counting id of inline operations involving this function. */
nextInlineId: i32 = 0;
/** Counting id of anonymous inner functions. */
nextAnonymousId: i32 = 0;
/** Constructs a new concrete function. */
constructor(