mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-07-11 04:21:52 +00:00
Move built-in declarations to actual sources; Remove declaration is null checks; Resolve calls
This commit is contained in:
bin
examples/tlsf
src
ast.tsbuiltins.tscompiler.tsdiagnosticMessages.generated.tsdiagnosticMessages.jsondiagnostics.ts
extra
parser.tsprogram.tsstd
tests
22
src/ast.ts
22
src/ast.ts
@ -560,7 +560,7 @@ export abstract class Node {
|
||||
return elem;
|
||||
}
|
||||
|
||||
static createParameter(identifier: IdentifierExpression, type: TypeNode | null, initializer: Expression | null, isRest: bool, range: Range): Parameter {
|
||||
static createParameter(identifier: IdentifierExpression, type: TypeNode | null, initializer: Expression | null, kind: ParameterKind, range: Range): Parameter {
|
||||
var elem = new Parameter();
|
||||
elem.range = range;
|
||||
(elem.name = identifier).parent = elem;
|
||||
@ -568,7 +568,7 @@ export abstract class Node {
|
||||
(<TypeNode>type).parent = elem;
|
||||
if (elem.initializer = initializer)
|
||||
(<Expression>initializer).parent = elem;
|
||||
elem.isRest = isRest;
|
||||
elem.parameterKind = kind;
|
||||
return elem;
|
||||
}
|
||||
|
||||
@ -1050,7 +1050,7 @@ export class Source extends Node {
|
||||
/** Tests if this source is an entry file. */
|
||||
get isEntry(): bool { return this.sourceKind == SourceKind.ENTRY; }
|
||||
/** Tests if this source is a stdlib file. */
|
||||
get isStdlib(): bool { return this.sourceKind == SourceKind.LIBRARY; }
|
||||
get isLibrary(): bool { return this.sourceKind == SourceKind.LIBRARY; }
|
||||
}
|
||||
|
||||
/** Base class of all declaration statements. */
|
||||
@ -1352,18 +1352,28 @@ export class NamespaceDeclaration extends DeclarationStatement {
|
||||
members: Statement[];
|
||||
}
|
||||
|
||||
/** Represents the kind of a parameter. */
|
||||
export enum ParameterKind {
|
||||
/** No specific flags. */
|
||||
DEFAULT,
|
||||
/** Is an optional parameter. */
|
||||
OPTIONAL,
|
||||
/** Is a rest parameter. */
|
||||
REST
|
||||
}
|
||||
|
||||
/** Represents a function parameter. */
|
||||
export class Parameter extends Node {
|
||||
kind = NodeKind.PARAMETER;
|
||||
|
||||
/** Parameter name. */
|
||||
name: IdentifierExpression | null;
|
||||
name: IdentifierExpression;
|
||||
/** Parameter type. */
|
||||
type: TypeNode | null;
|
||||
/** Parameter kind. */
|
||||
parameterKind: ParameterKind;
|
||||
/** Initializer expression, if present. */
|
||||
initializer: Expression | null;
|
||||
/** Whether a rest parameter or not. */
|
||||
isRest: bool;
|
||||
}
|
||||
|
||||
/** Represents a single modifier. */
|
||||
|
Reference in New Issue
Block a user