@@ -218,7 +218,7 @@ declare module 'assemblyscript/src/diagnosticMessages.generated' {
218
218
Type_0_cannot_be_reinterpreted_as_type_1 = 203 ,
219
219
Basic_type_0_cannot_be_nullable = 204 ,
220
220
Cannot_export_a_mutable_global = 205 ,
221
- Compiling_constant_with_non_constant_initializer_as_mutable = 206 ,
221
+ Mutable_value_cannot_be_inlined = 206 ,
222
222
Unmanaged_classes_cannot_extend_managed_classes_and_vice_versa = 207 ,
223
223
Unmanaged_classes_cannot_implement_interfaces = 208 ,
224
224
Invalid_regular_expression_flags = 209 ,
@@ -2482,28 +2482,30 @@ declare module 'assemblyscript/src/flow' {
2482
2482
export enum LocalFlags {
2483
2483
/** No specific conditions. */
2484
2484
NONE = 0 ,
2485
+ /** Local is constant. */
2486
+ CONSTANT = 1 ,
2485
2487
/** Local is properly wrapped. Relevant for small integers. */
2486
- WRAPPED = 1 ,
2488
+ WRAPPED = 2 ,
2487
2489
/** Local is non-null. */
2488
- NONNULL = 2 ,
2490
+ NONNULL = 4 ,
2489
2491
/** Local is read from. */
2490
- READFROM = 4 ,
2492
+ READFROM = 8 ,
2491
2493
/** Local is written to. */
2492
- WRITTENTO = 8 ,
2494
+ WRITTENTO = 16 ,
2493
2495
/** Local is retained. */
2494
- RETAINED = 16 ,
2496
+ RETAINED = 32 ,
2495
2497
/** Local is conditionally read from. */
2496
- CONDITIONALLY_READFROM = 32 ,
2498
+ CONDITIONALLY_READFROM = 64 ,
2497
2499
/** Local is conditionally written to. */
2498
- CONDITIONALLY_WRITTENTO = 64 ,
2500
+ CONDITIONALLY_WRITTENTO = 128 ,
2499
2501
/** Local must be conditionally retained. */
2500
- CONDITIONALLY_RETAINED = 128 ,
2502
+ CONDITIONALLY_RETAINED = 256 ,
2501
2503
/** Any categorical flag. */
2502
- ANY_CATEGORICAL = 31 ,
2504
+ ANY_CATEGORICAL = 63 ,
2503
2505
/** Any conditional flag. */
2504
- ANY_CONDITIONAL = 240 ,
2506
+ ANY_CONDITIONAL = 480 ,
2505
2507
/** Any retained flag. */
2506
- ANY_RETAINED = 144
2508
+ ANY_RETAINED = 288
2507
2509
}
2508
2510
export namespace LocalFlags {
2509
2511
function join ( left : LocalFlags , right : LocalFlags ) : LocalFlags ;
@@ -2568,21 +2570,19 @@ declare module 'assemblyscript/src/flow' {
2568
2570
/** Forks this flow to a child flow. */
2569
2571
fork ( ) : Flow ;
2570
2572
/** Gets a free temporary local of the specified type. */
2571
- getTempLocal ( type : Type , except ?: ExpressionRef ) : Local ;
2573
+ getTempLocal ( type : Type , except ?: Set < i32 > | null ) : Local ;
2572
2574
/** Gets a local that sticks around until this flow is exited, and then released. */
2573
- getAutoreleaseLocal ( type : Type , except ?: ExpressionRef ) : Local ;
2575
+ getAutoreleaseLocal ( type : Type , except ?: Set < i32 > | null ) : Local ;
2574
2576
/** Frees the temporary local for reuse. */
2575
2577
freeTempLocal ( local : Local ) : void ;
2576
2578
/** Gets and immediately frees a temporary local of the specified type. */
2577
- getAndFreeTempLocal ( type : Type , except ?: ExpressionRef ) : Local ;
2579
+ getAndFreeTempLocal ( type : Type , except ?: Set < i32 > | null ) : Local ;
2580
+ /** Gets the scoped local of the specified name. */
2581
+ getScopedLocal ( name : string ) : Local | null ;
2578
2582
/** Adds a new scoped local of the specified name. */
2579
- addScopedLocal ( name : string , type : Type , reportNode ?: Node | null ) : Local ;
2583
+ addScopedLocal ( name : string , type : Type , except ?: Set < i32 > | null ) : Local ;
2580
2584
/** Adds a new scoped alias for the specified local. For example `super` aliased to the `this` local. */
2581
2585
addScopedAlias ( name : string , type : Type , index : i32 , reportNode ?: Node | null ) : Local ;
2582
- /** Blocks any locals that might be used in an inlining operation. */
2583
- blockLocalsBeforeInlining ( instance : Function ) : Local [ ] ;
2584
- /** Unblocks the specified locals. */
2585
- unblockLocals ( temps : Local [ ] ) : void ;
2586
2586
/** Frees this flow's scoped variables and returns its parent flow. */
2587
2587
freeScopedLocals ( ) : void ;
2588
2588
/** Looks up the local of the specified name in the current scope. */
@@ -2621,6 +2621,8 @@ declare module 'assemblyscript/src/flow' {
2621
2621
canOverflow ( expr : ExpressionRef , type : Type ) : bool ;
2622
2622
toString ( ) : string ;
2623
2623
}
2624
+ /** Finds all indexes of locals used in the specified expression. */
2625
+ export function findUsedLocals ( expr : ExpressionRef , used ?: Set < i32 > ) : Set < i32 > ;
2624
2626
2625
2627
}
2626
2628
declare module 'assemblyscript/src/resolver' {
@@ -3672,6 +3674,8 @@ declare module 'assemblyscript/src/program' {
3672
3674
private _id ;
3673
3675
/** Remembers acyclic state. */
3674
3676
private _acyclic ;
3677
+ /** Runtime type information flags. */
3678
+ rttiFlags : u32 ;
3675
3679
/** Gets the unique runtime id of this class. */
3676
3680
readonly id : u32 ;
3677
3681
/** Tests if this class is of a builtin array type (Array/TypedArray). */
@@ -3791,9 +3795,9 @@ declare module 'assemblyscript/src/compiler' {
3791
3795
/** Runtime features to be activated by the compiler. */
3792
3796
export const enum RuntimeFeatures {
3793
3797
NONE = 0 ,
3794
- /** Requires HEAP_BASE and heap setup. */
3798
+ /** Requires heap setup. */
3795
3799
HEAP = 1 ,
3796
- /** Requires RTTI_BASE and RTTI setup. */
3800
+ /** Requires runtime type information setup. */
3797
3801
RTTI = 2 ,
3798
3802
/** Requires the built-in globals visitor. */
3799
3803
visitGlobals = 4 ,
@@ -3976,10 +3980,10 @@ declare module 'assemblyscript/src/compiler' {
3976
3980
*/
3977
3981
checkCallSignature ( signature : Signature , numArguments : i32 , hasThis : bool , reportNode : Node ) : bool ;
3978
3982
/** Compiles a direct call to a concrete function. */
3979
- compileCallDirect ( instance : Function , argumentExpressions : Expression [ ] , reportNode : Node , thisArg ?: ExpressionRef , inlineCanAlias ?: bool , contextualFlags ?: ContextualFlags ) : ExpressionRef ;
3983
+ compileCallDirect ( instance : Function , argumentExpressions : Expression [ ] , reportNode : Node , thisArg ?: ExpressionRef , contextualFlags ?: ContextualFlags ) : ExpressionRef ;
3980
3984
compileCallInline ( instance : Function , argumentExpressions : Expression [ ] , thisArg : ExpressionRef , reportNode : Node , canAlias ?: bool ) : ExpressionRef ;
3981
3985
private compileCallInlinePrechecked ;
3982
- makeCallInlinePrechecked ( instance : Function , args : ExpressionRef [ ] , thisArg ?: ExpressionRef , canAlias ?: bool , immediatelyDropped ?: bool ) : ExpressionRef ;
3986
+ makeCallInlinePrechecked ( instance : Function , operands : ExpressionRef [ ] | null , thisArg ?: ExpressionRef , immediatelyDropped ?: bool ) : ExpressionRef ;
3983
3987
/** Gets the trampoline for the specified function. */
3984
3988
ensureTrampoline ( original : Function ) : Function ;
3985
3989
/** Makes sure that the argument count helper global is present and returns its name. */
@@ -4445,8 +4449,8 @@ declare module 'assemblyscript/src/builtins' {
4445
4449
const f64x2_convert_s_i64x2 = "~lib/builtins/f64x2.convert_s_i64x2" ;
4446
4450
const f64x2_convert_u_i64x2 = "~lib/builtins/f64x2.convert_u_i64x2" ;
4447
4451
const v8x16_shuffle = "~lib/builtins/v8x16.shuffle" ;
4448
- const HEAP_BASE = "~lib/heap/HEAP_BASE " ;
4449
- const RTTI_BASE = "~lib/rt/RTTI_BASE " ;
4452
+ const heap_base = "~lib/heap/__heap_base " ;
4453
+ const rtti_base = "~lib/rt/__rtti_base " ;
4450
4454
const visit_globals = "~lib/rt/__visit_globals" ;
4451
4455
const visit_members = "~lib/rt/__visit_members" ;
4452
4456
const ERROR = "~lib/diagnostics/ERROR" ;
@@ -4531,32 +4535,33 @@ declare module 'assemblyscript/src/definitions' {
4531
4535
* Definition builders for WebIDL and TypeScript.
4532
4536
* @module definitions
4533
4537
*/ /***/
4534
- import { Program , Element , Global , Enum , Field , Function , Class , Namespace , Interface } from 'assemblyscript/src/program' ;
4538
+ import { Program , Element , Global , Enum , Field , Function , Class , Namespace , Interface , File } from 'assemblyscript/src/program' ;
4535
4539
import { Type } from 'assemblyscript/src/types' ; abstract class ExportsWalker {
4536
4540
/** Program reference. */
4537
4541
program : Program ;
4538
4542
/** Whether to include private members */
4539
4543
includePrivate : bool ;
4540
- /** Elements still to do. */
4541
- todo : Element [ ] ;
4542
4544
/** Already seen elements. */
4543
- seen : Set < Element > ;
4545
+ seen : Map < Element , string > ;
4544
4546
/** Constructs a new Element walker. */
4545
4547
constructor ( program : Program , includePrivate ?: bool ) ;
4546
4548
/** Walks all elements and calls the respective handlers. */
4547
4549
walk ( ) : void ;
4550
+ /** Visits all exported elements of a file. */
4551
+ visitFile ( file : File ) : void ;
4548
4552
/** Visits an element.*/
4549
- visitElement ( element : Element ) : void ;
4553
+ visitElement ( name : string , element : Element ) : void ;
4550
4554
private visitFunctionInstances ;
4551
4555
private visitClassInstances ;
4552
4556
private visitPropertyInstances ;
4553
- abstract visitGlobal ( element : Global ) : void ;
4554
- abstract visitEnum ( element : Enum ) : void ;
4555
- abstract visitFunction ( element : Function ) : void ;
4556
- abstract visitClass ( element : Class ) : void ;
4557
- abstract visitInterface ( element : Interface ) : void ;
4558
- abstract visitField ( element : Field ) : void ;
4559
- abstract visitNamespace ( element : Element ) : void ;
4557
+ abstract visitGlobal ( name : string , element : Global ) : void ;
4558
+ abstract visitEnum ( name : string , element : Enum ) : void ;
4559
+ abstract visitFunction ( name : string , element : Function ) : void ;
4560
+ abstract visitClass ( name : string , element : Class ) : void ;
4561
+ abstract visitInterface ( name : string , element : Interface ) : void ;
4562
+ abstract visitField ( name : string , element : Field ) : void ;
4563
+ abstract visitNamespace ( name : string , element : Element ) : void ;
4564
+ abstract visitAlias ( name : string , element : Element , originalName : string ) : void ;
4560
4565
}
4561
4566
/** A WebIDL definitions builder. */
4562
4567
export class IDLBuilder extends ExportsWalker {
@@ -4566,13 +4571,14 @@ declare module 'assemblyscript/src/definitions' {
4566
4571
private indentLevel ;
4567
4572
/** Constructs a new WebIDL builder. */
4568
4573
constructor ( program : Program , includePrivate ?: bool ) ;
4569
- visitGlobal ( element : Global ) : void ;
4570
- visitEnum ( element : Enum ) : void ;
4571
- visitFunction ( element : Function ) : void ;
4572
- visitClass ( element : Class ) : void ;
4573
- visitInterface ( element : Interface ) : void ;
4574
- visitField ( element : Field ) : void ;
4575
- visitNamespace ( element : Namespace ) : void ;
4574
+ visitGlobal ( name : string , element : Global ) : void ;
4575
+ visitEnum ( name : string , element : Enum ) : void ;
4576
+ visitFunction ( name : string , element : Function ) : void ;
4577
+ visitClass ( name : string , element : Class ) : void ;
4578
+ visitInterface ( name : string , element : Interface ) : void ;
4579
+ visitField ( name : string , element : Field ) : void ;
4580
+ visitNamespace ( name : string , element : Namespace ) : void ;
4581
+ visitAlias ( name : string , element : Element , originalName : string ) : void ;
4576
4582
typeToString ( type : Type ) : string ;
4577
4583
build ( ) : string ;
4578
4584
}
@@ -4582,15 +4588,17 @@ declare module 'assemblyscript/src/definitions' {
4582
4588
static build ( program : Program ) : string ;
4583
4589
private sb ;
4584
4590
private indentLevel ;
4591
+ private unknown ;
4585
4592
/** Constructs a new WebIDL builder. */
4586
4593
constructor ( program : Program , includePrivate ?: bool ) ;
4587
- visitGlobal ( element : Global ) : void ;
4588
- visitEnum ( element : Enum ) : void ;
4589
- visitFunction ( element : Function ) : void ;
4590
- visitClass ( element : Class ) : void ;
4591
- visitInterface ( element : Interface ) : void ;
4592
- visitField ( element : Field ) : void ;
4593
- visitNamespace ( element : Element ) : void ;
4594
+ visitGlobal ( name : string , element : Global ) : void ;
4595
+ visitEnum ( name : string , element : Enum ) : void ;
4596
+ visitFunction ( name : string , element : Function ) : void ;
4597
+ visitClass ( name : string , element : Class ) : void ;
4598
+ visitInterface ( name : string , element : Interface ) : void ;
4599
+ visitField ( name : string , element : Field ) : void ;
4600
+ visitNamespace ( name : string , element : Element ) : void ;
4601
+ visitAlias ( name : string , element : Element , originalName : string ) : void ;
4594
4602
typeToString ( type : Type ) : string ;
4595
4603
build ( ) : string ;
4596
4604
}
@@ -4778,6 +4786,8 @@ declare module 'assemblyscript/src/index' {
4778
4786
export function buildIDL ( program : Program ) : string ;
4779
4787
/** Builds TypeScript definitions for the specified program. */
4780
4788
export function buildTSD ( program : Program ) : string ;
4789
+ /** Builds a JSON file of a program's runtime type information. */
4790
+ export function buildRTTI ( program : Program ) : string ;
4781
4791
/** Prefix indicating a library file. */
4782
4792
export { LIBRARY_PREFIX } from 'assemblyscript/src/common' ;
4783
4793
export * from 'assemblyscript/src/ast' ;
0 commit comments