mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-07-05 09:31:51 +00:00
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:
@ -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(
|
||||
|
Reference in New Issue
Block a user