@ibyar/expressions 0.5.6 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/abstract.js +5 -0
- package/api/abstract.js.map +1 -1
- package/api/class/class.d.ts +28 -13
- package/api/class/class.js +46 -41
- package/api/class/class.js.map +1 -1
- package/api/computing/return.d.ts +4 -0
- package/api/computing/return.js +5 -0
- package/api/computing/return.js.map +1 -1
- package/api/computing/throw.d.ts +4 -0
- package/api/computing/throw.js +4 -0
- package/api/computing/throw.js.map +1 -1
- package/api/definition/bind.d.ts +6 -0
- package/api/definition/bind.js +6 -0
- package/api/definition/bind.js.map +1 -1
- package/api/definition/function.js +6 -5
- package/api/definition/function.js.map +1 -1
- package/api/definition/member.js.map +1 -1
- package/api/definition/object.js +1 -1
- package/api/definition/object.js.map +1 -1
- package/api/definition/values.d.ts +12 -3
- package/api/definition/values.js +25 -4
- package/api/definition/values.js.map +1 -1
- package/api/deserialize/deserialize.d.ts +5 -0
- package/api/deserialize/deserialize.js +5 -0
- package/api/deserialize/deserialize.js.map +1 -1
- package/api/expression.d.ts +151 -5
- package/api/expression.js.map +1 -1
- package/api/module/export.d.ts +63 -0
- package/api/module/export.js +64 -1
- package/api/module/export.js.map +1 -1
- package/api/module/import.d.ts +53 -0
- package/api/module/import.js +53 -0
- package/api/module/import.js.map +1 -1
- package/api/operators/grouping.d.ts +7 -0
- package/api/operators/grouping.js +7 -0
- package/api/operators/grouping.js.map +1 -1
- package/api/operators/pipeline.d.ts +12 -0
- package/api/operators/pipeline.js +12 -0
- package/api/operators/pipeline.js.map +1 -1
- package/api/operators/unary.js +3 -0
- package/api/operators/unary.js.map +1 -1
- package/api/program.d.ts +2 -2
- package/api/program.js.map +1 -1
- package/api/statement/control/block.d.ts +4 -0
- package/api/statement/control/block.js +4 -0
- package/api/statement/control/block.js.map +1 -1
- package/api/statement/control/empty.d.ts +7 -0
- package/api/statement/control/empty.js +7 -0
- package/api/statement/control/empty.js.map +1 -1
- package/api/statement/control/if.d.ts +5 -0
- package/api/statement/control/if.js +5 -0
- package/api/statement/control/if.js.map +1 -1
- package/api/statement/control/switch.d.ts +6 -0
- package/api/statement/control/switch.js +9 -0
- package/api/statement/control/switch.js.map +1 -1
- package/api/statement/control/terminate.d.ts +8 -0
- package/api/statement/control/terminate.js +8 -0
- package/api/statement/control/terminate.js.map +1 -1
- package/api/statement/iterations/for.d.ts +5 -0
- package/api/statement/iterations/for.js +13 -0
- package/api/statement/iterations/for.js.map +1 -1
- package/api/statement/iterations/while.d.ts +6 -0
- package/api/statement/iterations/while.js +10 -0
- package/api/statement/iterations/while.js.map +1 -1
- package/package.json +5 -3
- package/scope/event.d.ts +3 -3
- package/scope/event.js +2 -2
- package/scope/event.js.map +1 -1
- package/scope/pool.d.ts +7 -0
- package/scope/pool.js +29 -0
- package/scope/pool.js.map +1 -0
- package/scope/proxy.d.ts +6 -9
- package/scope/proxy.js +22 -31
- package/scope/proxy.js.map +1 -1
- package/scope/scope.d.ts +161 -38
- package/scope/scope.js +260 -106
- package/scope/scope.js.map +1 -1
- package/scope/stack.d.ts +95 -19
- package/scope/stack.js +13 -0
- package/scope/stack.js.map +1 -1
- package/v8/enums.js +31 -0
- package/v8/enums.js.map +1 -1
- package/v8/inline.d.ts +36 -0
- package/v8/inline.js +407 -5
- package/v8/inline.js.map +1 -1
- package/v8/nodes.js +2 -1
- package/v8/nodes.js.map +1 -1
- package/v8/parser.d.ts +8 -0
- package/v8/parser.js +304 -1
- package/v8/parser.js.map +1 -1
- package/v8/stream.d.ts +4 -0
- package/v8/stream.js +79 -17
- package/v8/stream.js.map +1 -1
- package/v8/token.d.ts +229 -0
- package/v8/token.js +236 -1
- package/v8/token.js.map +1 -1
- package/visit/visitor.d.ts +3 -0
package/scope/stack.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DeclarationExpression } from '../api/expression.js';
|
|
2
|
-
import { ModuleScope, ReactiveScope, Scope,
|
|
2
|
+
import { ModuleScope, ReactiveScope, Scope, Context, WebModuleScope } from './scope.js';
|
|
3
3
|
export interface AwaitPromiseInfo {
|
|
4
4
|
promise: Promise<any>;
|
|
5
5
|
node: DeclarationExpression;
|
|
@@ -10,35 +10,106 @@ export interface AsyncIterableInfo {
|
|
|
10
10
|
forAwaitBody: (iterator: any) => any;
|
|
11
11
|
}
|
|
12
12
|
export interface Stack {
|
|
13
|
+
/**
|
|
14
|
+
* a list of promises to resolve in an 'async' scope as 'async function'
|
|
15
|
+
*/
|
|
13
16
|
awaitPromise: Array<AwaitPromiseInfo>;
|
|
17
|
+
/**
|
|
18
|
+
* resolve await promise in 'await for in' scope
|
|
19
|
+
*/
|
|
14
20
|
forAwaitAsyncIterable?: AsyncIterableInfo;
|
|
21
|
+
/**
|
|
22
|
+
* is this stack has a propertyKey
|
|
23
|
+
* @param propertyKey
|
|
24
|
+
*/
|
|
15
25
|
has(propertyKey: PropertyKey): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* get the first value for provided property key,
|
|
28
|
+
*
|
|
29
|
+
* will search current stack in all scope till find the first key, else undefined
|
|
30
|
+
* @param propertyKey
|
|
31
|
+
*/
|
|
16
32
|
get(propertyKey: PropertyKey): any;
|
|
33
|
+
/**
|
|
34
|
+
* set the value of `propertyKey` in its context provider with `value`.
|
|
35
|
+
* else define it in the first scope 'local scope'
|
|
36
|
+
* @param propertyKey
|
|
37
|
+
* @param value
|
|
38
|
+
* @param receiver
|
|
39
|
+
*/
|
|
17
40
|
set(propertyKey: PropertyKey, value: any, receiver?: any): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* declare variable at last scope in the stack,
|
|
43
|
+
*
|
|
44
|
+
* @param propertyKey the name of property mey be string | number | symbol,
|
|
45
|
+
* @param propertyValue if not exist will be initialize with 'undefined' value
|
|
46
|
+
*/
|
|
18
47
|
declareVariable(propertyKey: PropertyKey, propertyValue?: any): any;
|
|
19
|
-
|
|
48
|
+
/**
|
|
49
|
+
* get context object of this provider,
|
|
50
|
+
* search for the first context object that has `propertyKey`.
|
|
51
|
+
*
|
|
52
|
+
* search for the first context that have property key,
|
|
53
|
+
* if not found will return the stack local scop as a default value
|
|
54
|
+
* @param propertyKey the property key
|
|
55
|
+
*/
|
|
56
|
+
findScope<T extends Context>(propertyKey: PropertyKey): Scope<T>;
|
|
20
57
|
resolveAwait(value: AwaitPromiseInfo): void;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
58
|
+
/**
|
|
59
|
+
* get a reference to the last scope in this stack
|
|
60
|
+
*/
|
|
61
|
+
lastScope<T extends Context>(): Scope<T>;
|
|
62
|
+
/**
|
|
63
|
+
* clear every thing after this scope, and even this scope
|
|
64
|
+
* @param scope
|
|
65
|
+
*/
|
|
66
|
+
clearTo<T extends Context>(scope: Scope<T>): boolean;
|
|
67
|
+
/**
|
|
68
|
+
* clear every thing after this scope, but not this scope
|
|
69
|
+
* @param scope
|
|
70
|
+
*/
|
|
71
|
+
clearTill<T extends Context>(scope: Scope<T>): boolean;
|
|
72
|
+
popScope<T extends Context>(): Scope<T>;
|
|
73
|
+
removeScope<T extends Context>(scope: Scope<T>): void;
|
|
74
|
+
pushScope<T extends Context>(scope: Scope<T>): void;
|
|
75
|
+
pushBlockScope<T extends Context>(): Scope<T>;
|
|
76
|
+
pushBlockScopeFor<T extends Context>(context: T): Scope<T>;
|
|
77
|
+
pushReactiveScope<T extends Context>(): ReactiveScope<T>;
|
|
78
|
+
pushReactiveScopeFor<T extends Context>(context: T): ReactiveScope<T>;
|
|
79
|
+
/**
|
|
80
|
+
* create new stack instance with the same reference to the current scope array
|
|
81
|
+
*/
|
|
31
82
|
copyStack(): Stack;
|
|
83
|
+
/**
|
|
84
|
+
* used when want to update ui-view like, you want to replace an array with another
|
|
85
|
+
* without reflect changes on view until reattached again.
|
|
86
|
+
*/
|
|
32
87
|
detach(): void;
|
|
88
|
+
/**
|
|
89
|
+
* apply all the not emitted changes, and continue emit in time.
|
|
90
|
+
*/
|
|
33
91
|
reattach(): void;
|
|
92
|
+
/**
|
|
93
|
+
* import module scope from another stack, by the help of ModuleScopeResolver.
|
|
94
|
+
*
|
|
95
|
+
* used with import statement
|
|
96
|
+
*/
|
|
34
97
|
importModule(source: string, importCallOptions?: ImportCallOptions): ModuleScope;
|
|
98
|
+
/**
|
|
99
|
+
* get the current module for this stack.
|
|
100
|
+
*
|
|
101
|
+
* used with export statement
|
|
102
|
+
*/
|
|
35
103
|
getModule(): ModuleScope | undefined;
|
|
104
|
+
/**
|
|
105
|
+
* register action to do on destroy this stack
|
|
106
|
+
*/
|
|
36
107
|
onDestroy(action: () => void): void;
|
|
37
108
|
}
|
|
38
109
|
export declare class Stack implements Stack {
|
|
39
|
-
static for(...contexts: Scope<
|
|
40
|
-
static forScopes(...scopes: Scope<
|
|
41
|
-
static moduleScope(resolver: ModuleScopeResolver, moduleSource: string, ...globalScopes: Scope<
|
|
110
|
+
static for(...contexts: Scope<Context>[]): Stack;
|
|
111
|
+
static forScopes(...scopes: Scope<Context>[]): Stack;
|
|
112
|
+
static moduleScope(resolver: ModuleScopeResolver, moduleSource: string, ...globalScopes: Scope<Context>[]): Stack;
|
|
42
113
|
awaitPromise: AwaitPromiseInfo[];
|
|
43
114
|
forAwaitAsyncIterable?: AsyncIterableInfo | undefined;
|
|
44
115
|
protected readonly stack: Array<Scope<any>>;
|
|
@@ -47,12 +118,14 @@ export declare class Stack implements Stack {
|
|
|
47
118
|
protected readonly resolver?: ModuleScopeResolver;
|
|
48
119
|
protected readonly onDestroyActions: (() => void)[];
|
|
49
120
|
constructor();
|
|
50
|
-
constructor(globalScope: Scope<
|
|
51
|
-
constructor(globalScope: Scope<
|
|
52
|
-
constructor(stack: Array<Scope<
|
|
53
|
-
constructor(stack: Array<Scope<
|
|
121
|
+
constructor(globalScope: Scope<Context>);
|
|
122
|
+
constructor(globalScope: Scope<Context>, resolver: ModuleScopeResolver, moduleSource: string);
|
|
123
|
+
constructor(stack: Array<Scope<Context>>);
|
|
124
|
+
constructor(stack: Array<Scope<Context>>, resolver: ModuleScopeResolver, moduleSource: string);
|
|
54
125
|
private initModuleContext;
|
|
126
|
+
detectChanges(): void;
|
|
55
127
|
private getReactiveScopeControls;
|
|
128
|
+
private getReactiveScope;
|
|
56
129
|
}
|
|
57
130
|
export interface ModuleScopeResolver {
|
|
58
131
|
resolve(source: string, moduleScope: ModuleScope, importCallOptions?: ImportCallOptions): ModuleScope;
|
|
@@ -60,6 +133,9 @@ export interface ModuleScopeResolver {
|
|
|
60
133
|
}
|
|
61
134
|
export declare function createRootURL(source: string): URL;
|
|
62
135
|
export interface ResolverConfig {
|
|
136
|
+
/**
|
|
137
|
+
*
|
|
138
|
+
*/
|
|
63
139
|
allowImportExternal?: boolean;
|
|
64
140
|
}
|
|
65
141
|
export declare class ModuleScopeResolver implements ModuleScopeResolver {
|
package/scope/stack.js
CHANGED
|
@@ -2,6 +2,7 @@ import { finalizerRegister } from './finalizer.js';
|
|
|
2
2
|
import { ModuleScope, ReactiveScope, ReactiveScopeControl, Scope, WebModuleScope } from './scope.js';
|
|
3
3
|
export class Stack {
|
|
4
4
|
constructor(globals, resolver, moduleSource) {
|
|
5
|
+
this.awaitPromise = [];
|
|
5
6
|
this.onDestroyActions = [];
|
|
6
7
|
if (Array.isArray(globals)) {
|
|
7
8
|
this.stack = globals;
|
|
@@ -15,11 +16,14 @@ export class Stack {
|
|
|
15
16
|
if (resolver && moduleSource) {
|
|
16
17
|
this.resolver = resolver;
|
|
17
18
|
this.moduleSource = moduleSource;
|
|
19
|
+
// init module scope for import and export
|
|
18
20
|
this.moduleScope = new ModuleScope(this.initModuleContext());
|
|
19
21
|
this.pushScope(this.moduleScope);
|
|
22
|
+
// for the rest of module body
|
|
20
23
|
this.pushReactiveScope();
|
|
21
24
|
}
|
|
22
25
|
else {
|
|
26
|
+
// not a module scope
|
|
23
27
|
this.pushBlockScope();
|
|
24
28
|
}
|
|
25
29
|
finalizerRegister(this, this.onDestroyActions, this);
|
|
@@ -135,11 +139,18 @@ export class Stack {
|
|
|
135
139
|
reattach() {
|
|
136
140
|
this.getReactiveScopeControls().forEach(scope => scope.reattach());
|
|
137
141
|
}
|
|
142
|
+
detectChanges() {
|
|
143
|
+
this.getReactiveScope().forEach(scope => scope.detectChanges());
|
|
144
|
+
}
|
|
138
145
|
getReactiveScopeControls() {
|
|
139
146
|
return this.stack.filter(scope => scope instanceof ReactiveScopeControl);
|
|
140
147
|
}
|
|
148
|
+
getReactiveScope() {
|
|
149
|
+
return this.stack.filter(scope => scope instanceof ReactiveScope);
|
|
150
|
+
}
|
|
141
151
|
importModule(source, importCallOptions) {
|
|
142
152
|
if (!this.resolver || !this.moduleScope) {
|
|
153
|
+
// should o the parse and import the module
|
|
143
154
|
throw new Error('Module Resolver is undefined');
|
|
144
155
|
}
|
|
145
156
|
return this.resolver.resolve(source, this.moduleScope, importCallOptions);
|
|
@@ -223,6 +234,8 @@ export class ModuleScopeResolver {
|
|
|
223
234
|
}
|
|
224
235
|
const webScope = new WebModuleScope();
|
|
225
236
|
this.modules.push([source, webScope]);
|
|
237
|
+
// active later
|
|
238
|
+
// import(source, importCallOptions)
|
|
226
239
|
import(source).then(module => {
|
|
227
240
|
webScope.updateContext(module);
|
|
228
241
|
});
|
package/scope/stack.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stack.js","sourceRoot":"","sources":["../../../src/expressions/scope/stack.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EACuB,WAAW,EAAE,aAAa,EACvD,oBAAoB,EAAE,KAAK,EAAgB,cAAc,EACzD,MAAM,YAAY,CAAC;AAyIpB,MAAM,OAAO,KAAK;IAiCjB,YAAY,OAA0D,EAAE,QAA8B,EAAE,YAAqB;QAT1G,qBAAgB,GAAmB,EA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CAAC;SACjE;QACD,MAAM,QAAQ,GAAG,IAAI,cAAc,EAAE,CAAA;QACrC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;QAGtC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;YAC5B,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;QAChC,CAAC,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC;IACjB,CAAC;CAUD","sourcesContent":["import type { DeclarationExpression } from '../api/expression.js';\nimport { finalizerRegister } from './finalizer.js';\nimport {\n\tModuleContext, ModuleImport, ModuleScope, ReactiveScope,\n\tReactiveScopeControl, Scope, ScopeContext, WebModuleScope\n} from './scope.js';\n\n\nexport interface AwaitPromiseInfo {\n\tpromise: Promise<any>;\n\tnode: DeclarationExpression;\n\n\tdeclareVariable: boolean;\n}\n\nexport interface AsyncIterableInfo {\n\titerable: AsyncIterable<any>;\n\tforAwaitBody: (iterator: any) => any;\n}\n\nexport interface Stack {\n\t/**\n\t * a list of promises to resolve in an 'async' scope as 'async function'\n\t */\n\tawaitPromise: Array<AwaitPromiseInfo>;\n\n\t/**\n\t * resolve await promise in 'await for in' scope\n\t */\n\tforAwaitAsyncIterable?: AsyncIterableInfo;\n\n\t/**\n\t * is this stack has a propertyKey\n\t * @param propertyKey \n\t */\n\thas(propertyKey: PropertyKey): boolean;\n\n\t/**\n\t * get the first value for provided property key,\n\t * \n\t * will search current stack in all scope till find the first key, else undefined\n\t * @param propertyKey \n\t */\n\tget(propertyKey: PropertyKey): any;\n\n\t/**\n\t * set the value of `propertyKey` in its context provider with `value`.\n\t * else define it in the first scope 'local scope'\n\t * @param propertyKey \n\t * @param value \n\t * @param receiver \n\t */\n\tset(propertyKey: PropertyKey, value: any, receiver?: any): boolean;\n\n\t/**\n\t * declare variable at last scope in the stack,\n\t * \n\t * @param propertyKey the name of property mey be string | number | symbol, \n\t * @param propertyValue if not exist will be initialize with 'undefined' value\n\t */\n\tdeclareVariable(propertyKey: PropertyKey, propertyValue?: any): any;\n\n\n\t/**\n\t * get context object of this provider,\n\t * search for the first context object that has `propertyKey`.\n\t * \n\t * search for the first context that have property key,\n\t * if not found will return the stack local scop as a default value\n\t * @param propertyKey the property key\n\t */\n\tfindScope<T extends ScopeContext>(propertyKey: PropertyKey): Scope<T>;\n\n\tresolveAwait(value: AwaitPromiseInfo): void;\n\n\t/**\n\t * get a reference to the last scope in this stack\n\t */\n\tlastScope<T extends ScopeContext>(): Scope<T>;\n\n\t/**\n\t * clear every thing after this scope, and even this scope\n\t * @param scope \n\t */\n\tclearTo<T extends ScopeContext>(scope: Scope<T>): boolean;\n\n\t/**\n\t * clear every thing after this scope, but not this scope\n\t * @param scope \n\t */\n\tclearTill<T extends ScopeContext>(scope: Scope<T>): boolean;\n\n\tpopScope<T extends ScopeContext>(): Scope<T>;\n\n\tremoveScope<T extends ScopeContext>(scope: Scope<T>): void;\n\n\tpushScope<T extends ScopeContext>(scope: Scope<T>): void;\n\n\tpushBlockScope<T extends ScopeContext>(): Scope<T>;\n\n\tpushBlockScopeFor<T extends ScopeContext>(context: T): Scope<T>;\n\n\tpushReactiveScope<T extends ScopeContext>(): ReactiveScope<T>;\n\n\tpushReactiveScopeFor<T extends ScopeContext>(context: T): ReactiveScope<T>;\n\n\t/**\n\t * create new stack instance with the same reference to the current scope array\n\t */\n\tcopyStack(): Stack;\n\n\t/**\n\t * used when want to update ui-view like, you want to replace an array with another \n\t * without reflect changes on view until reattached again.\n\t */\n\tdetach(): void;\n\n\t/**\n\t * apply all the not emitted changes, and continue emit in time.\n\t */\n\treattach(): void;\n\n\t/**\n\t * import module scope from another stack, by the help of ModuleScopeResolver.\n\t * \n\t * used with import statement\n\t */\n\timportModule(source: string, importCallOptions?: ImportCallOptions): ModuleScope;\n\n\t/**\n\t * get the current module for this stack.\n\t * \n\t * used with export statement\n\t */\n\tgetModule(): ModuleScope | undefined;\n\n\t/**\n\t * register action to do on destroy this stack\n\t */\n\tonDestroy(action: () => void): void;\n}\n\nexport class Stack implements Stack {\n\tstatic for(...contexts: Scope<ScopeContext>[]): Stack {\n\t\tif (contexts.length === 0) {\n\t\t\treturn new Stack();\n\t\t}\n\t\treturn new Stack(contexts.map(context => new Scope<ScopeContext>(context)));\n\t}\n\tstatic forScopes(...scopes: Scope<ScopeContext>[]): Stack {\n\t\tif (scopes.length === 0) {\n\t\t\tscopes.push(Scope.blockScope());\n\t\t}\n\t\treturn new Stack(scopes);\n\t}\n\tstatic moduleScope(resolver: ModuleScopeResolver, moduleSource: string, ...globalScopes: Scope<ScopeContext>[]) {\n\t\treturn new Stack(globalScopes, resolver, moduleSource);\n\t}\n\tawaitPromise: AwaitPromiseInfo[];\n\tforAwaitAsyncIterable?: AsyncIterableInfo | undefined;\n\n\tprotected readonly stack: Array<Scope<any>>;\n\tprotected readonly moduleScope?: ModuleScope;\n\tprotected readonly moduleSource?: string;\n\tprotected readonly resolver?: ModuleScopeResolver;\n\n\tprotected readonly onDestroyActions: (() => void)[] = [];\n\n\tconstructor();\n\tconstructor(globalScope: Scope<ScopeContext>);\n\tconstructor(globalScope: Scope<ScopeContext>, resolver: ModuleScopeResolver, moduleSource: string);\n\n\tconstructor(stack: Array<Scope<ScopeContext>>);\n\tconstructor(stack: Array<Scope<ScopeContext>>, resolver: ModuleScopeResolver, moduleSource: string);\n\n\tconstructor(globals?: Array<Scope<ScopeContext>> | Scope<ScopeContext>, resolver?: ModuleScopeResolver, moduleSource?: string) {\n\t\tif (Array.isArray(globals)) {\n\t\t\tthis.stack = globals;\n\t\t} else if (typeof globals == 'object') {\n\t\t\tthis.stack = [globals];\n\t\t} else {\n\t\t\tthis.stack = [];\n\t\t}\n\t\tif (resolver && moduleSource) {\n\t\t\tthis.resolver = resolver;\n\t\t\tthis.moduleSource = moduleSource;\n\t\t\t// init module scope for import and export\n\t\t\tthis.moduleScope = new ModuleScope(this.initModuleContext());\n\t\t\tthis.pushScope(this.moduleScope);\n\t\t\t// for the rest of module body\n\t\t\tthis.pushReactiveScope();\n\t\t} else {\n\t\t\t// not a module scope\n\t\t\tthis.pushBlockScope();\n\t\t}\n\t\tfinalizerRegister(this, this.onDestroyActions, this);\n\t}\n\tprivate initModuleContext(): ModuleContext {\n\t\tconst importFunc = (path: string) => {\n\t\t\treturn this.importModule(path);\n\t\t};\n\t\timportFunc.meta = {\n\t\t\turl: createRootURL(this.moduleSource!),\n\t\t\tresolve: (specified: string, parent?: string | URL): Promise<string> => {\n\t\t\t\treturn Promise.resolve(this.resolver!.resolveURL(specified, parent ?? importFunc.meta.url));\n\t\t\t}\n\t\t};\n\t\tconst im: ModuleImport & ((path: string) => Promise<any>) = importFunc as any;\n\t\treturn { import: im };\n\t}\n\thas(propertyKey: PropertyKey): boolean {\n\t\treturn this.stack.find(context => context.has(propertyKey)) ? true : false;\n\t}\n\tget(propertyKey: PropertyKey) {\n\t\treturn this.findScope<ScopeContext>(propertyKey).get(propertyKey);\n\t}\n\tset(propertyKey: PropertyKey, value: any, receiver?: any): boolean {\n\t\treturn this.findScope<ScopeContext>(propertyKey).set(propertyKey, value, receiver);\n\t}\n\tdeclareVariable(propertyKey: PropertyKey, propertyValue?: any) {\n\t\treturn this.lastScope<ScopeContext>().set(propertyKey, propertyValue);\n\t}\n\tfindScope<T extends ScopeContext>(propertyKey: PropertyKey): Scope<T> {\n\t\tlet lastIndex = this.stack.length;\n\t\twhile (lastIndex--) {\n\t\t\tconst scope = this.stack[lastIndex];\n\t\t\tif (scope.has(propertyKey)) {\n\t\t\t\treturn scope;\n\t\t\t}\n\t\t}\n\t\treturn this.lastScope();\n\t}\n\tresolveAwait(value: AwaitPromiseInfo): void {\n\t\tthis.awaitPromise.push(value);\n\t}\n\tpopScope<T extends ScopeContext>(): Scope<T> {\n\t\treturn this.stack.pop()!;\n\t}\n\tremoveScope<T extends ScopeContext>(scope: Scope<T>): void {\n\t\tconst index = this.stack.lastIndexOf(scope);\n\t\tthis.stack.splice(index, 1);\n\t}\n\tpushScope<T extends ScopeContext>(scope: Scope<T>): void {\n\t\tthis.stack.push(scope);\n\t}\n\tpushBlockScope<T extends ScopeContext>(): Scope<T> {\n\t\tconst scope = Scope.blockScope<T>();\n\t\tthis.stack.push(scope);\n\t\treturn scope;\n\t}\n\tpushBlockScopeFor<T extends ScopeContext>(context: T): Scope<T> {\n\t\tconst scope = Scope.for<T>(context);\n\t\tthis.stack.push(scope);\n\t\treturn scope;\n\t}\n\tpushReactiveScope<T extends ScopeContext>(): ReactiveScope<T> {\n\t\tconst scope = ReactiveScope.blockScope<T>();\n\t\tthis.stack.push(scope);\n\t\treturn scope;\n\t}\n\tpushReactiveScopeFor<T extends ScopeContext>(context: T): ReactiveScope<T> {\n\t\tconst scope = ReactiveScope.for(context);\n\t\tthis.stack.push(scope);\n\t\treturn scope;\n\t}\n\tlastScope<T extends ScopeContext>(): Scope<T> {\n\t\treturn this.stack[this.stack.length - 1];\n\t}\n\tclearTo<T extends ScopeContext>(scope: Scope<T>): boolean {\n\t\tconst index = this.stack.lastIndexOf(scope);\n\t\tif (index === -1) {\n\t\t\treturn false;\n\t\t}\n\t\tthis.stack.splice(index);\n\t\treturn true;\n\t}\n\tclearTill<T extends ScopeContext>(scope: Scope<T>): boolean {\n\t\tconst index = this.stack.lastIndexOf(scope);\n\t\tif (index === -1) {\n\t\t\treturn false;\n\t\t}\n\t\tthis.stack.splice(index + 1);\n\t\treturn true;\n\t}\n\tcopyStack(): Stack {\n\t\treturn new Stack(this.stack.slice(), this.resolver!, this.moduleSource!);\n\t}\n\tdetach(): void {\n\t\tthis.getReactiveScopeControls().forEach(scope => scope.detach());\n\t}\n\treattach(): void {\n\t\tthis.getReactiveScopeControls().forEach(scope => scope.reattach());\n\t}\n\tprivate getReactiveScopeControls(): ReactiveScopeControl<any>[] {\n\t\treturn this.stack.filter(scope => scope instanceof ReactiveScopeControl) as ReactiveScopeControl<any>[];\n\t}\n\timportModule(source: string, importCallOptions?: ImportCallOptions): ModuleScope {\n\t\tif (!this.resolver || !this.moduleScope) {\n\t\t\t// should o the parse and import the module\n\t\t\tthrow new Error('Module Resolver is undefined');\n\t\t}\n\t\treturn this.resolver.resolve(source, this.moduleScope, importCallOptions);\n\t}\n\tgetModule(): ModuleScope | undefined {\n\t\treturn this.moduleScope;\n\t}\n\n\tonDestroy(action: () => void): void {\n\t\tthis.onDestroyActions.push(action);\n\t}\n}\n\n\nexport interface ModuleScopeResolver {\n\tresolve(source: string, moduleScope: ModuleScope, importCallOptions?: ImportCallOptions): ModuleScope;\n\tresolveURL(specified: string, parent: string | URL): string;\n}\n\nconst ROOT_URL = 'https://root';\nexport function createRootURL(source: string): URL {\n\treturn new URL(source, ROOT_URL);\n}\n\n\nexport interface ResolverConfig {\n\t/**\n\t * \n\t */\n\tallowImportExternal?: boolean;\n\n};\nexport class ModuleScopeResolver implements ModuleScopeResolver {\n\tprotected modules: [string, ModuleScope][] = [];\n\tconstructor(protected config?: ResolverConfig) { }\n\tregister(source: string, moduleScope: ModuleScope) {\n\t\tconst stackInfo = this.modules.find(tuple => tuple[0] == source && tuple[1] == moduleScope);\n\t\tif (stackInfo) {\n\t\t\tstackInfo[1] = moduleScope;\n\t\t} else {\n\t\t\tthis.modules.push([source, moduleScope]);\n\t\t}\n\t}\n\tresolve(source: string, moduleScope: ModuleScope, importCallOptions?: ImportCallOptions): ModuleScope {\n\t\tif (this.isValidHTTPUrl(source)) {\n\t\t\treturn this.resolveExternalModule(source, importCallOptions);\n\t\t}\n\t\tif (source.startsWith('/')) {\n\t\t\treturn this.findScopeBySource(source, importCallOptions);\n\t\t}\n\t\tconst currentSource = this.findSourceByScope(moduleScope);\n\t\tconst absoluteUrl = this.resolveURL(source, currentSource);\n\t\treturn this.findScopeBySource(absoluteUrl, importCallOptions);\n\t}\n\tresolveURL(specified: string, parent: string | URL): string {\n\t\tconst currentUrl = parent instanceof URL ? parent.href : createRootURL(parent).href;\n\t\tconst importedUrl = new URL(specified, currentUrl).href;\n\t\tconst absoluteUrl = importedUrl.replace(ROOT_URL, '');\n\t\treturn absoluteUrl;\n\t}\n\tprotected findScopeBySource(source: string, importCallOptions?: ImportCallOptions): ModuleScope {\n\t\tif (importCallOptions?.assert?.type) {\n\t\t\tconst type = importCallOptions.assert.type;\n\t\t\tif (!source.endsWith(`.${type}`)) {\n\t\t\t\tthrow new Error(`Can't find module scope`);\n\t\t\t}\n\t\t}\n\t\tconst importedScope = this.modules.find(tuple => tuple[0] == source)?.[1];\n\t\tif (!importedScope) {\n\t\t\tthrow new Error(`Can't find module scope`);\n\t\t}\n\t\treturn importedScope;\n\t}\n\tprotected findSourceByScope(moduleScope: ModuleScope): string {\n\t\tconst importedSource = this.modules.find(tuple => tuple[1] == moduleScope)?.[0];\n\t\tif (!importedSource) {\n\t\t\tthrow new Error(`Can't resolve scope source`);\n\t\t}\n\t\treturn importedSource;\n\t}\n\tprotected resolveExternalModule(source: string, importCallOptions?: ImportCallOptions): WebModuleScope {\n\t\tif (!this.config?.allowImportExternal) {\n\t\t\tthrow new Error(`Error: Import External Module is not allowed.`);\n\t\t}\n\t\tconst webScope = new WebModuleScope()\n\t\tthis.modules.push([source, webScope]);\n\t\t// active later\n\t\t// import(source, importCallOptions)\n\t\timport(source).then(module => {\n\t\t\twebScope.updateContext(module);\n\t\t});\n\t\treturn webScope;\n\t}\n\tprotected readonly isValidHTTPUrl = (string: string) => {\n\t\tlet url: URL;\n\t\ttry {\n\t\t\turl = new URL(string);\n\t\t} catch (e) {\n\t\t\treturn false;\n\t\t}\n\t\treturn url.protocol === 'http:' || url.protocol === 'https:';\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"stack.js","sourceRoot":"","sources":["../../../src/expressions/scope/stack.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EACuB,WAAW,EAAE,aAAa,EACvD,oBAAoB,EAAE,KAAK,EAAW,cAAc,EACpD,MAAM,YAAY,C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AAC;IACtB,CAAC;IACS,iBAAiB,CAAC,WAAwB;QACnD,MAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,WAAW,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAChF,IAAI,CAAC,cAAc,EAAE;YACpB,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;SAC9C;QACD,OAAO,cAAc,CAAC;IACvB,CAAC;IACS,qBAAqB,CAAC,MAAc,EAAE,iBAAqC;QACpF,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,mBAAmB,EAAE;YACtC,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;SACjE;QACD,MAAM,QAAQ,GAAG,IAAI,cAAc,EAAE,CAAA;QACrC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;QACtC,eAAe;QACf,oCAAoC;QACpC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;YAC5B,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;QAChC,CAAC,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC;IACjB,CAAC;CAUD","sourcesContent":["import type { DeclarationExpression } from '../api/expression.js';\nimport { finalizerRegister } from './finalizer.js';\nimport {\n\tModuleContext, ModuleImport, ModuleScope, ReactiveScope,\n\tReactiveScopeControl, Scope, Context, WebModuleScope\n} from './scope.js';\n\n\nexport interface AwaitPromiseInfo {\n\tpromise: Promise<any>;\n\tnode: DeclarationExpression;\n\n\tdeclareVariable: boolean;\n}\n\nexport interface AsyncIterableInfo {\n\titerable: AsyncIterable<any>;\n\tforAwaitBody: (iterator: any) => any;\n}\n\nexport interface Stack {\n\t/**\n\t * a list of promises to resolve in an 'async' scope as 'async function'\n\t */\n\tawaitPromise: Array<AwaitPromiseInfo>;\n\n\t/**\n\t * resolve await promise in 'await for in' scope\n\t */\n\tforAwaitAsyncIterable?: AsyncIterableInfo;\n\n\t/**\n\t * is this stack has a propertyKey\n\t * @param propertyKey \n\t */\n\thas(propertyKey: PropertyKey): boolean;\n\n\t/**\n\t * get the first value for provided property key,\n\t * \n\t * will search current stack in all scope till find the first key, else undefined\n\t * @param propertyKey \n\t */\n\tget(propertyKey: PropertyKey): any;\n\n\t/**\n\t * set the value of `propertyKey` in its context provider with `value`.\n\t * else define it in the first scope 'local scope'\n\t * @param propertyKey \n\t * @param value \n\t * @param receiver \n\t */\n\tset(propertyKey: PropertyKey, value: any, receiver?: any): boolean;\n\n\t/**\n\t * declare variable at last scope in the stack,\n\t * \n\t * @param propertyKey the name of property mey be string | number | symbol, \n\t * @param propertyValue if not exist will be initialize with 'undefined' value\n\t */\n\tdeclareVariable(propertyKey: PropertyKey, propertyValue?: any): any;\n\n\n\t/**\n\t * get context object of this provider,\n\t * search for the first context object that has `propertyKey`.\n\t * \n\t * search for the first context that have property key,\n\t * if not found will return the stack local scop as a default value\n\t * @param propertyKey the property key\n\t */\n\tfindScope<T extends Context>(propertyKey: PropertyKey): Scope<T>;\n\n\tresolveAwait(value: AwaitPromiseInfo): void;\n\n\t/**\n\t * get a reference to the last scope in this stack\n\t */\n\tlastScope<T extends Context>(): Scope<T>;\n\n\t/**\n\t * clear every thing after this scope, and even this scope\n\t * @param scope \n\t */\n\tclearTo<T extends Context>(scope: Scope<T>): boolean;\n\n\t/**\n\t * clear every thing after this scope, but not this scope\n\t * @param scope \n\t */\n\tclearTill<T extends Context>(scope: Scope<T>): boolean;\n\n\tpopScope<T extends Context>(): Scope<T>;\n\n\tremoveScope<T extends Context>(scope: Scope<T>): void;\n\n\tpushScope<T extends Context>(scope: Scope<T>): void;\n\n\tpushBlockScope<T extends Context>(): Scope<T>;\n\n\tpushBlockScopeFor<T extends Context>(context: T): Scope<T>;\n\n\tpushReactiveScope<T extends Context>(): ReactiveScope<T>;\n\n\tpushReactiveScopeFor<T extends Context>(context: T): ReactiveScope<T>;\n\n\t/**\n\t * create new stack instance with the same reference to the current scope array\n\t */\n\tcopyStack(): Stack;\n\n\t/**\n\t * used when want to update ui-view like, you want to replace an array with another \n\t * without reflect changes on view until reattached again.\n\t */\n\tdetach(): void;\n\n\t/**\n\t * apply all the not emitted changes, and continue emit in time.\n\t */\n\treattach(): void;\n\n\t/**\n\t * import module scope from another stack, by the help of ModuleScopeResolver.\n\t * \n\t * used with import statement\n\t */\n\timportModule(source: string, importCallOptions?: ImportCallOptions): ModuleScope;\n\n\t/**\n\t * get the current module for this stack.\n\t * \n\t * used with export statement\n\t */\n\tgetModule(): ModuleScope | undefined;\n\n\t/**\n\t * register action to do on destroy this stack\n\t */\n\tonDestroy(action: () => void): void;\n}\n\nexport class Stack implements Stack {\n\tstatic for(...contexts: Scope<Context>[]): Stack {\n\t\tif (contexts.length === 0) {\n\t\t\treturn new Stack();\n\t\t}\n\t\treturn new Stack(contexts.map(context => new Scope<Context>(context)));\n\t}\n\tstatic forScopes(...scopes: Scope<Context>[]): Stack {\n\t\tif (scopes.length === 0) {\n\t\t\tscopes.push(Scope.blockScope());\n\t\t}\n\t\treturn new Stack(scopes);\n\t}\n\tstatic moduleScope(resolver: ModuleScopeResolver, moduleSource: string, ...globalScopes: Scope<Context>[]) {\n\t\treturn new Stack(globalScopes, resolver, moduleSource);\n\t}\n\tawaitPromise: AwaitPromiseInfo[] = [];\n\tforAwaitAsyncIterable?: AsyncIterableInfo | undefined;\n\n\tprotected readonly stack: Array<Scope<any>>;\n\tprotected readonly moduleScope?: ModuleScope;\n\tprotected readonly moduleSource?: string;\n\tprotected readonly resolver?: ModuleScopeResolver;\n\n\tprotected readonly onDestroyActions: (() => void)[] = [];\n\n\tconstructor();\n\tconstructor(globalScope: Scope<Context>);\n\tconstructor(globalScope: Scope<Context>, resolver: ModuleScopeResolver, moduleSource: string);\n\n\tconstructor(stack: Array<Scope<Context>>);\n\tconstructor(stack: Array<Scope<Context>>, resolver: ModuleScopeResolver, moduleSource: string);\n\n\tconstructor(globals?: Array<Scope<Context>> | Scope<Context>, resolver?: ModuleScopeResolver, moduleSource?: string) {\n\t\tif (Array.isArray(globals)) {\n\t\t\tthis.stack = globals;\n\t\t} else if (typeof globals == 'object') {\n\t\t\tthis.stack = [globals];\n\t\t} else {\n\t\t\tthis.stack = [];\n\t\t}\n\t\tif (resolver && moduleSource) {\n\t\t\tthis.resolver = resolver;\n\t\t\tthis.moduleSource = moduleSource;\n\t\t\t// init module scope for import and export\n\t\t\tthis.moduleScope = new ModuleScope(this.initModuleContext());\n\t\t\tthis.pushScope(this.moduleScope);\n\t\t\t// for the rest of module body\n\t\t\tthis.pushReactiveScope();\n\t\t} else {\n\t\t\t// not a module scope\n\t\t\tthis.pushBlockScope();\n\t\t}\n\t\tfinalizerRegister(this, this.onDestroyActions, this);\n\t}\n\tprivate initModuleContext(): ModuleContext {\n\t\tconst importFunc = (path: string) => {\n\t\t\treturn this.importModule(path);\n\t\t};\n\t\timportFunc.meta = {\n\t\t\turl: createRootURL(this.moduleSource!),\n\t\t\tresolve: (specified: string, parent?: string | URL): Promise<string> => {\n\t\t\t\treturn Promise.resolve(this.resolver!.resolveURL(specified, parent ?? importFunc.meta.url));\n\t\t\t}\n\t\t};\n\t\tconst im: ModuleImport & ((path: string) => Promise<any>) = importFunc as any;\n\t\treturn { import: im };\n\t}\n\thas(propertyKey: PropertyKey): boolean {\n\t\treturn this.stack.find(context => context.has(propertyKey)) ? true : false;\n\t}\n\tget(propertyKey: PropertyKey) {\n\t\treturn this.findScope<Context>(propertyKey).get(propertyKey);\n\t}\n\tset(propertyKey: PropertyKey, value: any, receiver?: any): boolean {\n\t\treturn this.findScope<Context>(propertyKey).set(propertyKey, value, receiver);\n\t}\n\tdeclareVariable(propertyKey: PropertyKey, propertyValue?: any) {\n\t\treturn this.lastScope<Context>().set(propertyKey, propertyValue);\n\t}\n\tfindScope<T extends Context>(propertyKey: PropertyKey): Scope<T> {\n\t\tlet lastIndex = this.stack.length;\n\t\twhile (lastIndex--) {\n\t\t\tconst scope = this.stack[lastIndex];\n\t\t\tif (scope.has(propertyKey)) {\n\t\t\t\treturn scope;\n\t\t\t}\n\t\t}\n\t\treturn this.lastScope();\n\t}\n\tresolveAwait(value: AwaitPromiseInfo): void {\n\t\tthis.awaitPromise.push(value);\n\t}\n\tpopScope<T extends Context>(): Scope<T> {\n\t\treturn this.stack.pop()!;\n\t}\n\tremoveScope<T extends Context>(scope: Scope<T>): void {\n\t\tconst index = this.stack.lastIndexOf(scope);\n\t\tthis.stack.splice(index, 1);\n\t}\n\tpushScope<T extends Context>(scope: Scope<T>): void {\n\t\tthis.stack.push(scope);\n\t}\n\tpushBlockScope<T extends Context>(): Scope<T> {\n\t\tconst scope = Scope.blockScope<T>();\n\t\tthis.stack.push(scope);\n\t\treturn scope;\n\t}\n\tpushBlockScopeFor<T extends Context>(context: T): Scope<T> {\n\t\tconst scope = Scope.for<T>(context);\n\t\tthis.stack.push(scope);\n\t\treturn scope;\n\t}\n\tpushReactiveScope<T extends Context>(): ReactiveScope<T> {\n\t\tconst scope = ReactiveScope.blockScope<T>();\n\t\tthis.stack.push(scope);\n\t\treturn scope;\n\t}\n\tpushReactiveScopeFor<T extends Context>(context: T): ReactiveScope<T> {\n\t\tconst scope = ReactiveScope.for(context);\n\t\tthis.stack.push(scope);\n\t\treturn scope;\n\t}\n\tlastScope<T extends Context>(): Scope<T> {\n\t\treturn this.stack[this.stack.length - 1];\n\t}\n\tclearTo<T extends Context>(scope: Scope<T>): boolean {\n\t\tconst index = this.stack.lastIndexOf(scope);\n\t\tif (index === -1) {\n\t\t\treturn false;\n\t\t}\n\t\tthis.stack.splice(index);\n\t\treturn true;\n\t}\n\tclearTill<T extends Context>(scope: Scope<T>): boolean {\n\t\tconst index = this.stack.lastIndexOf(scope);\n\t\tif (index === -1) {\n\t\t\treturn false;\n\t\t}\n\t\tthis.stack.splice(index + 1);\n\t\treturn true;\n\t}\n\tcopyStack(): Stack {\n\t\treturn new Stack(this.stack.slice(), this.resolver!, this.moduleSource!);\n\t}\n\tdetach(): void {\n\t\tthis.getReactiveScopeControls().forEach(scope => scope.detach());\n\t}\n\treattach(): void {\n\t\tthis.getReactiveScopeControls().forEach(scope => scope.reattach());\n\t}\n\tdetectChanges() {\n\t\tthis.getReactiveScope().forEach(scope => scope.detectChanges());\n\t}\n\tprivate getReactiveScopeControls(): ReactiveScopeControl<any>[] {\n\t\treturn this.stack.filter(scope => scope instanceof ReactiveScopeControl) as ReactiveScopeControl<any>[];\n\t}\n\tprivate getReactiveScope(): ReactiveScope<any>[] {\n\t\treturn this.stack.filter(scope => scope instanceof ReactiveScope) as ReactiveScope<any>[];\n\t}\n\timportModule(source: string, importCallOptions?: ImportCallOptions): ModuleScope {\n\t\tif (!this.resolver || !this.moduleScope) {\n\t\t\t// should o the parse and import the module\n\t\t\tthrow new Error('Module Resolver is undefined');\n\t\t}\n\t\treturn this.resolver.resolve(source, this.moduleScope, importCallOptions);\n\t}\n\tgetModule(): ModuleScope | undefined {\n\t\treturn this.moduleScope;\n\t}\n\n\tonDestroy(action: () => void): void {\n\t\tthis.onDestroyActions.push(action);\n\t}\n}\n\n\nexport interface ModuleScopeResolver {\n\tresolve(source: string, moduleScope: ModuleScope, importCallOptions?: ImportCallOptions): ModuleScope;\n\tresolveURL(specified: string, parent: string | URL): string;\n}\n\nconst ROOT_URL = 'https://root';\nexport function createRootURL(source: string): URL {\n\treturn new URL(source, ROOT_URL);\n}\n\n\nexport interface ResolverConfig {\n\t/**\n\t * \n\t */\n\tallowImportExternal?: boolean;\n\n};\nexport class ModuleScopeResolver implements ModuleScopeResolver {\n\tprotected modules: [string, ModuleScope][] = [];\n\tconstructor(protected config?: ResolverConfig) { }\n\tregister(source: string, moduleScope: ModuleScope) {\n\t\tconst stackInfo = this.modules.find(tuple => tuple[0] == source && tuple[1] == moduleScope);\n\t\tif (stackInfo) {\n\t\t\tstackInfo[1] = moduleScope;\n\t\t} else {\n\t\t\tthis.modules.push([source, moduleScope]);\n\t\t}\n\t}\n\tresolve(source: string, moduleScope: ModuleScope, importCallOptions?: ImportCallOptions): ModuleScope {\n\t\tif (this.isValidHTTPUrl(source)) {\n\t\t\treturn this.resolveExternalModule(source, importCallOptions);\n\t\t}\n\t\tif (source.startsWith('/')) {\n\t\t\treturn this.findScopeBySource(source, importCallOptions);\n\t\t}\n\t\tconst currentSource = this.findSourceByScope(moduleScope);\n\t\tconst absoluteUrl = this.resolveURL(source, currentSource);\n\t\treturn this.findScopeBySource(absoluteUrl, importCallOptions);\n\t}\n\tresolveURL(specified: string, parent: string | URL): string {\n\t\tconst currentUrl = parent instanceof URL ? parent.href : createRootURL(parent).href;\n\t\tconst importedUrl = new URL(specified, currentUrl).href;\n\t\tconst absoluteUrl = importedUrl.replace(ROOT_URL, '');\n\t\treturn absoluteUrl;\n\t}\n\tprotected findScopeBySource(source: string, importCallOptions?: ImportCallOptions): ModuleScope {\n\t\tif (importCallOptions?.assert?.type) {\n\t\t\tconst type = importCallOptions.assert.type;\n\t\t\tif (!source.endsWith(`.${type}`)) {\n\t\t\t\tthrow new Error(`Can't find module scope`);\n\t\t\t}\n\t\t}\n\t\tconst importedScope = this.modules.find(tuple => tuple[0] == source)?.[1];\n\t\tif (!importedScope) {\n\t\t\tthrow new Error(`Can't find module scope`);\n\t\t}\n\t\treturn importedScope;\n\t}\n\tprotected findSourceByScope(moduleScope: ModuleScope): string {\n\t\tconst importedSource = this.modules.find(tuple => tuple[1] == moduleScope)?.[0];\n\t\tif (!importedSource) {\n\t\t\tthrow new Error(`Can't resolve scope source`);\n\t\t}\n\t\treturn importedSource;\n\t}\n\tprotected resolveExternalModule(source: string, importCallOptions?: ImportCallOptions): WebModuleScope {\n\t\tif (!this.config?.allowImportExternal) {\n\t\t\tthrow new Error(`Error: Import External Module is not allowed.`);\n\t\t}\n\t\tconst webScope = new WebModuleScope()\n\t\tthis.modules.push([source, webScope]);\n\t\t// active later\n\t\t// import(source, importCallOptions)\n\t\timport(source).then(module => {\n\t\t\twebScope.updateContext(module);\n\t\t});\n\t\treturn webScope;\n\t}\n\tprotected readonly isValidHTTPUrl = (string: string) => {\n\t\tlet url: URL;\n\t\ttry {\n\t\t\turl = new URL(string);\n\t\t} catch (e) {\n\t\t\treturn false;\n\t\t}\n\t\treturn url.protocol === 'http:' || url.protocol === 'https:';\n\t}\n}\n"]}
|
package/v8/enums.js
CHANGED
|
@@ -40,6 +40,10 @@ export class PropertyKindInfo {
|
|
|
40
40
|
this.isRest = false;
|
|
41
41
|
}
|
|
42
42
|
parsePropertyKindFromToken(token) {
|
|
43
|
+
// This returns true, setting the property kind, iff the given token is
|
|
44
|
+
// one which must occur after a property name, indicating that the
|
|
45
|
+
// previous token was in fact a name and not a modifier (like the "get" in
|
|
46
|
+
// "get x").
|
|
43
47
|
switch (token) {
|
|
44
48
|
case Token.COLON:
|
|
45
49
|
this.kind = PropertyKind.Value;
|
|
@@ -91,37 +95,60 @@ export var ParseFunctionFlag;
|
|
|
91
95
|
})(ParseFunctionFlag || (ParseFunctionFlag = {}));
|
|
92
96
|
export var FunctionKind;
|
|
93
97
|
(function (FunctionKind) {
|
|
98
|
+
// BEGIN constructable functions
|
|
94
99
|
FunctionKind[FunctionKind["NormalFunction"] = 0] = "NormalFunction";
|
|
95
100
|
FunctionKind[FunctionKind["Module"] = 1] = "Module";
|
|
96
101
|
FunctionKind[FunctionKind["AsyncModule"] = 2] = "AsyncModule";
|
|
102
|
+
// BEGIN class constructors
|
|
103
|
+
// BEGIN base constructors
|
|
97
104
|
FunctionKind[FunctionKind["BaseConstructor"] = 3] = "BaseConstructor";
|
|
105
|
+
// BEGIN default constructors
|
|
98
106
|
FunctionKind[FunctionKind["DefaultBaseConstructor"] = 4] = "DefaultBaseConstructor";
|
|
107
|
+
// END base constructors
|
|
108
|
+
// BEGIN derived constructors
|
|
99
109
|
FunctionKind[FunctionKind["DefaultDerivedConstructor"] = 5] = "DefaultDerivedConstructor";
|
|
110
|
+
// END default constructors
|
|
100
111
|
FunctionKind[FunctionKind["DerivedConstructor"] = 6] = "DerivedConstructor";
|
|
112
|
+
// END derived constructors
|
|
113
|
+
// END class constructors
|
|
114
|
+
// END constructable functions.
|
|
115
|
+
// BEGIN accessors
|
|
101
116
|
FunctionKind[FunctionKind["GetterFunction"] = 7] = "GetterFunction";
|
|
102
117
|
FunctionKind[FunctionKind["StaticGetterFunction"] = 8] = "StaticGetterFunction";
|
|
103
118
|
FunctionKind[FunctionKind["SetterFunction"] = 9] = "SetterFunction";
|
|
104
119
|
FunctionKind[FunctionKind["StaticSetterFunction"] = 10] = "StaticSetterFunction";
|
|
120
|
+
// END accessors
|
|
121
|
+
// BEGIN arrow functions
|
|
105
122
|
FunctionKind[FunctionKind["ArrowFunction"] = 11] = "ArrowFunction";
|
|
123
|
+
// BEGIN async functions
|
|
106
124
|
FunctionKind[FunctionKind["AsyncArrowFunction"] = 12] = "AsyncArrowFunction";
|
|
125
|
+
// END arrow functions
|
|
107
126
|
FunctionKind[FunctionKind["AsyncFunction"] = 13] = "AsyncFunction";
|
|
127
|
+
// BEGIN concise methods 1
|
|
108
128
|
FunctionKind[FunctionKind["AsyncConciseMethod"] = 14] = "AsyncConciseMethod";
|
|
109
129
|
FunctionKind[FunctionKind["StaticAsyncConciseMethod"] = 15] = "StaticAsyncConciseMethod";
|
|
130
|
+
// BEGIN generators
|
|
110
131
|
FunctionKind[FunctionKind["AsyncConciseGeneratorMethod"] = 16] = "AsyncConciseGeneratorMethod";
|
|
111
132
|
FunctionKind[FunctionKind["StaticAsyncConciseGeneratorMethod"] = 17] = "StaticAsyncConciseGeneratorMethod";
|
|
133
|
+
// END concise methods 1
|
|
112
134
|
FunctionKind[FunctionKind["AsyncGeneratorFunction"] = 18] = "AsyncGeneratorFunction";
|
|
135
|
+
// END async functions
|
|
113
136
|
FunctionKind[FunctionKind["GeneratorFunction"] = 19] = "GeneratorFunction";
|
|
137
|
+
// BEGIN concise methods 2
|
|
114
138
|
FunctionKind[FunctionKind["ConciseGeneratorMethod"] = 20] = "ConciseGeneratorMethod";
|
|
115
139
|
FunctionKind[FunctionKind["StaticConciseGeneratorMethod"] = 21] = "StaticConciseGeneratorMethod";
|
|
140
|
+
// END generators
|
|
116
141
|
FunctionKind[FunctionKind["ConciseMethod"] = 22] = "ConciseMethod";
|
|
117
142
|
FunctionKind[FunctionKind["StaticConciseMethod"] = 23] = "StaticConciseMethod";
|
|
118
143
|
FunctionKind[FunctionKind["ClassMembersInitializerFunction"] = 24] = "ClassMembersInitializerFunction";
|
|
119
144
|
FunctionKind[FunctionKind["ClassStaticInitializerFunction"] = 25] = "ClassStaticInitializerFunction";
|
|
145
|
+
// END concise methods 2
|
|
120
146
|
FunctionKind[FunctionKind["Invalid"] = 26] = "Invalid";
|
|
121
147
|
FunctionKind[FunctionKind["LastFunctionKind"] = 25] = "LastFunctionKind";
|
|
122
148
|
})(FunctionKind || (FunctionKind = {}));
|
|
123
149
|
const FUNCTIONS_TYPES = [
|
|
124
150
|
[
|
|
151
|
+
// SubFunctionKind::kNormalFunction
|
|
125
152
|
[
|
|
126
153
|
FunctionKind.NormalFunction,
|
|
127
154
|
FunctionKind.AsyncFunction
|
|
@@ -132,6 +159,7 @@ const FUNCTIONS_TYPES = [
|
|
|
132
159
|
],
|
|
133
160
|
],
|
|
134
161
|
[
|
|
162
|
+
// SubFunctionKind::kNonStaticMethod
|
|
135
163
|
[
|
|
136
164
|
FunctionKind.ConciseMethod,
|
|
137
165
|
FunctionKind.AsyncConciseMethod
|
|
@@ -142,6 +170,7 @@ const FUNCTIONS_TYPES = [
|
|
|
142
170
|
],
|
|
143
171
|
],
|
|
144
172
|
[
|
|
173
|
+
// SubFunctionKind::kStaticMethod
|
|
145
174
|
[
|
|
146
175
|
FunctionKind.StaticConciseMethod,
|
|
147
176
|
FunctionKind.StaticAsyncConciseMethod
|
|
@@ -258,6 +287,8 @@ export function bindsSuper(kind) {
|
|
|
258
287
|
return isConciseMethod(kind) || isAccessorFunction(kind) || isClassConstructor(kind);
|
|
259
288
|
}
|
|
260
289
|
export function isAwaitAsIdentifierDisallowed(kind) {
|
|
290
|
+
// 'await' is always disallowed as an identifier in module contexts. Callers
|
|
291
|
+
// should short-circuit the module case instead of calling this.
|
|
261
292
|
return !isModule(kind) && (isAsyncFunction(kind) || kind == FunctionKind.ClassStaticInitializerFunction);
|
|
262
293
|
}
|
|
263
294
|
export function functionKind2String(kind) {
|
package/v8/enums.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enums.js","sourceRoot":"","sources":["../../../src/expressions/v8/enums.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,MAAM,UAAU,SAAS,CAAC,GAAW,EAAE,KAAa,EAAE,GAAW;IAChE,OAAO,GAAG,IAAI,KAAK,IAAI,GAAG,IAAI,GAAG,CAAC;AACnC,CAAC;AAED,MAAM,CAAN,IAAY,oBAAkF;AAA9F,WAAY,oBAAoB;IAAG,iGAAqB,CAAA;IAAE,mFAAc,CAAA;IAAE,2FAAkB,CAAA;AAAC,CAAC,EAAlF,oBAAoB,KAApB,oBAAoB,QAA8D;AAC9F,MAAM,CAAN,IAAY,YAIX;AAJD,WAAY,YAAY;IACvB,iDAAK,CAAA;IAAE,yDAAS,CAAA;IAAE,iFAAqB,CAAA;IACvC,mDAAM,CAAA;IAAE,mDAAM,CAAA;IAAE,2DAAU,CAAA;IAAE,mEAAc,CAAA;IAAE,mEAAc,CAAA;IAC1D,mDAAM,CAAA;IAAE,mDAAM,CAAA;AACf,CAAC,EAJW,YAAY,KAAZ,YAAY,QAIvB;AACD,MAAM,UAAU,UAAU,CAAC,IAAkB;IAC5C,OAAO,IAAI,KAAK,YAAY,CAAC,cAAc,IAAI,IAAI,KAAK,YAAY,CAAC,cAAc,CAAC;AACrF,CAAC;AAED,MAAM,CAAN,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC3B,yEAAa,CAAA;I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AAC,aAAa,CAAC;QACnC,KAAK,wBAAwB,CAAC,MAAM;YACnC,OAAO,YAAY,CAAC,iBAAiB,CAAC;QACvC,KAAK,wBAAwB,CAAC,MAAM;YACnC,OAAO,YAAY,CAAC,iBAAiB,CAAC;KACvC;AACF,CAAC;AAED,MAAM,CAAN,IAAY,YAGX;AAHD,WAAY,YAAY;IACvB,mDAAM,CAAA;IACN,mDAAM,CAAA;AACP,CAAC,EAHW,YAAY,KAAZ,YAAY,QAGvB;AAAA,CAAC;AAEF,MAAM,UAAU,QAAQ,CAAC,IAAkB;IAC1C,OAAO,YAAY,CAAC,MAAM,KAAK,IAAI,CAAC;AACrC,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,IAAkB;IAC1C,OAAO,YAAY,CAAC,MAAM,KAAK,IAAI,CAAC;AACrC,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,QAAiB;IAChD,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC;AAC/D,CAAC;AAED,MAAM,CAAN,IAAY,0BAIX;AAJD,WAAY,0BAA0B;IACrC,qGAAiB,CAAA;IACjB,qFAAS,CAAA;IACT,2FAAY,CAAA;AACb,CAAC,EAJW,0BAA0B,KAA1B,0BAA0B,QAIrC;AAAA,CAAC;AAEF,MAAM,CAAN,IAAY,8BAGX;AAHD,WAAY,8BAA8B;IACzC,uIAA8B,CAAA;IAC9B,6IAAiC,CAAA;AAClC,CAAC,EAHW,8BAA8B,KAA9B,8BAA8B,QAGzC;AAAA,CAAC","sourcesContent":["import { AccessorProperty, MethodDefinition, PropertyDefinition, StaticBlock } from '../api/class/class.js';\nimport { ExpressionNode } from '../api/expression.js';\nimport { VariableDeclarator } from '../api/statement/declarations/declares.js';\nimport { Token } from './token.js';\n\nexport function isInRange(num: number, start: number, end: number) {\n\treturn num >= start && num <= end;\n}\n\nexport enum ParsingArrowHeadFlag { CertainlyNotArrowHead, MaybeArrowHead, AsyncArrowFunction }\nexport enum PropertyKind {\n\tValue, Shorthand, ShorthandOrClassField,\n\tAssign, Method, ClassField, AccessorGetter, AccessorSetter,\n\tSpread, NotSet\n}\nexport function isAccessor(kind: PropertyKind) {\n\treturn kind === PropertyKind.AccessorGetter || kind === PropertyKind.AccessorSetter;\n}\n\nexport enum PropertyPosition {\n\tObjectLiteral,\n\tClassLiteral\n}\n\nexport class PropertyKindInfo {\n\tname: string;\n\tposition = PropertyPosition.ClassLiteral;\n\tfuncFlag = ParseFunctionFlag.IsNormal;\n\tkind = PropertyKind.NotSet;\n\tisComputedName = false;\n\tisPrivate = false;\n\tisStatic = false;\n\tisRest = false;\n\n\tparsePropertyKindFromToken(token: Token): boolean {\n\t\t// This returns true, setting the property kind, iff the given token is\n\t\t// one which must occur after a property name, indicating that the\n\t\t// previous token was in fact a name and not a modifier (like the \"get\" in\n\t\t// \"get x\").\n\t\tswitch (token) {\n\t\t\tcase Token.COLON:\n\t\t\t\tthis.kind = PropertyKind.Value;\n\t\t\t\treturn true;\n\t\t\tcase Token.COMMA:\n\t\t\t\tthis.kind = PropertyKind.Shorthand;\n\t\t\t\treturn true;\n\t\t\tcase Token.RBRACE:\n\t\t\t\tthis.kind = PropertyKind.ShorthandOrClassField;\n\t\t\t\treturn true;\n\t\t\tcase Token.ASSIGN:\n\t\t\t\tthis.kind = PropertyKind.Assign;\n\t\t\t\treturn true;\n\t\t\tcase Token.LPAREN:\n\t\t\t\tthis.kind = PropertyKind.Method;\n\t\t\t\treturn true;\n\t\t\tcase Token.MUL:\n\t\t\tcase Token.SEMICOLON:\n\t\t\t\tthis.kind = PropertyKind.ClassField;\n\t\t\t\treturn true;\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\t\treturn false;\n\t}\n\n}\n\nexport type FunctionInfo = { rest?: boolean };\n\nexport enum PreParserIdentifierType {\n\tNullIdentifier,\n\tUnknownIdentifier,\n\tEvalIdentifier,\n\tArgumentsIdentifier,\n\tConstructorIdentifier,\n\tAwaitIdentifier,\n\tAsyncIdentifier,\n\tNameIdentifier,\n\tPrivateNameIdentifier\n}\n\nexport enum FunctionBodyType {\n\tEXPRESSION,\n\tBLOCK,\n}\n\nexport enum ParseFunctionFlag {\n\tIsNormal = 0,\n\tIsGenerator = 1 << 0,\n\tIsAsync = 1 << 1\n}\n\nexport enum FunctionKind {\n\n\t// BEGIN constructable functions\n\tNormalFunction,\n\tModule,\n\tAsyncModule,\n\t// BEGIN class constructors\n\t// BEGIN base constructors\n\tBaseConstructor,\n\t// BEGIN default constructors\n\tDefaultBaseConstructor,\n\t// END base constructors\n\t// BEGIN derived constructors\n\tDefaultDerivedConstructor,\n\t// END default constructors\n\tDerivedConstructor,\n\t// END derived constructors\n\t// END class constructors\n\t// END constructable functions.\n\t// BEGIN accessors\n\tGetterFunction,\n\tStaticGetterFunction,\n\tSetterFunction,\n\tStaticSetterFunction,\n\t// END accessors\n\t// BEGIN arrow functions\n\tArrowFunction,\n\t// BEGIN async functions\n\tAsyncArrowFunction,\n\t// END arrow functions\n\tAsyncFunction,\n\t// BEGIN concise methods 1\n\tAsyncConciseMethod,\n\tStaticAsyncConciseMethod,\n\t// BEGIN generators\n\tAsyncConciseGeneratorMethod,\n\tStaticAsyncConciseGeneratorMethod,\n\t// END concise methods 1\n\tAsyncGeneratorFunction,\n\t// END async functions\n\tGeneratorFunction,\n\t// BEGIN concise methods 2\n\tConciseGeneratorMethod,\n\tStaticConciseGeneratorMethod,\n\t// END generators\n\tConciseMethod,\n\tStaticConciseMethod,\n\tClassMembersInitializerFunction,\n\tClassStaticInitializerFunction,\n\t// END concise methods 2\n\tInvalid,\n\n\tLastFunctionKind = ClassStaticInitializerFunction,\n}\n\nconst FUNCTIONS_TYPES: FunctionKind[][][] = [\n\t[\n\t\t// SubFunctionKind::kNormalFunction\n\t\t[// is_generator=false\n\t\t\tFunctionKind.NormalFunction,\n\t\t\tFunctionKind.AsyncFunction\n\t\t],\n\t\t[// is_generator=true\n\t\t\tFunctionKind.GeneratorFunction,\n\t\t\tFunctionKind.AsyncGeneratorFunction\n\t\t],\n\t],\n\t[\n\t\t// SubFunctionKind::kNonStaticMethod\n\t\t[// is_generator=false\n\t\t\tFunctionKind.ConciseMethod,\n\t\t\tFunctionKind.AsyncConciseMethod\n\t\t],\n\t\t[// is_generator=true\n\t\t\tFunctionKind.ConciseGeneratorMethod,\n\t\t\tFunctionKind.AsyncConciseGeneratorMethod\n\t\t],\n\t],\n\t[\n\t\t// SubFunctionKind::kStaticMethod\n\t\t[// is_generator=false\n\t\t\tFunctionKind.StaticConciseMethod,\n\t\t\tFunctionKind.StaticAsyncConciseMethod\n\t\t],\n\t\t[// is_generator=true\n\t\t\tFunctionKind.StaticConciseGeneratorMethod,\n\t\t\tFunctionKind.StaticAsyncConciseGeneratorMethod\n\t\t],\n\t]\n];\n\nexport enum SubFunctionKind {\n\tNormalFunction,\n\tNonStaticMethod,\n\tStaticMethod,\n}\n\nexport enum StaticFlag {\n\tNotStatic,\n\tStatic\n};\n\n\nexport function functionKindForImpl(subFunctionKind: SubFunctionKind, flags: ParseFunctionFlag): FunctionKind {\n\treturn FUNCTIONS_TYPES[subFunctionKind]\n\t[(flags & ParseFunctionFlag.IsGenerator) != 0 ? 1 : 0]\n\t[(flags & ParseFunctionFlag.IsAsync) != 0 ? 1 : 0];\n}\n\nexport function functionKindFor(isGenerator: boolean, isAsync: boolean): FunctionKind {\n\treturn FUNCTIONS_TYPES[SubFunctionKind.NormalFunction][isGenerator ? 1 : 0][isAsync ? 1 : 0];\n}\n\nexport function methodKindFor(isStatic: boolean, isGenerator: boolean, isAsync: boolean): FunctionKind {\n\treturn FUNCTIONS_TYPES[isStatic ? SubFunctionKind.StaticMethod : SubFunctionKind.NonStaticMethod][isGenerator ? 1 : 0][isAsync ? 1 : 0];\n}\n\nexport enum FunctionSyntaxKind {\n\tAnonymousExpression,\n\tNamedExpression,\n\tDeclaration,\n\tAccessorOrMethod,\n\tWrapped,\n\n\tLastFunctionSyntaxKind = Wrapped,\n};\n\n\n\nexport function isArrowFunction(kind: FunctionKind) {\n\treturn isInRange(kind, FunctionKind.ArrowFunction, FunctionKind.AsyncArrowFunction);\n}\n\nexport function isModule(kind: FunctionKind) {\n\treturn isInRange(kind, FunctionKind.Module, FunctionKind.AsyncModule);\n}\n\nexport function isAsyncModule(kind: FunctionKind) {\n\treturn kind == FunctionKind.AsyncModule;\n}\n\nexport function isAsyncGeneratorFunction(kind: FunctionKind) {\n\treturn isInRange(kind, FunctionKind.AsyncConciseGeneratorMethod, FunctionKind.AsyncGeneratorFunction);\n}\n\nexport function isGeneratorFunction(kind: FunctionKind) {\n\treturn isInRange(kind, FunctionKind.AsyncConciseGeneratorMethod, FunctionKind.StaticConciseGeneratorMethod);\n}\n\nexport function isAsyncFunction(kind: FunctionKind) {\n\treturn isInRange(kind, FunctionKind.AsyncArrowFunction, FunctionKind.AsyncGeneratorFunction);\n}\n\nexport function isResumableFunction(kind: FunctionKind) {\n\treturn isGeneratorFunction(kind) || isAsyncFunction(kind) || isModule(kind);\n}\n\nexport function isConciseMethod(kind: FunctionKind) {\n\treturn isInRange(kind, FunctionKind.AsyncConciseMethod, FunctionKind.StaticAsyncConciseGeneratorMethod)\n\t\t|| isInRange(kind, FunctionKind.ConciseGeneratorMethod, FunctionKind.ClassStaticInitializerFunction);\n}\n\nexport function isStrictFunctionWithoutPrototype(kind: FunctionKind) {\n\treturn isInRange(kind, FunctionKind.GetterFunction, FunctionKind.AsyncArrowFunction)\n\t\t|| isInRange(kind, FunctionKind.AsyncConciseMethod, FunctionKind.StaticAsyncConciseGeneratorMethod)\n\t\t|| isInRange(kind, FunctionKind.ConciseGeneratorMethod, FunctionKind.ClassStaticInitializerFunction);\n}\n\nexport function isGetterFunction(kind: FunctionKind) {\n\treturn isInRange(kind, FunctionKind.GetterFunction, FunctionKind.StaticGetterFunction);\n}\n\nexport function isSetterFunction(kind: FunctionKind) {\n\treturn isInRange(kind, FunctionKind.SetterFunction, FunctionKind.StaticSetterFunction);\n}\n\nexport function isAccessorFunction(kind: FunctionKind) {\n\treturn isInRange(kind, FunctionKind.GetterFunction, FunctionKind.StaticSetterFunction);\n}\n\nexport function isDefaultConstructor(kind: FunctionKind) {\n\treturn isInRange(kind, FunctionKind.DefaultBaseConstructor, FunctionKind.DefaultDerivedConstructor);\n}\n\nexport function isBaseConstructor(kind: FunctionKind) {\n\treturn isInRange(kind, FunctionKind.BaseConstructor, FunctionKind.DefaultBaseConstructor);\n}\n\nexport function isDerivedConstructor(kind: FunctionKind) {\n\treturn isInRange(kind, FunctionKind.DefaultDerivedConstructor, FunctionKind.DerivedConstructor);\n}\n\nexport function isClassConstructor(kind: FunctionKind) {\n\treturn isInRange(kind, FunctionKind.BaseConstructor, FunctionKind.DerivedConstructor);\n}\n\nexport function isClassMembersInitializerFunction(kind: FunctionKind) {\n\treturn isInRange(kind, FunctionKind.ClassMembersInitializerFunction, FunctionKind.ClassStaticInitializerFunction);\n}\n\nexport function isConstructable(kind: FunctionKind) {\n\treturn isInRange(kind, FunctionKind.NormalFunction, FunctionKind.DerivedConstructor);\n}\n\nexport function isStatic(kind: FunctionKind) {\n\tswitch (kind) {\n\t\tcase FunctionKind.StaticGetterFunction:\n\t\tcase FunctionKind.StaticSetterFunction:\n\t\tcase FunctionKind.StaticConciseMethod:\n\t\tcase FunctionKind.StaticConciseGeneratorMethod:\n\t\tcase FunctionKind.StaticAsyncConciseMethod:\n\t\tcase FunctionKind.StaticAsyncConciseGeneratorMethod:\n\t\tcase FunctionKind.ClassStaticInitializerFunction:\n\t\t\treturn true;\n\t\tdefault:\n\t\t\treturn false;\n\t}\n}\n\nexport function bindsSuper(kind: FunctionKind) {\n\treturn isConciseMethod(kind) || isAccessorFunction(kind) || isClassConstructor(kind);\n}\n\nexport function isAwaitAsIdentifierDisallowed(kind: FunctionKind) {\n\t// 'await' is always disallowed as an identifier in module contexts. Callers\n\t// should short-circuit the module case instead of calling this.\n\treturn !isModule(kind) && (isAsyncFunction(kind) || kind == FunctionKind.ClassStaticInitializerFunction);\n}\n\nexport function functionKind2String(kind: FunctionKind): string {\n\treturn FunctionKind[kind];\n}\n\nexport type ClassInfo = {\n\textends?: ExpressionNode;\n\tpublicMembers: (MethodDefinition | PropertyDefinition)[],\n\tprivateMembers: (MethodDefinition | PropertyDefinition)[],\n\tstaticElements: (MethodDefinition | PropertyDefinition | AccessorProperty | StaticBlock)[],\n\tinstanceFields: (MethodDefinition | PropertyDefinition | AccessorProperty)[],\n\tconstructor: MethodDefinition | undefined,\n\n\thasSeenConstructor: boolean;\n\thasStaticComputedNames: boolean;\n\thasStaticElements: boolean;\n\thasStaticPrivateMethods: boolean;\n\thasStaticBlocks: boolean;\n\thasInstanceMembers: boolean;\n\trequiresBrand: boolean;\n\tisAnonymous: boolean;\n\thasPrivateMethods: boolean,\n\n\tcomputedFieldCount: number;\n\n\thomeObjectVariable?: VariableDeclarator;\n\tstaticHomeObjectVariable?: VariableDeclarator;\n};\n\nexport function createClassInfo(): ClassInfo {\n\treturn {\n\t\tpublicMembers: [],\n\t\tprivateMembers: [],\n\t\tstaticElements: [],\n\t\tinstanceFields: [],\n\t\t'constructor': undefined,\n\n\t\thasSeenConstructor: false,\n\t\thasStaticComputedNames: false,\n\t\thasStaticElements: false,\n\t\thasStaticPrivateMethods: false,\n\t\thasStaticBlocks: false,\n\t\thasInstanceMembers: false,\n\t\trequiresBrand: false,\n\t\tisAnonymous: false,\n\t\thasPrivateMethods: false,\n\n\t\tcomputedFieldCount: 0,\n\t};\n}\n\nexport enum FunctionNameValidity {\n\tFunctionNameIsStrictReserved = 'FunctionNameIsStrictReserved',\n\tSkipFunctionNameCheck = 'SkipFunctionNameCheck',\n\tFunctionNameValidityUnknown = 'FunctionNameValidityUnknown'\n};\n\nexport enum ObjectLiteralPropertyKind {\n\tCONSTANT = 'CONSTANT',\t// Property with constant value (compile time).\n\tCOMPUTED = 'COMPUTED',\t// Property with computed value (execution time).\n\tMATERIALIZED_LITERAL = 'MATERIALIZED_LITERAL', // Property value is a materialized literal.\n\tGETTER = 'GETTER',\n\tSETTER = 'SETTER',\t\t// Property is an accessor function.\n\tPROTOTYPE = 'PROTOTYPE',\t// Property is __proto__.\n\tSPREAD = 'SPREAD'\n}\nexport class ObjectLiteralProperty {\n\tstatic Kind = ObjectLiteralPropertyKind;\n}\n\nexport enum ClassLiteralPropertyKind {\n\tMETHOD = 'METHOD',\n\tGETTER = 'GETTER',\n\tSETTER = 'SETTER',\n\tFIELD = 'FIELD'\n}\n\nexport class ClassLiteralProperty {\n\tstatic Kind = ClassLiteralPropertyKind;\n}\n\nexport function classPropertyKindFor(kind: PropertyKind): ClassLiteralPropertyKind {\n\tswitch (kind) {\n\t\tcase PropertyKind.AccessorGetter:\n\t\t\treturn ClassLiteralPropertyKind.GETTER;\n\t\tcase PropertyKind.AccessorSetter:\n\t\t\treturn ClassLiteralPropertyKind.SETTER;\n\t\tcase PropertyKind.Method:\n\t\t\treturn ClassLiteralPropertyKind.METHOD;\n\t\tcase PropertyKind.ClassField:\n\t\t\treturn ClassLiteralPropertyKind.FIELD;\n\t}\n\tthrow new Error(`unexpected property kind: ${kind}`);\n}\n\nexport enum VariableMode {\n\tConst = 'Const',\n\tPrivateMethod = 'PrivateMethod',\n\tPrivateGetterOnly = 'PrivateGetterOnly',\n\tPrivateSetterOnly = 'PrivateSetterOnly'\n}\n\nexport function getVariableMode(kind: ClassLiteralPropertyKind): VariableMode {\n\tswitch (kind) {\n\t\tcase ClassLiteralPropertyKind.FIELD:\n\t\t\treturn VariableMode.Const;\n\t\tcase ClassLiteralPropertyKind.METHOD:\n\t\t\treturn VariableMode.PrivateMethod;\n\t\tcase ClassLiteralPropertyKind.GETTER:\n\t\t\treturn VariableMode.PrivateGetterOnly;\n\t\tcase ClassLiteralPropertyKind.SETTER:\n\t\t\treturn VariableMode.PrivateSetterOnly;\n\t}\n}\n\nexport enum LanguageMode {\n\tSloppy,\n\tStrict,\n};\n\nexport function isSloppy(mode: LanguageMode) {\n\treturn LanguageMode.Sloppy === mode;\n}\n\nexport function isStrict(mode: LanguageMode) {\n\treturn LanguageMode.Strict === mode;\n}\n\nexport function getLanguageMode(isModule: boolean) {\n\treturn !!isModule ? LanguageMode.Strict : LanguageMode.Sloppy;\n}\n\nexport enum VariableDeclarationContext {\n\tStatementListItem,\n\tStatement,\n\tForStatement\n};\n\nexport enum AllowLabelledFunctionStatement {\n\tAllowLabelledFunctionStatement,\n\tDisallowLabelledFunctionStatement,\n};\n"]}
|
|
1
|
+
{"version":3,"file":"enums.js","sourceRoot":"","sources":["../../../src/expressions/v8/enums.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,MAAM,UAAU,SAAS,CAAC,GAAW,EAAE,KAAa,EAAE,GAAW;IAChE,OAAO,GAAG,IAAI,KAAK,IAAI,GAAG,IAAI,GAAG,CAAC;AACnC,CAAC;AAED,MAAM,CAAN,IAAY,oBAAkF;AAA9F,WAAY,oBAAoB;IAAG,iGAAqB,CAAA;IAAE,mFAAc,CAAA;IAAE,2FAAkB,CAAA;AAAC,CAAC,EAAlF,oBAAoB,KAApB,oBAAoB,QAA8D;AAC9F,MAAM,CAAN,IAAY,YAIX;AAJD,WAAY,YAAY;IACvB,iDAAK,CAAA;IAAE,yDAAS,CAAA;IAAE,iFAAqB,CAAA;IACvC,mDAAM,CAAA;IAAE,mDAAM,CAAA;IAAE,2DAAU,CAAA;IAAE,mEAAc,CAAA;IAAE,mEAAc,CAAA;IAC1D,mDAAM,CAAA;IAAE,mDAAM,CAAA;AACf,CAAC,EAJW,YAAY,KAAZ,YAAY,QAIvB;AACD,MAAM,UAAU,UAAU,CAAC,IAAkB;IAC5C,OAAO,IAAI,KAAK,YAAY,CAAC,cAAc,IAAI,IAAI,KAAK,YAAY,CAAC,cAAc,CAAC;AACrF,CAAC;AAED,MAAM,CAAN,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC3B,yEAAa,CAAA;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,EAJW,0BAA0B,KAA1B,0BAA0B,QAIrC;AAAA,CAAC;AAEF,MAAM,CAAN,IAAY,8BAGX;AAHD,WAAY,8BAA8B;IACzC,uIAA8B,CAAA;IAC9B,6IAAiC,CAAA;AAClC,CAAC,EAHW,8BAA8B,KAA9B,8BAA8B,QAGzC;AAAA,CAAC","sourcesContent":["import { AccessorProperty, MethodDefinition, PropertyDefinition, StaticBlock } from '../api/class/class.js';\nimport { ExpressionNode } from '../api/expression.js';\nimport { VariableDeclarator } from '../api/statement/declarations/declares.js';\nimport { Token } from './token.js';\n\nexport function isInRange(num: number, start: number, end: number) {\n\treturn num >= start && num <= end;\n}\n\nexport enum ParsingArrowHeadFlag { CertainlyNotArrowHead, MaybeArrowHead, AsyncArrowFunction }\nexport enum PropertyKind {\n\tValue, Shorthand, ShorthandOrClassField,\n\tAssign, Method, ClassField, AccessorGetter, AccessorSetter,\n\tSpread, NotSet\n}\nexport function isAccessor(kind: PropertyKind) {\n\treturn kind === PropertyKind.AccessorGetter || kind === PropertyKind.AccessorSetter;\n}\n\nexport enum PropertyPosition {\n\tObjectLiteral,\n\tClassLiteral\n}\n\nexport class PropertyKindInfo {\n\tname: string;\n\tposition = PropertyPosition.ClassLiteral;\n\tfuncFlag = ParseFunctionFlag.IsNormal;\n\tkind = PropertyKind.NotSet;\n\tisComputedName = false;\n\tisPrivate = false;\n\tisStatic = false;\n\tisRest = false;\n\n\tparsePropertyKindFromToken(token: Token): boolean {\n\t\t// This returns true, setting the property kind, iff the given token is\n\t\t// one which must occur after a property name, indicating that the\n\t\t// previous token was in fact a name and not a modifier (like the \"get\" in\n\t\t// \"get x\").\n\t\tswitch (token) {\n\t\t\tcase Token.COLON:\n\t\t\t\tthis.kind = PropertyKind.Value;\n\t\t\t\treturn true;\n\t\t\tcase Token.COMMA:\n\t\t\t\tthis.kind = PropertyKind.Shorthand;\n\t\t\t\treturn true;\n\t\t\tcase Token.RBRACE:\n\t\t\t\tthis.kind = PropertyKind.ShorthandOrClassField;\n\t\t\t\treturn true;\n\t\t\tcase Token.ASSIGN:\n\t\t\t\tthis.kind = PropertyKind.Assign;\n\t\t\t\treturn true;\n\t\t\tcase Token.LPAREN:\n\t\t\t\tthis.kind = PropertyKind.Method;\n\t\t\t\treturn true;\n\t\t\tcase Token.MUL:\n\t\t\tcase Token.SEMICOLON:\n\t\t\t\tthis.kind = PropertyKind.ClassField;\n\t\t\t\treturn true;\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\t\treturn false;\n\t}\n\n}\n\nexport type FunctionInfo = { rest?: boolean };\n\nexport enum PreParserIdentifierType {\n\tNullIdentifier,\n\tUnknownIdentifier,\n\tEvalIdentifier,\n\tArgumentsIdentifier,\n\tConstructorIdentifier,\n\tAwaitIdentifier,\n\tAsyncIdentifier,\n\tNameIdentifier,\n\tPrivateNameIdentifier\n}\n\nexport enum FunctionBodyType {\n\tEXPRESSION,\n\tBLOCK,\n}\n\nexport enum ParseFunctionFlag {\n\tIsNormal = 0,\n\tIsGenerator = 1 << 0,\n\tIsAsync = 1 << 1\n}\n\nexport enum FunctionKind {\n\n\t// BEGIN constructable functions\n\tNormalFunction,\n\tModule,\n\tAsyncModule,\n\t// BEGIN class constructors\n\t// BEGIN base constructors\n\tBaseConstructor,\n\t// BEGIN default constructors\n\tDefaultBaseConstructor,\n\t// END base constructors\n\t// BEGIN derived constructors\n\tDefaultDerivedConstructor,\n\t// END default constructors\n\tDerivedConstructor,\n\t// END derived constructors\n\t// END class constructors\n\t// END constructable functions.\n\t// BEGIN accessors\n\tGetterFunction,\n\tStaticGetterFunction,\n\tSetterFunction,\n\tStaticSetterFunction,\n\t// END accessors\n\t// BEGIN arrow functions\n\tArrowFunction,\n\t// BEGIN async functions\n\tAsyncArrowFunction,\n\t// END arrow functions\n\tAsyncFunction,\n\t// BEGIN concise methods 1\n\tAsyncConciseMethod,\n\tStaticAsyncConciseMethod,\n\t// BEGIN generators\n\tAsyncConciseGeneratorMethod,\n\tStaticAsyncConciseGeneratorMethod,\n\t// END concise methods 1\n\tAsyncGeneratorFunction,\n\t// END async functions\n\tGeneratorFunction,\n\t// BEGIN concise methods 2\n\tConciseGeneratorMethod,\n\tStaticConciseGeneratorMethod,\n\t// END generators\n\tConciseMethod,\n\tStaticConciseMethod,\n\tClassMembersInitializerFunction,\n\tClassStaticInitializerFunction,\n\t// END concise methods 2\n\tInvalid,\n\n\tLastFunctionKind = ClassStaticInitializerFunction,\n}\n\nconst FUNCTIONS_TYPES: FunctionKind[][][] = [\n\t[\n\t\t// SubFunctionKind::kNormalFunction\n\t\t[// is_generator=false\n\t\t\tFunctionKind.NormalFunction,\n\t\t\tFunctionKind.AsyncFunction\n\t\t],\n\t\t[// is_generator=true\n\t\t\tFunctionKind.GeneratorFunction,\n\t\t\tFunctionKind.AsyncGeneratorFunction\n\t\t],\n\t],\n\t[\n\t\t// SubFunctionKind::kNonStaticMethod\n\t\t[// is_generator=false\n\t\t\tFunctionKind.ConciseMethod,\n\t\t\tFunctionKind.AsyncConciseMethod\n\t\t],\n\t\t[// is_generator=true\n\t\t\tFunctionKind.ConciseGeneratorMethod,\n\t\t\tFunctionKind.AsyncConciseGeneratorMethod\n\t\t],\n\t],\n\t[\n\t\t// SubFunctionKind::kStaticMethod\n\t\t[// is_generator=false\n\t\t\tFunctionKind.StaticConciseMethod,\n\t\t\tFunctionKind.StaticAsyncConciseMethod\n\t\t],\n\t\t[// is_generator=true\n\t\t\tFunctionKind.StaticConciseGeneratorMethod,\n\t\t\tFunctionKind.StaticAsyncConciseGeneratorMethod\n\t\t],\n\t]\n];\n\nexport enum SubFunctionKind {\n\tNormalFunction,\n\tNonStaticMethod,\n\tStaticMethod,\n}\n\nexport enum StaticFlag {\n\tNotStatic,\n\tStatic\n};\n\n\nexport function functionKindForImpl(subFunctionKind: SubFunctionKind, flags: ParseFunctionFlag): FunctionKind {\n\treturn FUNCTIONS_TYPES[subFunctionKind]\n\t[(flags & ParseFunctionFlag.IsGenerator) != 0 ? 1 : 0]\n\t[(flags & ParseFunctionFlag.IsAsync) != 0 ? 1 : 0];\n}\n\nexport function functionKindFor(isGenerator: boolean, isAsync: boolean): FunctionKind {\n\treturn FUNCTIONS_TYPES[SubFunctionKind.NormalFunction][isGenerator ? 1 : 0][isAsync ? 1 : 0];\n}\n\nexport function methodKindFor(isStatic: boolean, isGenerator: boolean, isAsync: boolean): FunctionKind {\n\treturn FUNCTIONS_TYPES[isStatic ? SubFunctionKind.StaticMethod : SubFunctionKind.NonStaticMethod][isGenerator ? 1 : 0][isAsync ? 1 : 0];\n}\n\nexport enum FunctionSyntaxKind {\n\tAnonymousExpression,\n\tNamedExpression,\n\tDeclaration,\n\tAccessorOrMethod,\n\tWrapped,\n\n\tLastFunctionSyntaxKind = Wrapped,\n};\n\n\n\nexport function isArrowFunction(kind: FunctionKind) {\n\treturn isInRange(kind, FunctionKind.ArrowFunction, FunctionKind.AsyncArrowFunction);\n}\n\nexport function isModule(kind: FunctionKind) {\n\treturn isInRange(kind, FunctionKind.Module, FunctionKind.AsyncModule);\n}\n\nexport function isAsyncModule(kind: FunctionKind) {\n\treturn kind == FunctionKind.AsyncModule;\n}\n\nexport function isAsyncGeneratorFunction(kind: FunctionKind) {\n\treturn isInRange(kind, FunctionKind.AsyncConciseGeneratorMethod, FunctionKind.AsyncGeneratorFunction);\n}\n\nexport function isGeneratorFunction(kind: FunctionKind) {\n\treturn isInRange(kind, FunctionKind.AsyncConciseGeneratorMethod, FunctionKind.StaticConciseGeneratorMethod);\n}\n\nexport function isAsyncFunction(kind: FunctionKind) {\n\treturn isInRange(kind, FunctionKind.AsyncArrowFunction, FunctionKind.AsyncGeneratorFunction);\n}\n\nexport function isResumableFunction(kind: FunctionKind) {\n\treturn isGeneratorFunction(kind) || isAsyncFunction(kind) || isModule(kind);\n}\n\nexport function isConciseMethod(kind: FunctionKind) {\n\treturn isInRange(kind, FunctionKind.AsyncConciseMethod, FunctionKind.StaticAsyncConciseGeneratorMethod)\n\t\t|| isInRange(kind, FunctionKind.ConciseGeneratorMethod, FunctionKind.ClassStaticInitializerFunction);\n}\n\nexport function isStrictFunctionWithoutPrototype(kind: FunctionKind) {\n\treturn isInRange(kind, FunctionKind.GetterFunction, FunctionKind.AsyncArrowFunction)\n\t\t|| isInRange(kind, FunctionKind.AsyncConciseMethod, FunctionKind.StaticAsyncConciseGeneratorMethod)\n\t\t|| isInRange(kind, FunctionKind.ConciseGeneratorMethod, FunctionKind.ClassStaticInitializerFunction);\n}\n\nexport function isGetterFunction(kind: FunctionKind) {\n\treturn isInRange(kind, FunctionKind.GetterFunction, FunctionKind.StaticGetterFunction);\n}\n\nexport function isSetterFunction(kind: FunctionKind) {\n\treturn isInRange(kind, FunctionKind.SetterFunction, FunctionKind.StaticSetterFunction);\n}\n\nexport function isAccessorFunction(kind: FunctionKind) {\n\treturn isInRange(kind, FunctionKind.GetterFunction, FunctionKind.StaticSetterFunction);\n}\n\nexport function isDefaultConstructor(kind: FunctionKind) {\n\treturn isInRange(kind, FunctionKind.DefaultBaseConstructor, FunctionKind.DefaultDerivedConstructor);\n}\n\nexport function isBaseConstructor(kind: FunctionKind) {\n\treturn isInRange(kind, FunctionKind.BaseConstructor, FunctionKind.DefaultBaseConstructor);\n}\n\nexport function isDerivedConstructor(kind: FunctionKind) {\n\treturn isInRange(kind, FunctionKind.DefaultDerivedConstructor, FunctionKind.DerivedConstructor);\n}\n\nexport function isClassConstructor(kind: FunctionKind) {\n\treturn isInRange(kind, FunctionKind.BaseConstructor, FunctionKind.DerivedConstructor);\n}\n\nexport function isClassMembersInitializerFunction(kind: FunctionKind) {\n\treturn isInRange(kind, FunctionKind.ClassMembersInitializerFunction, FunctionKind.ClassStaticInitializerFunction);\n}\n\nexport function isConstructable(kind: FunctionKind) {\n\treturn isInRange(kind, FunctionKind.NormalFunction, FunctionKind.DerivedConstructor);\n}\n\nexport function isStatic(kind: FunctionKind) {\n\tswitch (kind) {\n\t\tcase FunctionKind.StaticGetterFunction:\n\t\tcase FunctionKind.StaticSetterFunction:\n\t\tcase FunctionKind.StaticConciseMethod:\n\t\tcase FunctionKind.StaticConciseGeneratorMethod:\n\t\tcase FunctionKind.StaticAsyncConciseMethod:\n\t\tcase FunctionKind.StaticAsyncConciseGeneratorMethod:\n\t\tcase FunctionKind.ClassStaticInitializerFunction:\n\t\t\treturn true;\n\t\tdefault:\n\t\t\treturn false;\n\t}\n}\n\nexport function bindsSuper(kind: FunctionKind) {\n\treturn isConciseMethod(kind) || isAccessorFunction(kind) || isClassConstructor(kind);\n}\n\nexport function isAwaitAsIdentifierDisallowed(kind: FunctionKind) {\n\t// 'await' is always disallowed as an identifier in module contexts. Callers\n\t// should short-circuit the module case instead of calling this.\n\treturn !isModule(kind) && (isAsyncFunction(kind) || kind == FunctionKind.ClassStaticInitializerFunction);\n}\n\nexport function functionKind2String(kind: FunctionKind): string {\n\treturn FunctionKind[kind];\n}\n\nexport type ClassInfo = {\n\textends?: ExpressionNode;\n\tpublicMembers: (MethodDefinition | PropertyDefinition)[],\n\tprivateMembers: (MethodDefinition | PropertyDefinition)[],\n\tstaticElements: (MethodDefinition | PropertyDefinition | AccessorProperty | StaticBlock)[],\n\tinstanceFields: (MethodDefinition | PropertyDefinition | AccessorProperty)[],\n\tconstructor: MethodDefinition | undefined,\n\n\thasSeenConstructor: boolean;\n\thasStaticComputedNames: boolean;\n\thasStaticElements: boolean;\n\thasStaticPrivateMethods: boolean;\n\thasStaticBlocks: boolean;\n\thasInstanceMembers: boolean;\n\trequiresBrand: boolean;\n\tisAnonymous: boolean;\n\thasPrivateMethods: boolean,\n\n\tcomputedFieldCount: number;\n\n\thomeObjectVariable?: VariableDeclarator;\n\tstaticHomeObjectVariable?: VariableDeclarator;\n};\n\nexport function createClassInfo(): ClassInfo {\n\treturn {\n\t\tpublicMembers: [],\n\t\tprivateMembers: [],\n\t\tstaticElements: [],\n\t\tinstanceFields: [],\n\t\t'constructor': undefined,\n\n\t\thasSeenConstructor: false,\n\t\thasStaticComputedNames: false,\n\t\thasStaticElements: false,\n\t\thasStaticPrivateMethods: false,\n\t\thasStaticBlocks: false,\n\t\thasInstanceMembers: false,\n\t\trequiresBrand: false,\n\t\tisAnonymous: false,\n\t\thasPrivateMethods: false,\n\n\t\tcomputedFieldCount: 0,\n\t};\n}\n\nexport enum FunctionNameValidity {\n\tFunctionNameIsStrictReserved = 'FunctionNameIsStrictReserved',\n\tSkipFunctionNameCheck = 'SkipFunctionNameCheck',\n\tFunctionNameValidityUnknown = 'FunctionNameValidityUnknown'\n};\n\nexport enum ObjectLiteralPropertyKind {\n\tCONSTANT = 'CONSTANT',\t// Property with constant value (compile time).\n\tCOMPUTED = 'COMPUTED',\t// Property with computed value (execution time).\n\tMATERIALIZED_LITERAL = 'MATERIALIZED_LITERAL', // Property value is a materialized literal.\n\tGETTER = 'GETTER',\n\tSETTER = 'SETTER',\t\t// Property is an accessor function.\n\tPROTOTYPE = 'PROTOTYPE',\t// Property is __proto__.\n\tSPREAD = 'SPREAD'\n}\nexport class ObjectLiteralProperty {\n\tstatic Kind = ObjectLiteralPropertyKind;\n}\n\nexport enum ClassLiteralPropertyKind {\n\tMETHOD = 'METHOD',\n\tGETTER = 'GETTER',\n\tSETTER = 'SETTER',\n\tFIELD = 'FIELD'\n}\n\nexport class ClassLiteralProperty {\n\tstatic Kind = ClassLiteralPropertyKind;\n}\n\nexport function classPropertyKindFor(kind: PropertyKind): ClassLiteralPropertyKind {\n\tswitch (kind) {\n\t\tcase PropertyKind.AccessorGetter:\n\t\t\treturn ClassLiteralPropertyKind.GETTER;\n\t\tcase PropertyKind.AccessorSetter:\n\t\t\treturn ClassLiteralPropertyKind.SETTER;\n\t\tcase PropertyKind.Method:\n\t\t\treturn ClassLiteralPropertyKind.METHOD;\n\t\tcase PropertyKind.ClassField:\n\t\t\treturn ClassLiteralPropertyKind.FIELD;\n\t}\n\tthrow new Error(`unexpected property kind: ${kind}`);\n}\n\nexport enum VariableMode {\n\tConst = 'Const',\n\tPrivateMethod = 'PrivateMethod',\n\tPrivateGetterOnly = 'PrivateGetterOnly',\n\tPrivateSetterOnly = 'PrivateSetterOnly'\n}\n\nexport function getVariableMode(kind: ClassLiteralPropertyKind): VariableMode {\n\tswitch (kind) {\n\t\tcase ClassLiteralPropertyKind.FIELD:\n\t\t\treturn VariableMode.Const;\n\t\tcase ClassLiteralPropertyKind.METHOD:\n\t\t\treturn VariableMode.PrivateMethod;\n\t\tcase ClassLiteralPropertyKind.GETTER:\n\t\t\treturn VariableMode.PrivateGetterOnly;\n\t\tcase ClassLiteralPropertyKind.SETTER:\n\t\t\treturn VariableMode.PrivateSetterOnly;\n\t}\n}\n\nexport enum LanguageMode {\n\tSloppy,\n\tStrict,\n};\n\nexport function isSloppy(mode: LanguageMode) {\n\treturn LanguageMode.Sloppy === mode;\n}\n\nexport function isStrict(mode: LanguageMode) {\n\treturn LanguageMode.Strict === mode;\n}\n\nexport function getLanguageMode(isModule: boolean) {\n\treturn !!isModule ? LanguageMode.Strict : LanguageMode.Sloppy;\n}\n\nexport enum VariableDeclarationContext {\n\tStatementListItem,\n\tStatement,\n\tForStatement\n};\n\nexport enum AllowLabelledFunctionStatement {\n\tAllowLabelledFunctionStatement,\n\tDisallowLabelledFunctionStatement,\n};\n"]}
|
package/v8/inline.d.ts
CHANGED
|
@@ -87,11 +87,47 @@ export declare class JavaScriptInlineParser extends AbstractParser {
|
|
|
87
87
|
static parse(source: string | TokenExpression[] | TokenStream, { mode, acceptIN }?: InlineParserOptions): ExpressionNode;
|
|
88
88
|
constructor(scanner: TokenStream, acceptIN?: boolean);
|
|
89
89
|
scan(): ExpressionNode;
|
|
90
|
+
/**
|
|
91
|
+
* Statement ::
|
|
92
|
+
* Block
|
|
93
|
+
* VariableStatement
|
|
94
|
+
* EmptyStatement
|
|
95
|
+
* ExpressionStatement
|
|
96
|
+
* IfStatement
|
|
97
|
+
* IterationStatement
|
|
98
|
+
* ContinueStatement
|
|
99
|
+
* BreakStatement
|
|
100
|
+
* ReturnStatement
|
|
101
|
+
* WithStatement
|
|
102
|
+
* LabelledStatement
|
|
103
|
+
* SwitchStatement
|
|
104
|
+
* ThrowStatement
|
|
105
|
+
* TryStatement
|
|
106
|
+
* DebuggerStatement
|
|
107
|
+
*/
|
|
90
108
|
protected parseStatement(allowFunction?: AllowLabelledFunctionStatement): ExpressionNode;
|
|
91
109
|
protected parseDebuggerStatement(): DebuggerStatement;
|
|
92
110
|
protected parseTryStatement(): ExpressionNode;
|
|
93
111
|
protected parseNonRestrictedIdentifier(): Identifier;
|
|
94
112
|
protected parseBlock(): BlockStatement;
|
|
113
|
+
/**
|
|
114
|
+
* ECMA 262 6th Edition
|
|
115
|
+
* StatementListItem[Yield, Return] :
|
|
116
|
+
* Statement[?Yield, ?Return]
|
|
117
|
+
* Declaration[?Yield]
|
|
118
|
+
* //
|
|
119
|
+
* Declaration[Yield] :
|
|
120
|
+
* HoistableDeclaration[?Yield]
|
|
121
|
+
* ClassDeclaration[?Yield]
|
|
122
|
+
* LexicalDeclaration[In, ?Yield]
|
|
123
|
+
* //
|
|
124
|
+
* HoistableDeclaration[Yield, Default] :
|
|
125
|
+
* FunctionDeclaration[?Yield, ?Default]
|
|
126
|
+
* GeneratorDeclaration[?Yield, ?Default]
|
|
127
|
+
* //
|
|
128
|
+
* LexicalDeclaration[In, Yield] :
|
|
129
|
+
* LetOrConst BindingList[?In, ?Yield] ;
|
|
130
|
+
*/
|
|
95
131
|
protected parseStatementListItem(): ExpressionNode | undefined;
|
|
96
132
|
protected parseFunctionExpression(): FunctionExpression | FunctionDeclaration;
|
|
97
133
|
protected parseAsyncFunctionDeclaration(names: string[] | undefined, defaultExport: boolean): FunctionDeclaration;
|