@ibyar/expressions 0.8.2-dev.20221008 → 0.8.4

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.
Files changed (172) hide show
  1. package/README.md +0 -3
  2. package/api/abstract.d.ts +6 -5
  3. package/api/abstract.js +15 -12
  4. package/api/abstract.js.map +1 -1
  5. package/api/class/class.d.ts +99 -60
  6. package/api/class/class.js +285 -233
  7. package/api/class/class.js.map +1 -1
  8. package/api/class/decorator.d.ts +2 -4
  9. package/api/class/decorator.js +6 -9
  10. package/api/class/decorator.js.map +1 -1
  11. package/api/computing/call.d.ts +2 -4
  12. package/api/computing/call.js +8 -11
  13. package/api/computing/call.js.map +1 -1
  14. package/api/computing/debugger.d.ts +1 -4
  15. package/api/computing/debugger.js +2 -5
  16. package/api/computing/debugger.js.map +1 -1
  17. package/api/computing/new.d.ts +2 -4
  18. package/api/computing/new.js +7 -10
  19. package/api/computing/new.js.map +1 -1
  20. package/api/computing/rest.d.ts +2 -4
  21. package/api/computing/rest.js +6 -9
  22. package/api/computing/rest.js.map +1 -1
  23. package/api/computing/return.d.ts +2 -4
  24. package/api/computing/return.js +6 -9
  25. package/api/computing/return.js.map +1 -1
  26. package/api/computing/spread.d.ts +2 -4
  27. package/api/computing/spread.js +6 -9
  28. package/api/computing/spread.js.map +1 -1
  29. package/api/computing/throw.d.ts +4 -8
  30. package/api/computing/throw.js +18 -23
  31. package/api/computing/throw.js.map +1 -1
  32. package/api/computing/yield.d.ts +2 -4
  33. package/api/computing/yield.js +7 -10
  34. package/api/computing/yield.js.map +1 -1
  35. package/api/definition/array.d.ts +3 -6
  36. package/api/definition/array.js +14 -18
  37. package/api/definition/array.js.map +1 -1
  38. package/api/definition/bind.d.ts +2 -3
  39. package/api/definition/bind.js +9 -10
  40. package/api/definition/bind.js.map +1 -1
  41. package/api/definition/comment.d.ts +3 -5
  42. package/api/definition/comment.js +6 -7
  43. package/api/definition/comment.js.map +1 -1
  44. package/api/definition/function.d.ts +20 -27
  45. package/api/definition/function.js +92 -110
  46. package/api/definition/function.js.map +1 -1
  47. package/api/definition/member.d.ts +2 -3
  48. package/api/definition/member.js +14 -11
  49. package/api/definition/member.js.map +1 -1
  50. package/api/definition/object.d.ts +5 -9
  51. package/api/definition/object.js +24 -30
  52. package/api/definition/object.js.map +1 -1
  53. package/api/definition/statement.d.ts +2 -4
  54. package/api/definition/statement.js +6 -9
  55. package/api/definition/statement.js.map +1 -1
  56. package/api/definition/values.d.ts +15 -40
  57. package/api/definition/values.js +49 -79
  58. package/api/definition/values.js.map +1 -1
  59. package/api/expression.d.ts +40 -26
  60. package/api/expression.js.map +1 -1
  61. package/api/index.d.ts +1 -0
  62. package/api/index.js +1 -0
  63. package/api/index.js.map +1 -1
  64. package/api/module/common.d.ts +4 -5
  65. package/api/module/common.js +12 -12
  66. package/api/module/common.js.map +1 -1
  67. package/api/module/export.d.ts +5 -10
  68. package/api/module/export.js +35 -38
  69. package/api/module/export.js.map +1 -1
  70. package/api/module/import.d.ts +6 -10
  71. package/api/module/import.js +28 -32
  72. package/api/module/import.js.map +1 -1
  73. package/api/operators/assignment.d.ts +3 -3
  74. package/api/operators/assignment.js +5 -5
  75. package/api/operators/assignment.js.map +1 -1
  76. package/api/operators/await.d.ts +3 -5
  77. package/api/operators/await.js +7 -10
  78. package/api/operators/await.js.map +1 -1
  79. package/api/operators/binary.d.ts +1 -1
  80. package/api/operators/binary.js +1 -1
  81. package/api/operators/binary.js.map +1 -1
  82. package/api/operators/chaining.d.ts +2 -3
  83. package/api/operators/chaining.js +6 -7
  84. package/api/operators/chaining.js.map +1 -1
  85. package/api/operators/comma.d.ts +2 -4
  86. package/api/operators/comma.js +6 -9
  87. package/api/operators/comma.js.map +1 -1
  88. package/api/operators/grouping.d.ts +2 -4
  89. package/api/operators/grouping.js +6 -9
  90. package/api/operators/grouping.js.map +1 -1
  91. package/api/operators/logical.d.ts +1 -1
  92. package/api/operators/logical.js +1 -1
  93. package/api/operators/logical.js.map +1 -1
  94. package/api/operators/pipeline.d.ts +2 -4
  95. package/api/operators/pipeline.js +8 -15
  96. package/api/operators/pipeline.js.map +1 -1
  97. package/api/operators/ternary.d.ts +2 -4
  98. package/api/operators/ternary.js +8 -13
  99. package/api/operators/ternary.js.map +1 -1
  100. package/api/operators/types.d.ts +1 -1
  101. package/api/operators/unary.d.ts +3 -5
  102. package/api/operators/unary.js +7 -10
  103. package/api/operators/unary.js.map +1 -1
  104. package/api/operators/update.d.ts +3 -5
  105. package/api/operators/update.js +8 -11
  106. package/api/operators/update.js.map +1 -1
  107. package/api/program.d.ts +3 -5
  108. package/api/program.js +7 -8
  109. package/api/program.js.map +1 -1
  110. package/api/statement/control/block.d.ts +2 -4
  111. package/api/statement/control/block.js +9 -14
  112. package/api/statement/control/block.js.map +1 -1
  113. package/api/statement/control/empty.d.ts +2 -5
  114. package/api/statement/control/empty.js +6 -8
  115. package/api/statement/control/empty.js.map +1 -1
  116. package/api/statement/control/if.d.ts +2 -4
  117. package/api/statement/control/if.js +8 -13
  118. package/api/statement/control/if.js.map +1 -1
  119. package/api/statement/control/switch.d.ts +4 -9
  120. package/api/statement/control/switch.js +19 -28
  121. package/api/statement/control/switch.js.map +1 -1
  122. package/api/statement/control/terminate.d.ts +4 -7
  123. package/api/statement/control/terminate.js +11 -19
  124. package/api/statement/control/terminate.js.map +1 -1
  125. package/api/statement/control/with.d.ts +21 -0
  126. package/api/statement/control/with.js +67 -0
  127. package/api/statement/control/with.js.map +1 -0
  128. package/api/statement/declarations/declares.d.ts +4 -7
  129. package/api/statement/declarations/declares.js +14 -20
  130. package/api/statement/declarations/declares.js.map +1 -1
  131. package/api/statement/iterations/for.d.ts +6 -11
  132. package/api/statement/iterations/for.js +35 -53
  133. package/api/statement/iterations/for.js.map +1 -1
  134. package/api/statement/iterations/while.d.ts +3 -6
  135. package/api/statement/iterations/while.js +14 -22
  136. package/api/statement/iterations/while.js.map +1 -1
  137. package/package.json +14 -4
  138. package/scope/finalizer.d.ts +1 -1
  139. package/scope/pool.d.ts +1 -1
  140. package/scope/proxy.d.ts +1 -1
  141. package/scope/proxy.js +1 -0
  142. package/scope/proxy.js.map +1 -1
  143. package/scope/scope.d.ts +8 -24
  144. package/scope/scope.js +25 -75
  145. package/scope/scope.js.map +1 -1
  146. package/scope/stack.d.ts +15 -3
  147. package/scope/stack.js +49 -32
  148. package/scope/stack.js.map +1 -1
  149. package/v8/enums.d.ts +4 -2
  150. package/v8/enums.js.map +1 -1
  151. package/v8/factory.d.ts +148 -0
  152. package/v8/factory.js +499 -0
  153. package/v8/factory.js.map +1 -0
  154. package/v8/inline.d.ts +50 -48
  155. package/v8/inline.js +322 -300
  156. package/v8/inline.js.map +1 -1
  157. package/v8/node.d.ts +141 -0
  158. package/v8/node.js +2 -0
  159. package/v8/node.js.map +1 -0
  160. package/v8/nodes.d.ts +0 -14
  161. package/v8/nodes.js +1 -152
  162. package/v8/nodes.js.map +1 -1
  163. package/v8/parser.d.ts +21 -18
  164. package/v8/parser.js +97 -84
  165. package/v8/parser.js.map +1 -1
  166. package/v8/stream.d.ts +2 -1
  167. package/v8/stream.js +221 -311
  168. package/v8/stream.js.map +1 -1
  169. package/v8/token.d.ts +3 -1
  170. package/v8/token.js +7 -5
  171. package/v8/token.js.map +1 -1
  172. package/visit/visitor.d.ts +1 -1
package/scope/stack.js CHANGED
@@ -1,11 +1,31 @@
1
+ import { LanguageMode } from '../v8/language.js';
2
+ import { JavaScriptParser } from '../v8/parser.js';
1
3
  import { finalizerRegister } from './finalizer.js';
2
4
  import { ModuleScope, ReactiveScope, ReactiveScopeControl, Scope, WebModuleScope } from './scope.js';
3
5
  export class Stack {
6
+ static for(...contexts) {
7
+ if (contexts.length === 0) {
8
+ return new Stack();
9
+ }
10
+ return new Stack(contexts.map(context => new Scope(context)));
11
+ }
12
+ static forScopes(...scopes) {
13
+ if (scopes.length === 0) {
14
+ scopes.push(Scope.blockScope());
15
+ }
16
+ return new Stack(scopes);
17
+ }
18
+ static moduleScope(resolver, moduleSource, ...globalScopes) {
19
+ return new Stack(globalScopes, resolver, moduleSource);
20
+ }
4
21
  constructor(globals, resolver, moduleSource) {
5
22
  this.awaitPromise = [];
6
23
  this.onDestroyActions = [];
7
24
  if (Array.isArray(globals)) {
8
- this.stack = globals;
25
+ this.stack = globals.slice();
26
+ }
27
+ else if (globals instanceof Stack) {
28
+ this.stack = globals.stack.slice();
9
29
  }
10
30
  else if (typeof globals == 'object') {
11
31
  this.stack = [globals];
@@ -28,24 +48,13 @@ export class Stack {
28
48
  }
29
49
  finalizerRegister(this, this.onDestroyActions, this);
30
50
  }
31
- static for(...contexts) {
32
- if (contexts.length === 0) {
33
- return new Stack();
34
- }
35
- return new Stack(contexts.map(context => new Scope(context)));
36
- }
37
- static forScopes(...scopes) {
38
- if (scopes.length === 0) {
39
- scopes.push(Scope.blockScope());
40
- }
41
- return new Stack(scopes);
42
- }
43
- static moduleScope(resolver, moduleSource, ...globalScopes) {
44
- return new Stack(globalScopes, resolver, moduleSource);
45
- }
46
51
  initModuleContext() {
47
52
  const importFunc = (path) => {
48
- return this.importModule(path);
53
+ const module = this.importModule(path);
54
+ if (module instanceof WebModuleScope) {
55
+ return module.resolveImport();
56
+ }
57
+ return Promise.resolve(module.getContext());
49
58
  };
50
59
  importFunc.meta = {
51
60
  url: createRootURL(this.moduleSource),
@@ -91,23 +100,23 @@ export class Stack {
91
100
  pushScope(scope) {
92
101
  this.stack.push(scope);
93
102
  }
94
- pushBlockScope() {
95
- const scope = Scope.blockScope();
103
+ pushBlockScope(propertyKeys) {
104
+ const scope = Scope.blockScope(propertyKeys);
96
105
  this.stack.push(scope);
97
106
  return scope;
98
107
  }
99
- pushBlockScopeFor(context) {
100
- const scope = Scope.for(context);
108
+ pushBlockScopeFor(context, propertyKeys) {
109
+ const scope = Scope.for(context, propertyKeys);
101
110
  this.stack.push(scope);
102
111
  return scope;
103
112
  }
104
- pushReactiveScope() {
105
- const scope = ReactiveScope.blockScope();
113
+ pushReactiveScope(propertyKeys) {
114
+ const scope = ReactiveScope.blockScope(propertyKeys);
106
115
  this.stack.push(scope);
107
116
  return scope;
108
117
  }
109
- pushReactiveScopeFor(context) {
110
- const scope = ReactiveScope.for(context);
118
+ pushReactiveScopeFor(context, propertyKeys) {
119
+ const scope = ReactiveScope.for(context, propertyKeys);
111
120
  this.stack.push(scope);
112
121
  return scope;
113
122
  }
@@ -168,7 +177,9 @@ export function createRootURL(source) {
168
177
  }
169
178
  ;
170
179
  export class ModuleScopeResolver {
171
- constructor(config) {
180
+ constructor(globalStack, provider, config) {
181
+ this.globalStack = globalStack;
182
+ this.provider = provider;
172
183
  this.config = config;
173
184
  this.modules = [];
174
185
  this.isValidHTTPUrl = (string) => {
@@ -217,6 +228,17 @@ export class ModuleScopeResolver {
217
228
  }
218
229
  const importedScope = this.modules.find(tuple => tuple[0] == source)?.[1];
219
230
  if (!importedScope) {
231
+ // search in the file system provider
232
+ const javascriptSource = this.provider[source];
233
+ if (javascriptSource || javascriptSource == '') {
234
+ // module exists
235
+ const moduleProgram = JavaScriptParser.parse(javascriptSource, { mode: LanguageMode.Strict });
236
+ const stack = new Stack(this.globalStack, this, source);
237
+ // register with absoluteUrl
238
+ this.register(source, stack.getModule());
239
+ moduleProgram.get(stack);
240
+ return stack.getModule();
241
+ }
220
242
  throw new Error(`Can't find module scope`);
221
243
  }
222
244
  return importedScope;
@@ -232,13 +254,8 @@ export class ModuleScopeResolver {
232
254
  if (!this.config?.allowImportExternal) {
233
255
  throw new Error(`Error: Import External Module is not allowed.`);
234
256
  }
235
- const webScope = new WebModuleScope();
257
+ const webScope = new WebModuleScope(source, importCallOptions);
236
258
  this.modules.push([source, webScope]);
237
- // active later
238
- // import(source, importCallOptions)
239
- import(source).then(module => {
240
- webScope.updateContext(module);
241
- });
242
259
  return webScope;
243
260
  }
244
261
  }
@@ -1 +1 @@
1
- {"version":3,"file":"stack.js","sourceRoot":"","sources":["../../../src/expressions/scope/stack.ts"],"names":[],"mappings":"AACA,OAA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EAAE,CAAC,CAAC,CAAC,CAAC;QAC1E,IAAI,CAAC,aAAa,EAAE;YACnB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;SAC3C;QACD,OAAO,aAAa,CAAC;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"]}
1
+ {"version":3,"file":"stack.js","sourceRoot":"","sources":["../../../src/expressions/scope/stack.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EACuB,WAAW,EAAE,aAAa,EACvD,oBAAoB,EAAE,KAAK,EAAW,cAAc,EACpD,MAAM,YAAY,CAAC;AAyIpB,MAAM,OAAO,KAAK;IACjB,MAAM,CAAC,GAAG,CAAC,GAAG,QAA0B;QACvC,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;YAC1B,OAAO,IAAI,KAAK,EAAE,CAAC;SACnB;QACD,OAAO,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,KAAK,CAAU,OAAO,CAAC,CAAC,CAAC,CAAC;IACxE,CAAC;IACD,MAAM,CAAC,SAAS,CAAC,GAAG,MAAwB;QAC3C,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;YACxB,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC;SAChC;QACD,OAAO,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC;IAC1B,C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Content":["import type { DeclarationExpression } from '../api/expression.js';\nimport { LanguageMode } from '../v8/language.js';\nimport { JavaScriptParser } from '../v8/parser.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(stack: Stack);\n\tconstructor(stack: Stack, resolver: ModuleScopeResolver, moduleSource: string);\n\n\tconstructor(globals?: Stack | Array<Scope<Context>> | Scope<Context>, resolver?: ModuleScopeResolver, moduleSource?: string) {\n\t\tif (Array.isArray(globals)) {\n\t\t\tthis.stack = globals.slice();\n\t\t} else if (globals instanceof Stack) {\n\t\t\tthis.stack = globals.stack.slice();\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\tconst module = this.importModule(path);\n\t\t\tif (module instanceof WebModuleScope) {\n\t\t\t\treturn module.resolveImport();\n\t\t\t}\n\t\t\treturn Promise.resolve(module.getContext());\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>(propertyKeys?: (keyof T)[]): Scope<T> {\n\t\tconst scope = Scope.blockScope<T>(propertyKeys);\n\t\tthis.stack.push(scope);\n\t\treturn scope;\n\t}\n\tpushBlockScopeFor<T extends Context>(context: T, propertyKeys?: (keyof T)[]): Scope<T> {\n\t\tconst scope = Scope.for<T>(context, propertyKeys);\n\t\tthis.stack.push(scope);\n\t\treturn scope;\n\t}\n\tpushReactiveScope<T extends Context>(propertyKeys?: (keyof T)[]): ReactiveScope<T> {\n\t\tconst scope = ReactiveScope.blockScope<T>(propertyKeys);\n\t\tthis.stack.push(scope);\n\t\treturn scope;\n\t}\n\tpushReactiveScopeFor<T extends Context>(context: T, propertyKeys?: (keyof T)[]): ReactiveScope<T> {\n\t\tconst scope = ReactiveScope.for(context, propertyKeys);\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 * allow import modules from external http(s) module\n\t */\n\tallowImportExternal?: boolean;\n\n};\n\n/**\n * file system provider\n */\nexport interface ModuleSourceProvider {\n\t[url: string]: string;\n}\n\nexport class ModuleScopeResolver implements ModuleScopeResolver {\n\tprotected modules: [string, ModuleScope][] = [];\n\n\tconstructor(protected globalStack: Stack, protected provider: ModuleSourceProvider, protected config?: ResolverConfig) { }\n\tprivate register(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: keyof ModuleSourceProvider): ModuleScope;\n\tresolve(source: keyof ModuleSourceProvider, moduleScope: ModuleScope, importCallOptions?: ImportCallOptions): ModuleScope;\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\t// search in the file system provider\n\t\t\tconst javascriptSource = this.provider[source];\n\t\t\tif (javascriptSource || javascriptSource == '') {\n\t\t\t\t// module exists\n\t\t\t\tconst moduleProgram = JavaScriptParser.parse(javascriptSource, { mode: LanguageMode.Strict });\n\t\t\t\tconst stack = new Stack(this.globalStack, this, source);\n\t\t\t\t// register with absoluteUrl\n\t\t\t\tthis.register(source, stack.getModule()!);\n\t\t\t\tmoduleProgram.get(stack);\n\t\t\t\treturn stack.getModule()!;\n\t\t\t}\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(source, importCallOptions);\n\t\tthis.modules.push([source, webScope]);\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.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { AccessorProperty, MethodDefinition, PropertyDefinition, StaticBlock } from '../api/class/class.js';
2
2
  import { ExpressionNode } from '../api/expression.js';
3
3
  import { VariableDeclarator } from '../api/statement/declarations/declares.js';
4
+ import { PositionMark } from './inline.js';
4
5
  import { Token } from './token.js';
5
6
  export declare function isInRange(num: number, start: number, end: number): boolean;
6
7
  export declare enum ParsingArrowHeadFlag {
@@ -34,9 +35,10 @@ export declare class PropertyKindInfo {
34
35
  isPrivate: boolean;
35
36
  isStatic: boolean;
36
37
  isRest: boolean;
38
+ rangeStart: PositionMark;
37
39
  parsePropertyKindFromToken(token: Token): boolean;
38
40
  }
39
- export declare type FunctionInfo = {
41
+ export type FunctionInfo = {
40
42
  rest?: boolean;
41
43
  };
42
44
  export declare enum PreParserIdentifierType {
@@ -131,7 +133,7 @@ export declare function isStatic(kind: FunctionKind): boolean;
131
133
  export declare function bindsSuper(kind: FunctionKind): boolean;
132
134
  export declare function isAwaitAsIdentifierDisallowed(kind: FunctionKind): boolean;
133
135
  export declare function functionKind2String(kind: FunctionKind): string;
134
- export declare type ClassInfo = {
136
+ export type ClassInfo = {
135
137
  extends?: ExpressionNode;
136
138
  publicMembers: (MethodDefinition | PropertyDefinition)[];
137
139
  privateMembers: (MethodDefinition | PropertyDefinition)[];
package/v8/enums.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"enums.js","sourceRoot":"","sources":["../../../src/expressions/v8/enums.ts"],"names":[],"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AC3B,KAAK,wBAAwB,CAAC,MAAM;YACnC,OAAO,YAAY,CAAC,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,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 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":"AAIA,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,C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A;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 { PositionMark } from './inline.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\trangeStart: PositionMark;\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 VariableDeclarationContext {\n\tStatementListItem,\n\tStatement,\n\tForStatement\n};\n\nexport enum AllowLabelledFunctionStatement {\n\tAllowLabelledFunctionStatement,\n\tDisallowLabelledFunctionStatement,\n};\n"]}
@@ -0,0 +1,148 @@
1
+ import { AccessorProperty, ClassBody, ClassDeclaration, ClassExpression, MetaProperty, MethodDefinition, MethodDefinitionKind, PrivateIdentifier, PropertyDefinition, StaticBlock, Super } from '../api/class/class.js';
2
+ import { Decorator } from '../api/class/decorator.js';
3
+ import { CallExpression } from '../api/computing/call.js';
4
+ import { DebuggerStatement } from '../api/computing/debugger.js';
5
+ import { NewExpression } from '../api/computing/new.js';
6
+ import { RestElement } from '../api/computing/rest.js';
7
+ import { ReturnStatement } from '../api/computing/return.js';
8
+ import { SpreadElement } from '../api/computing/spread.js';
9
+ import { CatchClauseNode, ThrowStatement, TryCatchNode } from '../api/computing/throw.js';
10
+ import { YieldExpression } from '../api/computing/yield.js';
11
+ import { ArrayExpression, ArrayPattern } from '../api/definition/array.js';
12
+ import { BindExpression } from '../api/definition/bind.js';
13
+ import { ArrowFunctionExpression, AssignmentPattern, FunctionDeclaration, FunctionExpression } from '../api/definition/function.js';
14
+ import { MemberExpression } from '../api/definition/member.js';
15
+ import { ObjectExpression, ObjectPattern, Property } from '../api/definition/object.js';
16
+ import { Identifier, Literal, TaggedTemplateExpression, TemplateLiteral, ThisExpression } from '../api/definition/values.js';
17
+ import { DeclarationExpression, ExpressionNode, SourceLocation } from '../api/expression.js';
18
+ import { ImportAttribute } from '../api/module/common.js';
19
+ import { ExportAllDeclaration, ExportDefaultDeclaration, ExportNamedDeclaration, ExportSpecifier } from '../api/module/export.js';
20
+ import { ImportDeclaration, ImportDefaultSpecifier, ImportExpression, ImportNamespaceSpecifier, ImportSpecifier } from '../api/module/import.js';
21
+ import { AssignmentExpression, AssignmentOperator } from '../api/operators/assignment.js';
22
+ import { AwaitExpression } from '../api/operators/await.js';
23
+ import { BinaryExpression, BinaryOperator } from '../api/operators/binary.js';
24
+ import { ChainExpression } from '../api/operators/chaining.js';
25
+ import { SequenceExpression } from '../api/operators/comma.js';
26
+ import { GroupingExpression } from '../api/operators/grouping.js';
27
+ import { LogicalExpression, LogicalOperator } from '../api/operators/logical.js';
28
+ import { PipelineExpression } from '../api/operators/pipeline.js';
29
+ import { ConditionalExpression } from '../api/operators/ternary.js';
30
+ import { UnaryExpression, UnaryOperator } from '../api/operators/unary.js';
31
+ import { UpdateExpression, UpdateOperator } from '../api/operators/update.js';
32
+ import { Program, ProgramSourceType } from '../api/program.js';
33
+ import { BlockStatement } from '../api/statement/control/block.js';
34
+ import { EmptyStatement } from '../api/statement/control/empty.js';
35
+ import { IfStatement } from '../api/statement/control/if.js';
36
+ import { DefaultExpression, SwitchCase, SwitchStatement } from '../api/statement/control/switch.js';
37
+ import { BreakStatement, ContinueStatement, LabeledStatement } from '../api/statement/control/terminate.js';
38
+ import { WithStatement } from '../api/statement/control/with.js';
39
+ import { VariableDeclarationNode, VariableDeclarator } from '../api/statement/declarations/declares.js';
40
+ import { ForAwaitOfNode, ForDeclaration, ForInNode, ForNode, ForOfNode } from '../api/statement/iterations/for.js';
41
+ import { DoWhileNode, WhileNode } from '../api/statement/iterations/while.js';
42
+ import type { NodeFactory, SourcePositionFactory } from './node.js';
43
+ export declare class ExpressionNodeSourcePosition implements SourcePositionFactory {
44
+ private source;
45
+ private newLineRegex;
46
+ constructor(source: string);
47
+ private getLineNumber;
48
+ private getColumnNumber;
49
+ createSourcePosition(range?: [number, number]): SourceLocation | undefined;
50
+ }
51
+ export declare class ExpressionNodeFactory implements NodeFactory {
52
+ private rangeFactory?;
53
+ constructor(rangeFactory?: SourcePositionFactory | undefined);
54
+ createDebuggerStatement(range?: [number, number]): DebuggerStatement;
55
+ createSuper(range?: [number, number]): Super;
56
+ createThis(range?: [number, number]): ThisExpression;
57
+ createNull(range?: [number, number]): Literal<null>;
58
+ createTrue(range?: [number, number]): Literal<true>;
59
+ createFalse(range?: [number, number]): Literal<false>;
60
+ createVoidZero(argument: ExpressionNode, range?: [number, number]): UnaryExpression;
61
+ createEmptyStatement(range?: [number, number]): EmptyStatement;
62
+ createExpressionStatement(list: ExpressionNode[], range?: [number, number]): ExpressionNode;
63
+ createCatchClause(block: BlockStatement, identifier?: ExpressionNode, range?: [number, number]): CatchClauseNode;
64
+ createTryStatement(tryBlock: BlockStatement, catchBlock?: ExpressionNode, finallyBlock?: ExpressionNode, range?: [number, number]): TryCatchNode;
65
+ createThrowStatement(exception: ExpressionNode, range?: [number, number]): ThrowStatement;
66
+ createBlock(statements: ExpressionNode[], range?: [number, number]): BlockStatement;
67
+ createIfStatement(condition: ExpressionNode, thenStatement: ExpressionNode, elseStatement?: ExpressionNode, range?: [number, number]): IfStatement;
68
+ createDoStatement(condition: ExpressionNode, body: ExpressionNode, range?: [number, number] | undefined): DoWhileNode;
69
+ createClassDeclaration(body: ClassBody, decorators: Decorator[], id: Identifier, superClass?: ExpressionNode, range?: [number, number]): ClassDeclaration;
70
+ createFunctionDeclaration(formals: DeclarationExpression[], bodyBlock: BlockStatement, isAsync: boolean, isGenerator: boolean, name: Identifier, range?: [number, number]): FunctionDeclaration;
71
+ createFunctionExpression(formals: DeclarationExpression[], bodyBlock: BlockStatement, isAsync: boolean, isGenerator: boolean, range?: [number, number]): FunctionExpression;
72
+ createWhileStatement(condition: ExpressionNode, body: ExpressionNode, range?: [number, number] | undefined): WhileNode;
73
+ createSwitchStatement(tag: ExpressionNode, cases: SwitchCase[], range?: [number, number] | undefined): SwitchStatement;
74
+ createCaseBlock(test: ExpressionNode, block: BlockStatement, range?: [number, number] | undefined): SwitchCase;
75
+ createDefaultClause(block: BlockStatement, range?: [number, number] | undefined): DefaultExpression;
76
+ createWithStatement(object: ExpressionNode, body: ExpressionNode, range?: [number, number]): WithStatement;
77
+ createForStatement(body: ExpressionNode, initializer: ExpressionNode, cond: ExpressionNode, next: ExpressionNode, range?: [number, number] | undefined): ForNode;
78
+ createForOfStatement(initializer: ForDeclaration, enumerable: ExpressionNode, body: ExpressionNode, range?: [number, number] | undefined): ForOfNode;
79
+ createForAwaitOfStatement(left: ForDeclaration, right: ExpressionNode, body: ExpressionNode, range?: [number, number] | undefined): ForAwaitOfNode;
80
+ createForInStatement(initializer: ForDeclaration, enumerable: ExpressionNode, body: ExpressionNode, range?: [number, number]): ForInNode;
81
+ createVariableDeclaration(id: DeclarationExpression, init?: ExpressionNode, range?: [number, number]): VariableDeclarator;
82
+ createVariableStatement(variables: VariableDeclarator[], kind: 'let' | 'var' | 'const', range?: [number, number]): VariableDeclarationNode;
83
+ createContinueStatement(label?: Identifier, range?: [number, number]): ContinueStatement;
84
+ createBreakStatement(label?: Identifier, range?: [number, number]): BreakStatement;
85
+ createReturnStatement(argument?: ExpressionNode, range?: [number, number]): ReturnStatement;
86
+ createLabeledStatement(expression: Identifier, result: ExpressionNode, range?: [number, number]): LabeledStatement;
87
+ createAssignmentPattern(left: DeclarationExpression, right: ExpressionNode, range?: [number, number]): AssignmentPattern;
88
+ createSpreadElement(argument: ExpressionNode, range?: [number, number]): SpreadElement;
89
+ createCommaListExpression(expressions: ExpressionNode[], range?: [number, number] | undefined): SequenceExpression;
90
+ createTemplateExpression(quasis: string[], expressions: ExpressionNode[], range?: [number, number]): TemplateLiteral;
91
+ createTaggedTemplateExpression(tag: ExpressionNode, quasis: string[], expressions: ExpressionNode[], range?: [number, number]): TaggedTemplateExpression;
92
+ createNewExpression(className: ExpressionNode, parameters?: ExpressionNode[], range?: [number, number]): NewExpression;
93
+ createObjectBindingPattern(properties: (Property | RestElement)[], range?: [number, number] | undefined): ObjectPattern;
94
+ createObjectLiteralExpression(properties: Property[], range?: [number, number]): ObjectExpression;
95
+ createArrayBindingPattern(elements: (DeclarationExpression | null)[], range?: [number, number]): ArrayPattern;
96
+ createArrayLiteralExpression(elements: (ExpressionNode | SpreadElement | null)[], range?: [number, number]): ArrayExpression;
97
+ createAssignment(operator: AssignmentOperator, left: ExpressionNode, right: ExpressionNode, range?: [number, number]): AssignmentExpression;
98
+ createRestElement(argument: DeclarationExpression, range?: [number, number]): RestElement;
99
+ createArrowFunction(params: DeclarationExpression[], body: ExpressionNode | ExpressionNode[], expression: boolean, async: boolean, range?: [number, number]): ArrowFunctionExpression;
100
+ createPropertyDeclaration(key: ExpressionNode, value: DeclarationExpression | ExpressionNode, kind: 'init' | 'get' | 'set', method: boolean, shorthand: boolean, computed: boolean, range?: [number, number]): Property;
101
+ createIdentifier(name: string, range?: [number, number]): Identifier;
102
+ createPropertyAssignment(object: ExpressionNode, property: ExpressionNode, computed: boolean, optional?: boolean, range?: [number, number]): MemberExpression;
103
+ createPipelineExpression(left: ExpressionNode, right: ExpressionNode, params?: (ExpressionNode | '?' | '...?')[], range?: [number, number]): PipelineExpression;
104
+ createCallExpression(callee: ExpressionNode, params: ExpressionNode[], optional?: boolean, range?: [number, number]): CallExpression;
105
+ createBindExpression(object: ExpressionNode, property: ExpressionNode, computed: boolean, optional?: boolean, range?: [number, number]): BindExpression;
106
+ createChainExpression(expression: ExpressionNode, range?: [number, number]): ChainExpression;
107
+ createLogicalExpression(operator: LogicalOperator, left: ExpressionNode, right: ExpressionNode, range?: [number, number]): LogicalExpression;
108
+ createConditionalExpression(test: ExpressionNode, alternate: ExpressionNode, consequent: ExpressionNode, range?: [number, number]): ConditionalExpression;
109
+ createYieldExpression(delegate: boolean, argument?: ExpressionNode, range?: [number, number]): YieldExpression;
110
+ createMetaProperty(meta: Identifier, property: Identifier, range?: [number, number]): MetaProperty;
111
+ createProgram(sourceType: ProgramSourceType, body: ExpressionNode[], range?: [number, number]): Program;
112
+ createClassExpression(body: ClassBody, decorators: Decorator[], id?: Identifier, superClass?: ExpressionNode, range?: [number, number]): ClassExpression;
113
+ createClassStaticBlockDeclaration(body: ExpressionNode[], range?: [number, number]): StaticBlock;
114
+ createMethodSignature(kind: MethodDefinitionKind, key: ExpressionNode | PrivateIdentifier, value: FunctionExpression, decorators: Decorator[], computed: boolean, isStatic: boolean, range?: [number, number]): MethodDefinition;
115
+ createPropertySignature(key: ExpressionNode | PrivateIdentifier, decorators: Decorator[], computed: boolean, isStatic: boolean, value?: ExpressionNode, range?: [number, number]): PropertyDefinition;
116
+ createClassBody(body: (MethodDefinition | PropertyDefinition | AccessorProperty | StaticBlock)[], range?: [number, number]): ClassBody;
117
+ createNamespaceExportDeclaration(specifiers: ExportSpecifier[], declaration?: DeclarationExpression, source?: Literal<string>, assertions?: ImportAttribute[], range?: [number, number]): ExportNamedDeclaration;
118
+ createExportSpecifier(local: Identifier, exported: Identifier, range?: [number, number]): ExportSpecifier;
119
+ createImportSpecifier(local: Identifier, imported: Identifier, range?: [number, number]): ImportSpecifier;
120
+ createImportDeclaration(source: Literal<string>, specifiers?: (ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier)[], assertions?: ImportAttribute[], range?: [number, number]): ImportDeclaration;
121
+ createImportNamespaceSpecifier(local: Identifier, range?: [number, number]): ImportNamespaceSpecifier;
122
+ createImportDefaultSpecifier(local: Identifier, range?: [number, number]): ImportDefaultSpecifier;
123
+ createImportExpression(source: Literal<string>, attributes?: ExpressionNode, range?: [number, number]): ImportExpression;
124
+ createAssertEntry(key: Identifier | Literal<string>, value: Literal<string>, range?: [number, number]): ImportAttribute;
125
+ createExportDefault(declaration: FunctionDeclaration | ClassDeclaration | ExpressionNode, range?: [number, number]): ExportDefaultDeclaration;
126
+ createExportAllDeclaration(source: Literal<string>, exported?: Identifier, assertions?: ImportAttribute[], range?: [number, number]): ExportAllDeclaration;
127
+ createInfixExpression(op: AssignmentOperator | LogicalOperator | BinaryOperator, left: ExpressionNode, right: ExpressionNode, range?: [number, number]): AssignmentExpression | LogicalExpression | BinaryExpression;
128
+ createUnaryExpression(operator: UpdateOperator | UnaryOperator | 'await', expression: ExpressionNode, range?: [number, number]): UpdateExpression | UnaryExpression | AwaitExpression;
129
+ createUpdateExpression(operator: UpdateOperator, argument: ExpressionNode, prefix: boolean, range?: [number, number]): UpdateExpression;
130
+ createAwaitExpression(argument: ExpressionNode, range?: [number, number]): AwaitExpression;
131
+ isIdentifier(node?: ExpressionNode): node is Identifier;
132
+ isObjectExpression(node?: ExpressionNode): node is ObjectExpression;
133
+ isArrayExpression(node?: ExpressionNode): node is ArrayExpression;
134
+ isObjectPattern(node?: ExpressionNode): node is ObjectPattern;
135
+ isArrayPattern(node?: ExpressionNode): node is ArrayPattern;
136
+ isAssignmentPattern(node?: ExpressionNode): node is AssignmentPattern;
137
+ isPattern(node?: ExpressionNode): boolean;
138
+ canBePattern(node?: ExpressionNode): node is (ObjectExpression | ArrayExpression);
139
+ isProperty(node?: ExpressionNode): node is Property;
140
+ isMemberExpression(node?: ExpressionNode): node is MemberExpression;
141
+ isPropertyOrMemberExpression(node?: ExpressionNode): node is (Property | MemberExpression);
142
+ isEmptyStatement(node: ExpressionNode): node is EmptyStatement;
143
+ isSequenceExpression(node: ExpressionNode): node is SequenceExpression;
144
+ isSuper(node: ExpressionNode): node is Super;
145
+ isAssignmentExpression(node: ExpressionNode): node is AssignmentExpression;
146
+ isGroupingExpression(node: ExpressionNode): node is GroupingExpression;
147
+ isSpreadElement(node: ExpressionNode): node is SpreadElement;
148
+ }