Skip to content

Commit 874dd6e

Browse files
committed
Nightly v0.9.4-nightly.20200428
1 parent 188b43c commit 874dd6e

File tree

5 files changed

+103
-22
lines changed

5 files changed

+103
-22
lines changed

dist/asc.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/asc.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/assemblyscript.d.ts

Lines changed: 99 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ declare module "assemblyscript/src/common" {
6060
INLINED = 8388608,
6161
/** Is scoped. */
6262
SCOPED = 16777216,
63-
/** Is a trampoline. */
64-
TRAMPOLINE = 33554432,
63+
/** Is a stub. */
64+
STUB = 33554432,
6565
/** Is a virtual method. */
6666
VIRTUAL = 67108864,
6767
/** Is (part of) a closure. */
@@ -89,6 +89,8 @@ declare module "assemblyscript/src/common" {
8989
export const LIBRARY_PREFIX: string;
9090
/** Path index suffix. */
9191
export const INDEX_SUFFIX: string;
92+
/** Stub function delimiter. */
93+
export const STUB_DELIMITER = "@";
9294
/** Common names. */
9395
export namespace CommonNames {
9496
const EMPTY = "";
@@ -250,6 +252,9 @@ declare module "assemblyscript/src/diagnosticMessages.generated" {
250252
Expression_cannot_be_represented_by_a_type = 225,
251253
Expression_resolves_to_unusual_type_0 = 226,
252254
Array_literal_expected = 227,
255+
Function_0_is_virtual_and_will_not_be_inlined = 228,
256+
Property_0_only_has_a_setter_and_is_missing_a_getter = 229,
257+
_0_keyword_cannot_be_used_here = 230,
253258
Type_0_is_cyclic_Module_will_include_deferred_garbage_collection = 900,
254259
Importing_the_table_disables_some_indirect_call_optimizations = 901,
255260
Exporting_the_table_disables_some_indirect_call_optimizations = 902,
@@ -317,6 +322,7 @@ declare module "assemblyscript/src/diagnosticMessages.generated" {
317322
Duplicate_identifier_0 = 2300,
318323
Cannot_find_name_0 = 2304,
319324
Module_0_has_no_exported_member_1 = 2305,
325+
An_interface_can_only_extend_an_interface = 2312,
320326
Generic_type_0_requires_1_type_argument_s = 2314,
321327
Type_0_is_not_generic = 2315,
322328
Type_0_is_not_assignable_to_type_1 = 2322,
@@ -334,12 +340,16 @@ declare module "assemblyscript/src/diagnosticMessages.generated" {
334340
Operator_0_cannot_be_applied_to_types_1_and_2 = 2365,
335341
A_super_call_must_be_the_first_statement_in_the_constructor = 2376,
336342
Constructors_for_derived_classes_must_contain_a_super_call = 2377,
343+
Getter_and_setter_accessors_do_not_agree_in_visibility = 2379,
337344
_get_and_set_accessor_must_have_the_same_type = 2380,
345+
Overload_signatures_must_all_be_public_private_or_protected = 2385,
338346
Constructor_implementation_is_missing = 2390,
339347
Function_implementation_is_missing_or_not_immediately_following_the_declaration = 2391,
340348
Multiple_constructor_implementations_are_not_allowed = 2392,
341349
Duplicate_function_implementation = 2393,
350+
This_overload_signature_is_not_compatible_with_its_implementation_signature = 2394,
342351
Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local = 2395,
352+
A_class_can_only_implement_an_interface = 2422,
343353
A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged = 2434,
344354
Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses = 2445,
345355
The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly = 2453,
@@ -349,6 +359,7 @@ declare module "assemblyscript/src/diagnosticMessages.generated" {
349359
Export_declaration_conflicts_with_exported_declaration_of_0 = 2484,
350360
_0_is_referenced_directly_or_indirectly_in_its_own_base_expression = 2506,
351361
Cannot_create_an_instance_of_an_abstract_class = 2511,
362+
Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_2 = 2515,
352363
Object_is_possibly_null = 2531,
353364
Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property = 2540,
354365
The_target_of_an_assignment_must_be_a_variable_or_a_property_access = 2541,
@@ -646,6 +657,8 @@ declare module "assemblyscript/src/diagnostics" {
646657
private constructor();
647658
/** Creates a new diagnostic message of the specified category. */
648659
static create(code: DiagnosticCode, category: DiagnosticCategory, arg0?: string | null, arg1?: string | null, arg2?: string | null): DiagnosticMessage;
660+
/** Tests if this message equals the specified. */
661+
equals(other: DiagnosticMessage): boolean;
649662
/** Adds a source range to this message. */
650663
withRange(range: Range): this;
651664
/** Adds a related source range to this message. */
@@ -839,6 +852,7 @@ declare module "assemblyscript/src/tokenizer" {
839852
debugInfoRef: number;
840853
constructor(source: Source, start: number, end: number);
841854
static join(a: Range, b: Range): Range;
855+
equals(other: Range): boolean;
842856
get atStart(): Range;
843857
get atEnd(): Range;
844858
toString(): string;
@@ -1065,6 +1079,8 @@ declare module "assemblyscript/src/ast" {
10651079
get isNumericLiteral(): boolean;
10661080
/** Tests whether this node is guaranteed to compile to a constant value. */
10671081
get compilesToConst(): boolean;
1082+
/** Checks if this is a call calling a method on super. */
1083+
get isCallOnSuper(): boolean;
10681084
}
10691085
export abstract class TypeNode extends Node {
10701086
/** Whether nullable or not. */
@@ -2324,7 +2340,7 @@ declare module "assemblyscript/src/module" {
23242340
export function getFunctionName(func: FunctionRef): string | null;
23252341
export function getFunctionParams(func: FunctionRef): NativeType;
23262342
export function getFunctionResults(func: FunctionRef): NativeType;
2327-
export function getFunctionVars(func: FunctionRef): NativeType;
2343+
export function getFunctionVars(func: FunctionRef): NativeType[];
23282344
export function getGlobalName(global: GlobalRef): string | null;
23292345
export function getGlobalType(global: GlobalRef): NativeType;
23302346
export function isGlobalMutable(global: GlobalRef): boolean;
@@ -2344,6 +2360,23 @@ declare module "assemblyscript/src/module" {
23442360
addBranchForSwitch(from: number, to: number, indexes: number[], code?: ExpressionRef): void;
23452361
renderAndDispose(entry: number, labelHelper: Index): ExpressionRef;
23462362
}
2363+
/** Builds a switch using a sequence of `br_if`s. */
2364+
export class SwitchBuilder {
2365+
private module;
2366+
private condition;
2367+
private values;
2368+
private indexes;
2369+
private cases;
2370+
private defaultIndex;
2371+
/** Creates a new builder using the specified i32 condition. */
2372+
constructor(module: Module, condition: ExpressionRef);
2373+
/** Links a case to the specified branch. */
2374+
addCase(value: number, code: ExpressionRef[]): void;
2375+
/** Links the default branch. */
2376+
addDefault(code: ExpressionRef[]): void;
2377+
/** Renders the switch to a block. */
2378+
render(localIndex: number, labelPostfix?: string): ExpressionRef;
2379+
}
23472380
export enum SideEffects {
23482381
None = 0,
23492382
Branches = 1,
@@ -2488,6 +2521,8 @@ declare module "assemblyscript/src/types" {
24882521
asFunction(signature: Signature): Type;
24892522
/** Composes the respective nullable type of this type. */
24902523
asNullable(): Type;
2524+
/** Tests if this type equals the specified. */
2525+
equals(other: Type): boolean;
24912526
/** Tests if a value of this type is assignable to the target type incl. implicit conversion. */
24922527
isAssignableTo(target: Type, signednessIsRelevant?: boolean): boolean;
24932528
/** Tests if a value of this type is assignable to the target type excl. implicit conversion. */
@@ -2572,12 +2607,14 @@ declare module "assemblyscript/src/types" {
25722607
asFunctionTarget(program: Program): FunctionTarget;
25732608
/** Gets the known or, alternatively, generic parameter name at the specified index. */
25742609
getParameterName(index: number): string;
2610+
/** Tests if this signature equals the specified. */
2611+
equals(other: Signature): boolean;
25752612
/** Tests if a value of this function type is assignable to a target of the specified function type. */
2576-
isAssignableTo(target: Signature): boolean;
2577-
/** Tests to see if a signature equals another signature. */
2578-
equals(value: Signature): boolean;
2613+
isAssignableTo(target: Signature, requireSameSize?: boolean): boolean;
25792614
/** Converts this signature to a string. */
25802615
toString(): string;
2616+
/** Creates a clone of this signature that is safe to modify. */
2617+
clone(): Signature;
25812618
}
25822619
/** Gets the cached default parameter name for the specified index. */
25832620
export function getDefaultParameterName(index: number): string;
@@ -3373,7 +3410,9 @@ declare module "assemblyscript/src/program" {
33733410
/** Gets the (possibly merged) program element linked to the specified declaration. */
33743411
getElementByDeclaration(declaration: DeclarationStatement): DeclaredElement | null;
33753412
/** Initializes the program and its elements prior to compilation. */
3376-
initialize(options: Options): void;
3413+
initialize(): void;
3414+
/** Marks virtual members in a base class overloaded in this class. */
3415+
private markVirtuals;
33773416
/** Requires that a global library element of the specified kind is present and returns it. */
33783417
private require;
33793418
/** Requires that a non-generic global class is present and returns it. */
@@ -3435,6 +3474,8 @@ declare module "assemblyscript/src/program" {
34353474
private initializeFunction;
34363475
/** Initializes an interface. */
34373476
private initializeInterface;
3477+
/** Initializes a field of an interface, as a property. */
3478+
private initializeFieldAsProperty;
34383479
/** Initializes a namespace. */
34393480
private initializeNamespace;
34403481
/** Initializes a `type` definition. */
@@ -3567,6 +3608,12 @@ declare module "assemblyscript/src/program" {
35673608
abstract lookup(name: string): Element | null;
35683609
/** Adds an element as a member of this one. Reports and returns `false` if a duplicate. */
35693610
add(name: string, element: DeclaredElement, localIdentifierIfImport?: IdentifierExpression | null): boolean;
3611+
/** Checks if this element is public, explicitly or implicitly. */
3612+
get isPublic(): boolean;
3613+
/** Checks if this element is implicitly public, i.e. not explicitly declared to be. */
3614+
get isImplicitlyPublic(): boolean;
3615+
/** Checks if the visibility of this element equals the specified. */
3616+
visibilityEquals(other: Element): boolean;
35703617
/** Returns a string representation of this element. */
35713618
toString(): string;
35723619
}
@@ -3594,8 +3641,12 @@ declare module "assemblyscript/src/program" {
35943641
get isDeclaredInLibrary(): boolean;
35953642
/** Gets the associated identifier node. */
35963643
get identifierNode(): IdentifierExpression;
3644+
/** Gets the signature node, if applicable, along the identifier node. */
3645+
get identifierAndSignatureRange(): Range;
35973646
/** Gets the assiciated decorator nodes. */
35983647
get decoratorNodes(): DecoratorNode[] | null;
3648+
/** Checks if this element is a compatible override of the specified. */
3649+
isCompatibleOverride(base: DeclaredElement): boolean;
35993650
}
36003651
/** Checks if the specified element kind indicates a typed element. */
36013652
export function isTypedElement(kind: ElementKind): boolean;
@@ -3804,6 +3855,8 @@ declare module "assemblyscript/src/program" {
38043855
operatorKind: OperatorKind;
38053856
/** Already resolved instances. */
38063857
instances: Map<string, Function> | null;
3858+
/** Methods overloading this one, if any. These are unbound. */
3859+
overloads: Set<FunctionPrototype> | null;
38073860
/** Clones of this prototype that are bounds to specific classes. */
38083861
private boundPrototypes;
38093862
/** Constructs a new function prototype. */
@@ -3846,6 +3899,8 @@ declare module "assemblyscript/src/program" {
38463899
localsByIndex: Local[];
38473900
/** List of additional non-parameter locals. */
38483901
additionalLocals: Type[];
3902+
/** Concrete type arguments. */
3903+
typeArguments: Type[] | null;
38493904
/** Contextual type arguments. */
38503905
contextualTypeArguments: Map<string, Type> | null;
38513906
/** Default control flow. */
@@ -3856,8 +3911,10 @@ declare module "assemblyscript/src/program" {
38563911
ref: FunctionRef;
38573912
/** Function table index, if any. */
38583913
functionTableIndex: number;
3859-
/** Trampoline function for calling with omitted arguments. */
3860-
trampoline: Function | null;
3914+
/** Varargs stub for calling with omitted arguments. */
3915+
varargsStub: Function | null;
3916+
/** Virtual stub for calling overloads. */
3917+
virtualStub: Function | null;
38613918
/** Counting id of inline operations involving this function. */
38623919
nextInlineId: number;
38633920
/** Counting id of anonymous inner functions. */
@@ -3870,10 +3927,14 @@ declare module "assemblyscript/src/program" {
38703927
nameInclTypeParameters: string,
38713928
/** Respective function prototype. */
38723929
prototype: FunctionPrototype,
3930+
/** Concrete type arguments. */
3931+
typeArguments: Type[] | null,
38733932
/** Concrete signature. */
38743933
signature: Signature, // pre-resolved
38753934
/** Contextual type arguments inherited from its parent class, if any. */
38763935
contextualTypeArguments?: Map<string, Type> | null);
3936+
/** Creates a stub for use with this function, i.e. for varargs or virtual calls. */
3937+
newStub(postfix: string): Function;
38773938
/** Adds a local of the specified type, with an optional name. */
38783939
addLocal(type: Type, name?: string | null, declaration?: VariableDeclaration | null): Local;
38793940
lookup(name: string): Element | null;
@@ -3994,9 +4055,11 @@ declare module "assemblyscript/src/program" {
39944055
/** A yet unresolved class prototype. */
39954056
export class ClassPrototype extends DeclaredElement {
39964057
/** Instance member prototypes. */
3997-
instanceMembers: Map<string, Element> | null;
4058+
instanceMembers: Map<string, DeclaredElement> | null;
39984059
/** Base class prototype, if applicable. */
39994060
basePrototype: ClassPrototype | null;
4061+
/** Interface prototypes, if applicable. */
4062+
interfacePrototypes: InterfacePrototype[] | null;
40004063
/** Constructor prototype. */
40014064
constructorPrototype: FunctionPrototype | null;
40024065
/** Operator overload prototypes. */
@@ -4040,6 +4103,8 @@ declare module "assemblyscript/src/program" {
40404103
typeArguments: Type[] | null;
40414104
/** Base class, if applicable. */
40424105
base: Class | null;
4106+
/** Implemented interfaces, if applicable. */
4107+
interfaces: Set<Interface> | null;
40434108
/** Contextual type arguments for fields and methods. */
40444109
contextualTypeArguments: Map<string, Type> | null;
40454110
/** Current member memory offset. */
@@ -4058,6 +4123,10 @@ declare module "assemblyscript/src/program" {
40584123
rttiFlags: number;
40594124
/** Wrapped type, if a wrapper for a basic type. */
40604125
wrappedType: Type | null;
4126+
/** Classes directly extending this class. */
4127+
extendees: Set<Class> | null;
4128+
/** Classes implementing this interface. */
4129+
implementers: Set<Class> | null;
40614130
/** Gets the unique runtime id of this class. */
40624131
get id(): number;
40634132
/** Tests if this class is of a builtin array type (Array/TypedArray). */
@@ -4074,6 +4143,8 @@ declare module "assemblyscript/src/program" {
40744143
typeArguments?: Type[] | null, _isInterface?: boolean);
40754144
/** Sets the base class. */
40764145
setBase(base: Class): void;
4146+
/** Adds an interface. */
4147+
addInterface(iface: Interface): void;
40774148
/** Tests if a value of this class type is assignable to a target of the specified class type. */
40784149
isAssignableTo(target: Class): boolean;
40794150
/** Looks up the operator overload of the specified kind. */
@@ -4093,6 +4164,8 @@ declare module "assemblyscript/src/program" {
40934164
get isAcyclic(): boolean;
40944165
/** Tests if this class potentially forms a reference cycle to another one. */
40954166
private cyclesTo;
4167+
/** Gets all extendees of this class (that do not have the specified instance member). */
4168+
getAllExtendees(exceptIfMember?: string | null, out?: Set<Class>): Set<Class>;
40964169
}
40974170
/** A yet unresolved interface. */
40984171
export class InterfacePrototype extends ClassPrototype {
@@ -4102,7 +4175,13 @@ declare module "assemblyscript/src/program" {
41024175
/** A resolved interface. */
41034176
export class Interface extends Class {
41044177
/** Constructs a new interface. */
4105-
constructor(nameInclTypeParameters: string, prototype: InterfacePrototype, typeArguments?: Type[]);
4178+
constructor(
4179+
/** Name incl. type parameters, i.e. `Foo<i32>`. */
4180+
nameInclTypeParameters: string,
4181+
/** The respective class prototype. */
4182+
prototype: InterfacePrototype,
4183+
/** Concrete type arguments, if any. */
4184+
typeArguments?: Type[] | null);
41064185
}
41074186
/** Mangles the internal name of an element with the specified name that is a child of the given parent. */
41084187
export function mangleInternalName(name: string, parent: Element, isInstance: boolean, asGlobal?: boolean): string;
@@ -4236,7 +4315,7 @@ declare module "assemblyscript/src/compiler" {
42364315
/** Map of already compiled static string segments. */
42374316
stringSegments: Map<string, MemorySegment>;
42384317
/** Function table being compiled. First elem is blank. */
4239-
functionTable: string[];
4318+
functionTable: Function[];
42404319
/** Arguments length helper global. */
42414320
builtinArgumentsLength: GlobalRef;
42424321
/** Requires runtime features. */
@@ -4255,10 +4334,8 @@ declare module "assemblyscript/src/compiler" {
42554334
static compile(program: Program): Module;
42564335
/** Constructs a new compiler for a {@link Program} using the specified options. */
42574336
constructor(program: Program);
4258-
initializeProgram(): void;
42594337
/** Performs compilation of the underlying {@link Program} to a {@link Module}. */
42604338
compile(): Module;
4261-
private setupVirtualLookupTables;
42624339
/** Applies the respective module exports for the specified file. */
42634340
private ensureModuleExports;
42644341
/** Applies the respective module export(s) for the specified element. */
@@ -4402,10 +4479,14 @@ declare module "assemblyscript/src/compiler" {
44024479
/** Compiles a direct call to a concrete function. */
44034480
compileCallDirect(instance: Function, argumentExpressions: Expression[], reportNode: Node, thisArg?: ExpressionRef, constraints?: Constraints): ExpressionRef;
44044481
makeCallInline(instance: Function, operands: ExpressionRef[] | null, thisArg?: ExpressionRef, immediatelyDropped?: boolean): ExpressionRef;
4405-
/** Gets the trampoline for the specified function. */
4406-
ensureTrampoline(original: Function): Function;
44074482
/** Makes sure that the arguments length helper global is present. */
4408-
ensureBuiltinArgumentsLength(): void;
4483+
ensureArgumentsLength(): void;
4484+
/** Ensures compilation of the varargs stub for the specified function. */
4485+
ensureVarargsStub(original: Function): Function;
4486+
/** Ensures compilation of the virtual stub for the specified function. */
4487+
ensureVirtualStub(original: Function): Function;
4488+
/** Finalizes the virtual stub of the specified function. */
4489+
private finalizeVirtualStub;
44094490
/** Makes a retain call, retaining the expression's value. */
44104491
makeRetain(expr: ExpressionRef): ExpressionRef;
44114492
/** Makes a release call, releasing the expression's value. Changes the current type to void.*/
@@ -5376,7 +5457,7 @@ declare module "assemblyscript/src/index" {
53765457
/** Obtains the path of the dependee of a given imported file. */
53775458
export function getDependee(program: Program, file: string): string | null;
53785459
/** Initializes the program pre-emptively for transform hooks. */
5379-
export function initializeProgram(program: Program, options: Options): void;
5460+
export function initializeProgram(program: Program): void;
53805461
/** Compiles the parsed sources to a module. */
53815462
export function compile(program: Program): Module;
53825463
/** Builds WebIDL definitions for the specified program. */

dist/assemblyscript.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/assemblyscript.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)