@@ -60,8 +60,8 @@ declare module "assemblyscript/src/common" {
60
60
INLINED = 8388608 ,
61
61
/** Is scoped. */
62
62
SCOPED = 16777216 ,
63
- /** Is a trampoline . */
64
- TRAMPOLINE = 33554432 ,
63
+ /** Is a stub . */
64
+ STUB = 33554432 ,
65
65
/** Is a virtual method. */
66
66
VIRTUAL = 67108864 ,
67
67
/** Is (part of) a closure. */
@@ -89,6 +89,8 @@ declare module "assemblyscript/src/common" {
89
89
export const LIBRARY_PREFIX : string ;
90
90
/** Path index suffix. */
91
91
export const INDEX_SUFFIX : string ;
92
+ /** Stub function delimiter. */
93
+ export const STUB_DELIMITER = "@" ;
92
94
/** Common names. */
93
95
export namespace CommonNames {
94
96
const EMPTY = "" ;
@@ -250,6 +252,9 @@ declare module "assemblyscript/src/diagnosticMessages.generated" {
250
252
Expression_cannot_be_represented_by_a_type = 225 ,
251
253
Expression_resolves_to_unusual_type_0 = 226 ,
252
254
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 ,
253
258
Type_0_is_cyclic_Module_will_include_deferred_garbage_collection = 900 ,
254
259
Importing_the_table_disables_some_indirect_call_optimizations = 901 ,
255
260
Exporting_the_table_disables_some_indirect_call_optimizations = 902 ,
@@ -317,6 +322,7 @@ declare module "assemblyscript/src/diagnosticMessages.generated" {
317
322
Duplicate_identifier_0 = 2300 ,
318
323
Cannot_find_name_0 = 2304 ,
319
324
Module_0_has_no_exported_member_1 = 2305 ,
325
+ An_interface_can_only_extend_an_interface = 2312 ,
320
326
Generic_type_0_requires_1_type_argument_s = 2314 ,
321
327
Type_0_is_not_generic = 2315 ,
322
328
Type_0_is_not_assignable_to_type_1 = 2322 ,
@@ -334,12 +340,16 @@ declare module "assemblyscript/src/diagnosticMessages.generated" {
334
340
Operator_0_cannot_be_applied_to_types_1_and_2 = 2365 ,
335
341
A_super_call_must_be_the_first_statement_in_the_constructor = 2376 ,
336
342
Constructors_for_derived_classes_must_contain_a_super_call = 2377 ,
343
+ Getter_and_setter_accessors_do_not_agree_in_visibility = 2379 ,
337
344
_get_and_set_accessor_must_have_the_same_type = 2380 ,
345
+ Overload_signatures_must_all_be_public_private_or_protected = 2385 ,
338
346
Constructor_implementation_is_missing = 2390 ,
339
347
Function_implementation_is_missing_or_not_immediately_following_the_declaration = 2391 ,
340
348
Multiple_constructor_implementations_are_not_allowed = 2392 ,
341
349
Duplicate_function_implementation = 2393 ,
350
+ This_overload_signature_is_not_compatible_with_its_implementation_signature = 2394 ,
342
351
Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local = 2395 ,
352
+ A_class_can_only_implement_an_interface = 2422 ,
343
353
A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged = 2434 ,
344
354
Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses = 2445 ,
345
355
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" {
349
359
Export_declaration_conflicts_with_exported_declaration_of_0 = 2484 ,
350
360
_0_is_referenced_directly_or_indirectly_in_its_own_base_expression = 2506 ,
351
361
Cannot_create_an_instance_of_an_abstract_class = 2511 ,
362
+ Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_2 = 2515 ,
352
363
Object_is_possibly_null = 2531 ,
353
364
Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property = 2540 ,
354
365
The_target_of_an_assignment_must_be_a_variable_or_a_property_access = 2541 ,
@@ -646,6 +657,8 @@ declare module "assemblyscript/src/diagnostics" {
646
657
private constructor ( ) ;
647
658
/** Creates a new diagnostic message of the specified category. */
648
659
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 ;
649
662
/** Adds a source range to this message. */
650
663
withRange ( range : Range ) : this;
651
664
/** Adds a related source range to this message. */
@@ -839,6 +852,7 @@ declare module "assemblyscript/src/tokenizer" {
839
852
debugInfoRef : number ;
840
853
constructor ( source : Source , start : number , end : number ) ;
841
854
static join ( a : Range , b : Range ) : Range ;
855
+ equals ( other : Range ) : boolean ;
842
856
get atStart ( ) : Range ;
843
857
get atEnd ( ) : Range ;
844
858
toString ( ) : string ;
@@ -1065,6 +1079,8 @@ declare module "assemblyscript/src/ast" {
1065
1079
get isNumericLiteral ( ) : boolean ;
1066
1080
/** Tests whether this node is guaranteed to compile to a constant value. */
1067
1081
get compilesToConst ( ) : boolean ;
1082
+ /** Checks if this is a call calling a method on super. */
1083
+ get isCallOnSuper ( ) : boolean ;
1068
1084
}
1069
1085
export abstract class TypeNode extends Node {
1070
1086
/** Whether nullable or not. */
@@ -2324,7 +2340,7 @@ declare module "assemblyscript/src/module" {
2324
2340
export function getFunctionName ( func : FunctionRef ) : string | null ;
2325
2341
export function getFunctionParams ( func : FunctionRef ) : NativeType ;
2326
2342
export function getFunctionResults ( func : FunctionRef ) : NativeType ;
2327
- export function getFunctionVars ( func : FunctionRef ) : NativeType ;
2343
+ export function getFunctionVars ( func : FunctionRef ) : NativeType [ ] ;
2328
2344
export function getGlobalName ( global : GlobalRef ) : string | null ;
2329
2345
export function getGlobalType ( global : GlobalRef ) : NativeType ;
2330
2346
export function isGlobalMutable ( global : GlobalRef ) : boolean ;
@@ -2344,6 +2360,23 @@ declare module "assemblyscript/src/module" {
2344
2360
addBranchForSwitch ( from : number , to : number , indexes : number [ ] , code ?: ExpressionRef ) : void ;
2345
2361
renderAndDispose ( entry : number , labelHelper : Index ) : ExpressionRef ;
2346
2362
}
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
+ }
2347
2380
export enum SideEffects {
2348
2381
None = 0 ,
2349
2382
Branches = 1 ,
@@ -2488,6 +2521,8 @@ declare module "assemblyscript/src/types" {
2488
2521
asFunction ( signature : Signature ) : Type ;
2489
2522
/** Composes the respective nullable type of this type. */
2490
2523
asNullable ( ) : Type ;
2524
+ /** Tests if this type equals the specified. */
2525
+ equals ( other : Type ) : boolean ;
2491
2526
/** Tests if a value of this type is assignable to the target type incl. implicit conversion. */
2492
2527
isAssignableTo ( target : Type , signednessIsRelevant ?: boolean ) : boolean ;
2493
2528
/** 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" {
2572
2607
asFunctionTarget ( program : Program ) : FunctionTarget ;
2573
2608
/** Gets the known or, alternatively, generic parameter name at the specified index. */
2574
2609
getParameterName ( index : number ) : string ;
2610
+ /** Tests if this signature equals the specified. */
2611
+ equals ( other : Signature ) : boolean ;
2575
2612
/** 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 ;
2579
2614
/** Converts this signature to a string. */
2580
2615
toString ( ) : string ;
2616
+ /** Creates a clone of this signature that is safe to modify. */
2617
+ clone ( ) : Signature ;
2581
2618
}
2582
2619
/** Gets the cached default parameter name for the specified index. */
2583
2620
export function getDefaultParameterName ( index : number ) : string ;
@@ -3373,7 +3410,9 @@ declare module "assemblyscript/src/program" {
3373
3410
/** Gets the (possibly merged) program element linked to the specified declaration. */
3374
3411
getElementByDeclaration ( declaration : DeclarationStatement ) : DeclaredElement | null ;
3375
3412
/** 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 ;
3377
3416
/** Requires that a global library element of the specified kind is present and returns it. */
3378
3417
private require ;
3379
3418
/** Requires that a non-generic global class is present and returns it. */
@@ -3435,6 +3474,8 @@ declare module "assemblyscript/src/program" {
3435
3474
private initializeFunction ;
3436
3475
/** Initializes an interface. */
3437
3476
private initializeInterface ;
3477
+ /** Initializes a field of an interface, as a property. */
3478
+ private initializeFieldAsProperty ;
3438
3479
/** Initializes a namespace. */
3439
3480
private initializeNamespace ;
3440
3481
/** Initializes a `type` definition. */
@@ -3567,6 +3608,12 @@ declare module "assemblyscript/src/program" {
3567
3608
abstract lookup ( name : string ) : Element | null ;
3568
3609
/** Adds an element as a member of this one. Reports and returns `false` if a duplicate. */
3569
3610
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 ;
3570
3617
/** Returns a string representation of this element. */
3571
3618
toString ( ) : string ;
3572
3619
}
@@ -3594,8 +3641,12 @@ declare module "assemblyscript/src/program" {
3594
3641
get isDeclaredInLibrary ( ) : boolean ;
3595
3642
/** Gets the associated identifier node. */
3596
3643
get identifierNode ( ) : IdentifierExpression ;
3644
+ /** Gets the signature node, if applicable, along the identifier node. */
3645
+ get identifierAndSignatureRange ( ) : Range ;
3597
3646
/** Gets the assiciated decorator nodes. */
3598
3647
get decoratorNodes ( ) : DecoratorNode [ ] | null ;
3648
+ /** Checks if this element is a compatible override of the specified. */
3649
+ isCompatibleOverride ( base : DeclaredElement ) : boolean ;
3599
3650
}
3600
3651
/** Checks if the specified element kind indicates a typed element. */
3601
3652
export function isTypedElement ( kind : ElementKind ) : boolean ;
@@ -3804,6 +3855,8 @@ declare module "assemblyscript/src/program" {
3804
3855
operatorKind : OperatorKind ;
3805
3856
/** Already resolved instances. */
3806
3857
instances : Map < string , Function > | null ;
3858
+ /** Methods overloading this one, if any. These are unbound. */
3859
+ overloads : Set < FunctionPrototype > | null ;
3807
3860
/** Clones of this prototype that are bounds to specific classes. */
3808
3861
private boundPrototypes ;
3809
3862
/** Constructs a new function prototype. */
@@ -3846,6 +3899,8 @@ declare module "assemblyscript/src/program" {
3846
3899
localsByIndex : Local [ ] ;
3847
3900
/** List of additional non-parameter locals. */
3848
3901
additionalLocals : Type [ ] ;
3902
+ /** Concrete type arguments. */
3903
+ typeArguments : Type [ ] | null ;
3849
3904
/** Contextual type arguments. */
3850
3905
contextualTypeArguments : Map < string , Type > | null ;
3851
3906
/** Default control flow. */
@@ -3856,8 +3911,10 @@ declare module "assemblyscript/src/program" {
3856
3911
ref : FunctionRef ;
3857
3912
/** Function table index, if any. */
3858
3913
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 ;
3861
3918
/** Counting id of inline operations involving this function. */
3862
3919
nextInlineId : number ;
3863
3920
/** Counting id of anonymous inner functions. */
@@ -3870,10 +3927,14 @@ declare module "assemblyscript/src/program" {
3870
3927
nameInclTypeParameters : string ,
3871
3928
/** Respective function prototype. */
3872
3929
prototype : FunctionPrototype ,
3930
+ /** Concrete type arguments. */
3931
+ typeArguments : Type [ ] | null ,
3873
3932
/** Concrete signature. */
3874
3933
signature : Signature , // pre-resolved
3875
3934
/** Contextual type arguments inherited from its parent class, if any. */
3876
3935
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 ;
3877
3938
/** Adds a local of the specified type, with an optional name. */
3878
3939
addLocal ( type : Type , name ?: string | null , declaration ?: VariableDeclaration | null ) : Local ;
3879
3940
lookup ( name : string ) : Element | null ;
@@ -3994,9 +4055,11 @@ declare module "assemblyscript/src/program" {
3994
4055
/** A yet unresolved class prototype. */
3995
4056
export class ClassPrototype extends DeclaredElement {
3996
4057
/** Instance member prototypes. */
3997
- instanceMembers : Map < string , Element > | null ;
4058
+ instanceMembers : Map < string , DeclaredElement > | null ;
3998
4059
/** Base class prototype, if applicable. */
3999
4060
basePrototype : ClassPrototype | null ;
4061
+ /** Interface prototypes, if applicable. */
4062
+ interfacePrototypes : InterfacePrototype [ ] | null ;
4000
4063
/** Constructor prototype. */
4001
4064
constructorPrototype : FunctionPrototype | null ;
4002
4065
/** Operator overload prototypes. */
@@ -4040,6 +4103,8 @@ declare module "assemblyscript/src/program" {
4040
4103
typeArguments : Type [ ] | null ;
4041
4104
/** Base class, if applicable. */
4042
4105
base : Class | null ;
4106
+ /** Implemented interfaces, if applicable. */
4107
+ interfaces : Set < Interface > | null ;
4043
4108
/** Contextual type arguments for fields and methods. */
4044
4109
contextualTypeArguments : Map < string , Type > | null ;
4045
4110
/** Current member memory offset. */
@@ -4058,6 +4123,10 @@ declare module "assemblyscript/src/program" {
4058
4123
rttiFlags : number ;
4059
4124
/** Wrapped type, if a wrapper for a basic type. */
4060
4125
wrappedType : Type | null ;
4126
+ /** Classes directly extending this class. */
4127
+ extendees : Set < Class > | null ;
4128
+ /** Classes implementing this interface. */
4129
+ implementers : Set < Class > | null ;
4061
4130
/** Gets the unique runtime id of this class. */
4062
4131
get id ( ) : number ;
4063
4132
/** Tests if this class is of a builtin array type (Array/TypedArray). */
@@ -4074,6 +4143,8 @@ declare module "assemblyscript/src/program" {
4074
4143
typeArguments ?: Type [ ] | null , _isInterface ?: boolean ) ;
4075
4144
/** Sets the base class. */
4076
4145
setBase ( base : Class ) : void ;
4146
+ /** Adds an interface. */
4147
+ addInterface ( iface : Interface ) : void ;
4077
4148
/** Tests if a value of this class type is assignable to a target of the specified class type. */
4078
4149
isAssignableTo ( target : Class ) : boolean ;
4079
4150
/** Looks up the operator overload of the specified kind. */
@@ -4093,6 +4164,8 @@ declare module "assemblyscript/src/program" {
4093
4164
get isAcyclic ( ) : boolean ;
4094
4165
/** Tests if this class potentially forms a reference cycle to another one. */
4095
4166
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 > ;
4096
4169
}
4097
4170
/** A yet unresolved interface. */
4098
4171
export class InterfacePrototype extends ClassPrototype {
@@ -4102,7 +4175,13 @@ declare module "assemblyscript/src/program" {
4102
4175
/** A resolved interface. */
4103
4176
export class Interface extends Class {
4104
4177
/** 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 ) ;
4106
4185
}
4107
4186
/** Mangles the internal name of an element with the specified name that is a child of the given parent. */
4108
4187
export function mangleInternalName ( name : string , parent : Element , isInstance : boolean , asGlobal ?: boolean ) : string ;
@@ -4236,7 +4315,7 @@ declare module "assemblyscript/src/compiler" {
4236
4315
/** Map of already compiled static string segments. */
4237
4316
stringSegments : Map < string , MemorySegment > ;
4238
4317
/** Function table being compiled. First elem is blank. */
4239
- functionTable : string [ ] ;
4318
+ functionTable : Function [ ] ;
4240
4319
/** Arguments length helper global. */
4241
4320
builtinArgumentsLength : GlobalRef ;
4242
4321
/** Requires runtime features. */
@@ -4255,10 +4334,8 @@ declare module "assemblyscript/src/compiler" {
4255
4334
static compile ( program : Program ) : Module ;
4256
4335
/** Constructs a new compiler for a {@link Program} using the specified options. */
4257
4336
constructor ( program : Program ) ;
4258
- initializeProgram ( ) : void ;
4259
4337
/** Performs compilation of the underlying {@link Program} to a {@link Module}. */
4260
4338
compile ( ) : Module ;
4261
- private setupVirtualLookupTables ;
4262
4339
/** Applies the respective module exports for the specified file. */
4263
4340
private ensureModuleExports ;
4264
4341
/** Applies the respective module export(s) for the specified element. */
@@ -4402,10 +4479,14 @@ declare module "assemblyscript/src/compiler" {
4402
4479
/** Compiles a direct call to a concrete function. */
4403
4480
compileCallDirect ( instance : Function , argumentExpressions : Expression [ ] , reportNode : Node , thisArg ?: ExpressionRef , constraints ?: Constraints ) : ExpressionRef ;
4404
4481
makeCallInline ( instance : Function , operands : ExpressionRef [ ] | null , thisArg ?: ExpressionRef , immediatelyDropped ?: boolean ) : ExpressionRef ;
4405
- /** Gets the trampoline for the specified function. */
4406
- ensureTrampoline ( original : Function ) : Function ;
4407
4482
/** 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 ;
4409
4490
/** Makes a retain call, retaining the expression's value. */
4410
4491
makeRetain ( expr : ExpressionRef ) : ExpressionRef ;
4411
4492
/** Makes a release call, releasing the expression's value. Changes the current type to void.*/
@@ -5376,7 +5457,7 @@ declare module "assemblyscript/src/index" {
5376
5457
/** Obtains the path of the dependee of a given imported file. */
5377
5458
export function getDependee ( program : Program , file : string ) : string | null ;
5378
5459
/** Initializes the program pre-emptively for transform hooks. */
5379
- export function initializeProgram ( program : Program , options : Options ) : void ;
5460
+ export function initializeProgram ( program : Program ) : void ;
5380
5461
/** Compiles the parsed sources to a module. */
5381
5462
export function compile ( program : Program ) : Module ;
5382
5463
/** Builds WebIDL definitions for the specified program. */
0 commit comments