@idlizer/core 2.1.9-arktscgen-8 → 2.1.10-arktscgen-2

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 (51) hide show
  1. package/build/lib/src/IndentedPrinter.d.ts +2 -1
  2. package/build/lib/src/IndentedPrinter.js +9 -2
  3. package/build/lib/src/LanguageWriters/ArgConvertors.d.ts +35 -26
  4. package/build/lib/src/LanguageWriters/ArgConvertors.js +152 -117
  5. package/build/lib/src/LanguageWriters/LanguageWriter.d.ts +5 -4
  6. package/build/lib/src/LanguageWriters/LanguageWriter.js +16 -15
  7. package/build/lib/src/LanguageWriters/convertors/TSConvertors.js +1 -1
  8. package/build/lib/src/LanguageWriters/writers/CJLanguageWriter.d.ts +1 -1
  9. package/build/lib/src/LanguageWriters/writers/CJLanguageWriter.js +6 -6
  10. package/build/lib/src/LanguageWriters/writers/CppLanguageWriter.d.ts +1 -1
  11. package/build/lib/src/LanguageWriters/writers/CppLanguageWriter.js +6 -6
  12. package/build/lib/src/LanguageWriters/writers/ETSLanguageWriter.d.ts +8 -1
  13. package/build/lib/src/LanguageWriters/writers/ETSLanguageWriter.js +28 -8
  14. package/build/lib/src/LanguageWriters/writers/JavaLanguageWriter.d.ts +1 -1
  15. package/build/lib/src/LanguageWriters/writers/JavaLanguageWriter.js +8 -8
  16. package/build/lib/src/LanguageWriters/writers/KotlinLanguageWriter.d.ts +1 -1
  17. package/build/lib/src/LanguageWriters/writers/KotlinLanguageWriter.js +6 -6
  18. package/build/lib/src/LanguageWriters/writers/TsLanguageWriter.d.ts +1 -1
  19. package/build/lib/src/LanguageWriters/writers/TsLanguageWriter.js +7 -7
  20. package/build/lib/src/config.d.ts +132 -132
  21. package/build/lib/src/config.js +4 -4
  22. package/build/lib/src/configDescriber.js +1 -1
  23. package/build/lib/src/diagnosticmessages.d.ts +18 -12
  24. package/build/lib/src/diagnosticmessages.js +22 -14
  25. package/build/lib/src/diagnostictypes.d.ts +3 -9
  26. package/build/lib/src/formatter.d.ts +2 -1
  27. package/build/lib/src/formatter.js +3 -3
  28. package/build/lib/src/from-idl/deserialize.js +138 -6
  29. package/build/lib/src/from-idl/parser.d.ts +99 -0
  30. package/build/lib/src/from-idl/parser.js +939 -0
  31. package/build/lib/src/idl.d.ts +13 -1
  32. package/build/lib/src/idl.js +6 -0
  33. package/build/lib/src/index.d.ts +1 -0
  34. package/build/lib/src/index.js +1 -0
  35. package/build/lib/src/peer-generation/LayoutManager.d.ts +1 -1
  36. package/build/lib/src/peer-generation/Materialized.d.ts +1 -1
  37. package/build/lib/src/peer-generation/Materialized.js +4 -4
  38. package/build/lib/src/peer-generation/PeerClass.d.ts +5 -0
  39. package/build/lib/src/peer-generation/PeerClass.js +2 -1
  40. package/build/lib/src/peer-generation/PeerLibrary.d.ts +1 -0
  41. package/build/lib/src/peer-generation/PeerLibrary.js +8 -2
  42. package/build/lib/src/peer-generation/PeerMethod.d.ts +8 -2
  43. package/build/lib/src/peer-generation/PeerMethod.js +22 -4
  44. package/build/lib/src/peer-generation/modules.js +21 -6
  45. package/build/lib/src/util.d.ts +1 -0
  46. package/build/lib/src/util.js +5 -0
  47. package/package.json +10 -3
  48. package/build/lib/src/LanguageWriters/convertors/KotlinConvertor.d.ts +0 -24
  49. package/build/lib/src/LanguageWriters/convertors/KotlinConvertor.js +0 -69
  50. package/build/lib/src/peer-generation/isExternalType.d.ts +0 -4
  51. package/build/lib/src/peer-generation/isExternalType.js +0 -15
@@ -0,0 +1,939 @@
1
+ /*
2
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License.
5
+ * You may obtain a copy of the License at
6
+ *
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS,
11
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ * See the License for the specific language governing permissions and
13
+ * limitations under the License.
14
+ */
15
+ import * as fs from "fs";
16
+ import * as idl from "../idl";
17
+ import { DiagnosticException } from "../diagnostictypes";
18
+ import { DiagnosticMessageGroup, LoadingFatal, ParsingFatal, InternalFatal } from "../diagnosticmessages";
19
+ const DuplicateModifier = new DiagnosticMessageGroup("error", "DuplicateModifier", "Duplicate modifier", "Duplicate of");
20
+ const NotApplicableModifier = new DiagnosticMessageGroup("error", "NotApplicableModifier", "Not applicable modifier");
21
+ const DuplicatePackageDeclaration = new DiagnosticMessageGroup("error", "DuplicatePackageDeclaration", "Duplicate package declaration", "Duplicate of");
22
+ const DuplicateExtendedAttribute = new DiagnosticMessageGroup("error", "DuplicateExtendedAttribute", "Duplicate extended attribute", "Duplicate of");
23
+ const DuplicateArgumentName = new DiagnosticMessageGroup("error", "DuplicateArgumentName", "Duplicate argument name", "Duplicate of");
24
+ const IncorrectLiteral = new DiagnosticMessageGroup("error", "IncorrectLiteral", "Incorrect literal");
25
+ const IncorrectIdentifier = new DiagnosticMessageGroup("error", "IncorrectIdentifier", "Incorrect identifier");
26
+ const UnexpectedToken = new DiagnosticMessageGroup("error", "UnexpectedToken", "Unexpected token");
27
+ const UnexpectedEndOfFile = new DiagnosticMessageGroup("fatal", "UnexpectedEndOfFile", "Unexpected end of file");
28
+ const UnsupportedSyntax = new DiagnosticMessageGroup("error", "UnsupportedSyntax", "Unsupported syntax");
29
+ const WrongDeclarationPlacement = new DiagnosticMessageGroup("error", "WrongDeclarationPlacement", "Wrong declaration placement");
30
+ const ExpectedPrimitiveType = new DiagnosticMessageGroup("error", "ExpectedPrimitiveType", "Expected primitive type");
31
+ const ExpectedReferenceType = new DiagnosticMessageGroup("error", "ExpectedReferenceType", "Expected reference type");
32
+ const ExpectedGenericArguments = new DiagnosticMessageGroup("error", "ExpectedGenericArguments", "Expected generic arguments");
33
+ const UnexpectedGenericArguments = new DiagnosticMessageGroup("error", "UnexpectedGenericArguments", "Unexpected generic arguments");
34
+ export class FatalParserException extends Error {
35
+ constructor(diagnosticMessages) {
36
+ super();
37
+ this.diagnosticMessages = diagnosticMessages;
38
+ }
39
+ }
40
+ var TokenKind;
41
+ (function (TokenKind) {
42
+ TokenKind["Words"] = "Words";
43
+ TokenKind["Literal"] = "Literal";
44
+ TokenKind["Symbol"] = "Symbol";
45
+ TokenKind["Comment"] = "Comment";
46
+ TokenKind["Whitespace"] = "Space";
47
+ TokenKind["End"] = "End";
48
+ })(TokenKind || (TokenKind = {}));
49
+ const supportedDeclarations = new Set(["attribute", "callback", "const", "constructor", "dictionary",
50
+ "enum", "import", "interface", "namespace", "package", "typedef", "version"]);
51
+ const unsupportedDeclarations = new Set(["deleter", "getter", "includes", "inherit", "iterable", "maplike",
52
+ "mixin", "partial", "required", "setlike", "setter", "stringifier", "unrestricted"]);
53
+ const interfaceContent = new Set([idl.IDLKind.Constructor, idl.IDLKind.Const, idl.IDLKind.Property, idl.IDLKind.Method, idl.IDLKind.Callable]);
54
+ const globalContent = new Set([idl.IDLKind.Namespace, idl.IDLKind.Interface, idl.IDLKind.Enum, idl.IDLKind.Method, idl.IDLKind.Typedef, idl.IDLKind.Callback, idl.IDLKind.Import, idl.IDLKind.Version, idl.IDLKind.Const]);
55
+ const havingBlocks = new Set([idl.IDLKind.Namespace, idl.IDLKind.Interface, idl.IDLKind.Enum]);
56
+ const modifierTokens = new Set(["static", "readonly", "async"]);
57
+ // Uncomment in case of parser debugging
58
+ function trac(s) {
59
+ // console.log(s)
60
+ }
61
+ export class Parser {
62
+ constructor(fileName, content) {
63
+ var _a, _b;
64
+ this._curOffset = 0;
65
+ this._curLine = 0;
66
+ // TypeParameters support
67
+ this._generics = [];
68
+ // TypeArguments parsing support
69
+ this._enableInLiteralParsing = false;
70
+ // symTokens = ["(", ")", "[", "]", "{", "}", ",", "...", ":", ";", "<", "=", ">", "?"]
71
+ this._reDecimal = /-?(?=[0-9]*\.|[0-9]+[eE])(([0-9]+\.[0-9]*|[0-9]*\.[0-9]+)([Ee][-+]?[0-9]+)?|[0-9]+[Ee][-+]?[0-9]+)/y;
72
+ this._reInteger = /-?(0([Xx][0-9A-Fa-f]+|[0-7]*)|[1-9][0-9]*)/y;
73
+ this._reString = /"[^"]*"/y;
74
+ // -something is handled for -Infinity literal parsing, but rejected for identifiers later
75
+ this._reWords = /[-]?[_$A-Za-z][_$0-9A-Za-z]*([.][_$A-Za-z][_$0-9A-Za-z]*)*/y;
76
+ this._reSymbol = /\.\.\.|[()[\]{},:;<=>?]/y;
77
+ this._reWhitespace = /[\t\n\r ]+/y;
78
+ this._reComment = /\/\/.*|\/\*[\s\S]*?\*\//y;
79
+ // Note no sticky behavior.
80
+ this._reIsDocComment = /\/\/\/.*|\/\*\*[\s\S]*?\*\//;
81
+ this.currentModifiers = {};
82
+ trac("constructor");
83
+ this.fileName = fileName;
84
+ if (undefined === content) {
85
+ try {
86
+ content = fs.readFileSync(fileName).toString();
87
+ }
88
+ catch (e) {
89
+ content = "";
90
+ throw new FatalParserException([LoadingFatal.reportDiagnosticMessage([{ documentPath: fileName }], (_a = e.message) !== null && _a !== void 0 ? _a : "")]);
91
+ }
92
+ }
93
+ this.content = content;
94
+ const lines = (_b = content.match(/[^\r\n]*(\n|\r\n)?/g)) !== null && _b !== void 0 ? _b : [];
95
+ this.offsets = prepareOffsets(lines);
96
+ this.lines = lines.map((s) => s.replace(/(\n|\r\n)$/, ""));
97
+ }
98
+ parseIDL() {
99
+ var _a;
100
+ const previousDiagnosticsCount = DiagnosticMessageGroup.allGroupsEntries.length;
101
+ try {
102
+ trac("parseIDL");
103
+ this._lexerNext();
104
+ this._prevToken = this._curToken;
105
+ let file = this.parseFile();
106
+ file.text = this.content;
107
+ return file;
108
+ }
109
+ catch (e) {
110
+ if (!(e instanceof DiagnosticException) && !(e instanceof FatalParserException)) {
111
+ InternalFatal.reportDiagnosticMessage([{ documentPath: this.fileName }], (_a = e.message) !== null && _a !== void 0 ? _a : "");
112
+ }
113
+ throw new FatalParserException(DiagnosticMessageGroup.allGroupsEntries.slice(previousDiagnosticsCount));
114
+ }
115
+ }
116
+ _match(re, kind) {
117
+ re.lastIndex = this._curOffset;
118
+ const res = re.exec(this.content);
119
+ if (!res) {
120
+ return undefined;
121
+ }
122
+ const value = res[0];
123
+ const startLine = this._curLine + 1;
124
+ const startCharacter = this._curOffset - this.offsets[this._curLine] + 1;
125
+ this._curOffset = re.lastIndex;
126
+ this._curLine += (value.match(/\n/g) || []).length;
127
+ const endLine = this._curLine + 1;
128
+ const endCharacter = this._curOffset - this.offsets[this._curLine];
129
+ const location = { documentPath: this.fileName, lines: this.lines, range: { start: { line: startLine, character: startCharacter }, end: { line: endLine, character: endCharacter } } };
130
+ this._curToken = { kind, value, location };
131
+ return this._curToken;
132
+ }
133
+ _matchComment() {
134
+ const token = this._match(this._reComment, TokenKind.Comment);
135
+ // At any parsing moment `precedingComment` represents possible comment token just before`curToken`.
136
+ // It can be narrowed by `_reIsDocComment` if needed.
137
+ if (token) {
138
+ this.precedingComment = token;
139
+ }
140
+ return token;
141
+ }
142
+ _lexerNext() {
143
+ var _a, _b, _c, _d;
144
+ trac("_advance");
145
+ this._prevToken = this._curToken;
146
+ this._match(this._reWhitespace, TokenKind.Whitespace);
147
+ this.precedingComment = undefined;
148
+ while (this._matchComment()) {
149
+ this._match(this._reWhitespace, TokenKind.Whitespace);
150
+ }
151
+ if (this._curOffset == this.content.length) {
152
+ const pos = { line: this._curLine + 1, character: this._curOffset - this.offsets[this._curLine] + 1 };
153
+ this._curToken = { kind: TokenKind.End, value: "", location: { documentPath: this.fileName, lines: this.lines, range: { start: pos, end: pos } } };
154
+ return;
155
+ }
156
+ if (this._enableInLiteralParsing && this.content[this._curOffset] == "\"") {
157
+ // TypeArguments parsing support
158
+ const pos = { line: this._curLine + 1, character: this._curOffset - this.offsets[this._curLine] + 1 };
159
+ this._curToken = { kind: TokenKind.Symbol, value: "\"", location: { documentPath: this.fileName, lines: this.lines, range: { start: pos, end: pos } } };
160
+ this._curOffset += 1;
161
+ return;
162
+ }
163
+ const token = ((_d = (_c = (_b = (_a = this._match(this._reDecimal, TokenKind.Literal)) !== null && _a !== void 0 ? _a : this._match(this._reInteger, TokenKind.Literal)) !== null && _b !== void 0 ? _b : this._match(this._reString, TokenKind.Literal)) !== null && _c !== void 0 ? _c : this._match(this._reWords, TokenKind.Words)) !== null && _d !== void 0 ? _d : this._match(this._reSymbol, TokenKind.Symbol));
164
+ if (!token) {
165
+ const pos = { line: this._curLine + 1, character: this._curOffset - this.offsets[this._curLine] + 1 };
166
+ ParsingFatal.throwDiagnosticMessage([{ documentPath: this.fileName, lines: this.lines, range: { start: pos, end: pos } }], "Unrecognized symbols");
167
+ }
168
+ // Uncomment in case of parser debugging
169
+ // if (token) {
170
+ // const visTok = {...token, location: {...token.location, lines: undefined, documentPath: undefined}}
171
+ // console.log(`Token: ${JSON.stringify(visTok)}`)
172
+ // }
173
+ }
174
+ get curToken() {
175
+ return this._curToken;
176
+ }
177
+ get curKind() {
178
+ return this._curToken.kind;
179
+ }
180
+ get curValue() {
181
+ return this._curToken.value;
182
+ }
183
+ get curLocation() {
184
+ return this.curToken.location;
185
+ }
186
+ see(tok) {
187
+ return this.curValue == tok;
188
+ }
189
+ seeAndSkip(tok) {
190
+ if (this.curValue == tok) {
191
+ this._lexerNext();
192
+ return true;
193
+ }
194
+ return false;
195
+ }
196
+ seeEof() {
197
+ return this.curToken.kind == TokenKind.End;
198
+ }
199
+ skip(tok) {
200
+ if (this.curValue != tok) {
201
+ if (this.curKind == TokenKind.End) {
202
+ UnexpectedEndOfFile.throwDiagnosticMessage([this.curLocation], `Unexpected end of file, expected "${tok}"`);
203
+ }
204
+ UnexpectedToken.throwDiagnosticMessage([this.curLocation], `Unexpected token, expected "${tok}"`);
205
+ }
206
+ this._lexerNext();
207
+ }
208
+ skipToAfter(tok) {
209
+ trac("skipToAfter");
210
+ while (!this.see(tok) && !this.seeEof()) {
211
+ this._lexerNext();
212
+ }
213
+ if (!this.seeEof()) {
214
+ this._lexerNext();
215
+ }
216
+ }
217
+ trackLocation() {
218
+ trac("trackLocation");
219
+ const start = this.curLocation;
220
+ return () => {
221
+ const end = this._prevToken.location;
222
+ return {
223
+ documentPath: this.fileName,
224
+ range: { start: start.range.start, end: end.range.end },
225
+ lines: this.lines
226
+ };
227
+ };
228
+ }
229
+ consumeCurrentExtended() {
230
+ const ext = this._internalCurrentExtended;
231
+ this._internalCurrentExtended = undefined;
232
+ return ext;
233
+ }
234
+ assertPossibleModifiers(...mods) {
235
+ for (const k of Object.keys(this.currentModifiers)) {
236
+ if (!mods.includes(k)) {
237
+ NotApplicableModifier.reportDiagnosticMessage([this.currentModifiers[k].location]);
238
+ }
239
+ }
240
+ }
241
+ parseSingleIdentifier() {
242
+ trac("parseSingleIdentifier");
243
+ const token = this.parseFullIdentifier();
244
+ if (token.value.includes(".")) {
245
+ IncorrectIdentifier.throwDiagnosticMessage([this.curLocation]);
246
+ }
247
+ return token;
248
+ }
249
+ parseFullIdentifier() {
250
+ trac("parseFullIdentifier");
251
+ if (this.curKind != TokenKind.Words || literalTypes.has(this.curValue) && this.curValue != "undefined") {
252
+ UnexpectedToken.throwDiagnosticMessage([this.curLocation], "Unexpected token, expected identifier");
253
+ }
254
+ if (this.curValue.startsWith("-")) {
255
+ // Valid for identifiers in WebIDL, but not in Idlize
256
+ IncorrectIdentifier.throwDiagnosticMessage([this.curLocation]);
257
+ }
258
+ const token = this.curToken;
259
+ this._lexerNext();
260
+ return token;
261
+ }
262
+ parseFullIdentifierOrLiteral() {
263
+ trac("parseFullIdentifierOrLiteral");
264
+ if (this.curKind != TokenKind.Words && this.curKind != TokenKind.Literal) {
265
+ UnexpectedToken.throwDiagnosticMessage([this.curLocation], "Unexpected token, expected identifier or literal");
266
+ }
267
+ const token = this.curToken;
268
+ this._lexerNext();
269
+ return token;
270
+ }
271
+ parseLiteral() {
272
+ trac("parseLiteral");
273
+ if (this.curKind != TokenKind.Literal && !literalTypes.has(this.curValue)) {
274
+ UnexpectedToken.throwDiagnosticMessage([this.curLocation], "Unexpected token, expected literal");
275
+ }
276
+ const token = this.curToken;
277
+ this._lexerNext();
278
+ return token;
279
+ }
280
+ parseAndPushGenerics(ext) {
281
+ var _a;
282
+ const gen = (_a = extractTypeParameters(ext)) !== null && _a !== void 0 ? _a : [];
283
+ if (this.seeAndSkip("<")) {
284
+ let next = false;
285
+ while (!this.seeAndSkip(">")) {
286
+ if (next) {
287
+ this.skip(",");
288
+ }
289
+ next = true;
290
+ gen.push(this.parseSingleIdentifier().value);
291
+ }
292
+ }
293
+ // To be restored in parseDeclaration
294
+ this._generics.push(gen);
295
+ return gen;
296
+ }
297
+ hasGeneric(name) {
298
+ return this._generics.some(x => x.includes(name));
299
+ }
300
+ parseFile() {
301
+ var _a;
302
+ trac("parseFile");
303
+ const entries = [];
304
+ while (!this.seeEof()) {
305
+ const entry = this.parseDeclaration(idl.IDLKind.File);
306
+ if (entry) {
307
+ entries.push(entry);
308
+ }
309
+ }
310
+ return idl.createFile(entries, this.fileName, (_a = this.currentPackage) === null || _a === void 0 ? void 0 : _a.split("."), { nodeLocation: { documentPath: this.fileName, lines: this.lines } });
311
+ }
312
+ parseDeclaration(scopeKind) {
313
+ trac("parseDeclaration");
314
+ const genericsLevel = this._generics.length;
315
+ try {
316
+ const decl = this.parseDeclarationUnsafe(scopeKind);
317
+ if (!decl) {
318
+ return;
319
+ }
320
+ if (scopeKind == idl.IDLKind.Interface ? !interfaceContent.has(decl.kind) : !globalContent.has(decl.kind)) {
321
+ // Prefer shorter location ranges for blocks for now
322
+ const location = havingBlocks.has(decl.kind) ? decl.nameLocation : decl.nodeLocation;
323
+ WrongDeclarationPlacement.reportDiagnosticMessage([location], `Wrong declaration placement: ${decl.kind} not allowed in ${scopeKind}`);
324
+ }
325
+ return decl;
326
+ }
327
+ catch (e) {
328
+ if (e instanceof DiagnosticException && e.diagnosticMessage.severity != "fatal") {
329
+ this.skipToAfter(";");
330
+ return;
331
+ }
332
+ throw e;
333
+ }
334
+ finally {
335
+ while (this._generics.length > genericsLevel) {
336
+ this._generics.pop();
337
+ }
338
+ }
339
+ }
340
+ parseDeclarationUnsafe(scopeKind) {
341
+ trac("parseDeclarationUnsafe");
342
+ this._internalCurrentExtended = this.parseExtendedAttributes();
343
+ this.currentModifiers = {};
344
+ while (modifierTokens.has(this.curValue)) {
345
+ if (this.currentModifiers[this.curValue]) {
346
+ DuplicateModifier.reportDiagnosticMessage([this.curLocation]);
347
+ }
348
+ this.currentModifiers[this.curValue] = this.curToken;
349
+ this._lexerNext();
350
+ }
351
+ if (unsupportedDeclarations.has(this.curValue)) {
352
+ UnsupportedSyntax.throwDiagnosticMessage([this.curLocation]);
353
+ return;
354
+ }
355
+ if (supportedDeclarations.has(this.curValue)) {
356
+ if (this.curValue != "attribute") {
357
+ this.assertPossibleModifiers();
358
+ }
359
+ switch (this.curValue) {
360
+ case "attribute":
361
+ this.assertPossibleModifiers("static", "readonly");
362
+ return this.parseAttribute();
363
+ case "callback":
364
+ return this.parseCallback();
365
+ case "const":
366
+ return this.parseConst();
367
+ case "constructor":
368
+ return this.parseConstructor();
369
+ case "dictionary":
370
+ return this.parseDictionary();
371
+ case "enum":
372
+ return this.parseEnum();
373
+ case "import":
374
+ return this.parseImport();
375
+ case "interface":
376
+ return this.parseInterface();
377
+ case "namespace":
378
+ return this.parseNamespace();
379
+ case "package":
380
+ {
381
+ const pack = this.parsePackage();
382
+ if (this.currentPackage) {
383
+ DuplicatePackageDeclaration.reportDiagnosticMessage([pack.location]);
384
+ }
385
+ this.currentPackage = pack.name;
386
+ if (scopeKind != idl.IDLKind.File) {
387
+ WrongDeclarationPlacement.reportDiagnosticMessage([pack.location], `Wrong declaration placement: package is not allowed in ${scopeKind}`);
388
+ }
389
+ return;
390
+ }
391
+ case "typedef":
392
+ return this.parseTypedef();
393
+ case "version":
394
+ return this.parseVersion();
395
+ }
396
+ }
397
+ else {
398
+ this.assertPossibleModifiers("static", "async");
399
+ return this.parseOperation();
400
+ }
401
+ }
402
+ parseNamespace() {
403
+ trac("parseNamespace");
404
+ const sloc = this.trackLocation();
405
+ const ext = this.consumeCurrentExtended();
406
+ this.skip("namespace");
407
+ const name = this.parseSingleIdentifier();
408
+ const entries = [];
409
+ this.skip("{");
410
+ while (!this.seeAndSkip("}")) {
411
+ const entry = this.parseDeclaration(idl.IDLKind.Namespace);
412
+ if (entry) {
413
+ entries.push(entry);
414
+ }
415
+ }
416
+ this.skip(";");
417
+ return idl.createNamespace(name.value, entries, { extendedAttributes: ext, nodeLocation: sloc(), nameLocation: name.location });
418
+ }
419
+ parseInterface() {
420
+ trac("parseInterface");
421
+ const sloc = this.trackLocation();
422
+ const ext = this.consumeCurrentExtended();
423
+ this.skip("interface");
424
+ const typeParameters = this.parseAndPushGenerics(ext);
425
+ const name = this.parseSingleIdentifier();
426
+ let bases = [];
427
+ if (this.seeAndSkip(":")) {
428
+ const typeList = this.parseTypeList();
429
+ for (const type of typeList) {
430
+ if (idl.isReferenceType(type)) {
431
+ bases.push(type);
432
+ }
433
+ else {
434
+ ExpectedReferenceType.reportDiagnosticMessage([type.nodeLocation]);
435
+ }
436
+ }
437
+ }
438
+ const entries = [];
439
+ this.skip("{");
440
+ while (!this.seeAndSkip("}")) {
441
+ const entry = this.parseDeclaration(idl.IDLKind.Interface);
442
+ if (entry) {
443
+ if (idl.isMethod(entry)) {
444
+ entry.isFree = false;
445
+ }
446
+ entries.push(entry);
447
+ }
448
+ }
449
+ this.skip(";");
450
+ return idl.createInterface(name.value, extractInterfaceSubkind(ext), bases, entries.filter(idl.isConstructor), entries.filter(idl.isConstant), entries.filter(idl.isProperty), entries.filter(idl.isMethod), entries.filter(idl.isCallable), typeParameters, { extendedAttributes: ext, documentation: extractDocumentation(ext), nodeLocation: sloc(), nameLocation: name.location });
451
+ }
452
+ parseExtendedAttributes() {
453
+ trac("parseExtendedAttributes");
454
+ // For future extensions: here is also a good point for doc comments handling
455
+ if (!this.seeAndSkip("[")) {
456
+ return;
457
+ }
458
+ const ext = [];
459
+ const names = new Set();
460
+ const duplicates = new Set();
461
+ let next = false;
462
+ while (!this.seeAndSkip("]")) {
463
+ if (next) {
464
+ this.skip(",");
465
+ }
466
+ next = true;
467
+ const name = this.parseSingleIdentifier();
468
+ if (names.has(name.value)) {
469
+ duplicates.add(name.value);
470
+ }
471
+ names.add(name.value);
472
+ if (name.value == idl.IDLExtendedAttributes.TypeArguments) {
473
+ // TypeArguments parsing support
474
+ try {
475
+ this._enableInLiteralParsing = true;
476
+ this.skip("=");
477
+ const vloc = this.trackLocation();
478
+ const start = this._curOffset; // Already after first quote
479
+ this.skip("\"");
480
+ const types = this.parseTypeList();
481
+ const end = this._curOffset - 1; // Already after second quote
482
+ this._enableInLiteralParsing = false;
483
+ this.skip("\"");
484
+ const stringValue = this.content.slice(start, end);
485
+ ext.push({ name: name.value, value: stringValue, typesValue: types, nameLocation: name.location, valueLocation: vloc() });
486
+ }
487
+ catch (e) {
488
+ this.skipToAfter("\"");
489
+ throw e;
490
+ }
491
+ finally {
492
+ this._enableInLiteralParsing = false;
493
+ }
494
+ }
495
+ else {
496
+ let value;
497
+ if (this.seeAndSkip("=")) {
498
+ value = this.parseFullIdentifierOrLiteral();
499
+ }
500
+ const converted = value ? valueFromIdentifierOrLiteral(value) : undefined;
501
+ ext.push({ name: name.value, value: converted, nameLocation: name.location, valueLocation: value === null || value === void 0 ? void 0 : value.location });
502
+ }
503
+ }
504
+ for (const dup of duplicates) {
505
+ DuplicateExtendedAttribute.reportDiagnosticMessage(ext.filter(x => x.name == dup).map(x => x.nameLocation));
506
+ }
507
+ return ext;
508
+ }
509
+ parseTypeList() {
510
+ trac("parseTypeList");
511
+ const types = [this.parseType()];
512
+ while (this.seeAndSkip(",")) {
513
+ types.push(this.parseType());
514
+ }
515
+ return types;
516
+ }
517
+ parseType(outerExt) {
518
+ var _a;
519
+ // Tuned for IDLize types, no support for legacy combinations like "unsigned short"
520
+ trac("parseType");
521
+ const parsedExt = this.parseExtendedAttributes();
522
+ const ext = parsedExt ? (outerExt ? parsedExt.concat(outerExt) : parsedExt) : (outerExt ? [...outerExt] : undefined);
523
+ const sloc = this.trackLocation();
524
+ if (this.seeAndSkip("(")) {
525
+ let combinedTypes = [];
526
+ let next = false;
527
+ while (!this.seeAndSkip(")")) {
528
+ if (next) {
529
+ this.skip("or");
530
+ }
531
+ next = true;
532
+ combinedTypes.push(this.parseType());
533
+ }
534
+ const isNullable = this.seeAndSkip("?") || combinedTypes.includes(idl.IDLUndefinedType);
535
+ combinedTypes = combinedTypes.filter(x => x !== idl.IDLUndefinedType);
536
+ const distilledType = combinedTypes.length == 1
537
+ ? combinedTypes[0]
538
+ : idl.createUnionType(combinedTypes, undefined, { extendedAttributes: ext, nodeLocation: sloc() });
539
+ if (isNullable) {
540
+ return idl.createOptionalType(distilledType, { extendedAttributes: ext, nodeLocation: sloc() });
541
+ }
542
+ return distilledType;
543
+ }
544
+ const name = this.parseFullIdentifier();
545
+ const genArgs = (_a = extractTypeArguments(ext)) !== null && _a !== void 0 ? _a : [];
546
+ if (this.seeAndSkip("<")) {
547
+ let next = false;
548
+ while (!this.seeAndSkip(">")) {
549
+ if (next) {
550
+ this.skip(",");
551
+ }
552
+ next = true;
553
+ genArgs.push(this.parseType());
554
+ }
555
+ }
556
+ let type;
557
+ if (this.hasGeneric(name.value)) {
558
+ if (genArgs.length > 0) {
559
+ UnexpectedGenericArguments.reportDiagnosticMessage([name.location]);
560
+ }
561
+ type = idl.createTypeParameterReference(name.value, { extendedAttributes: ext, nodeLocation: sloc(), nameLocation: name.location });
562
+ }
563
+ else if (builtinTypes.has(name.value)) {
564
+ if (genArgs.length > 0) {
565
+ UnexpectedGenericArguments.reportDiagnosticMessage([name.location]);
566
+ }
567
+ type = builtinTypes.get(name.value);
568
+ }
569
+ else if (builtinGenericTypeNames.has(name.value)) {
570
+ if (genArgs.length == 0) {
571
+ ExpectedGenericArguments.reportDiagnosticMessage([name.location]);
572
+ }
573
+ type = idl.createContainerType(name.value, genArgs, { extendedAttributes: ext, nodeLocation: sloc(), nameLocation: name.location });
574
+ }
575
+ else {
576
+ type = idl.createReferenceType(name.value, genArgs.length > 0 ? genArgs : undefined, { extendedAttributes: ext, nodeLocation: sloc(), nameLocation: name.location });
577
+ }
578
+ const isNullable = this.seeAndSkip("?");
579
+ if (isNullable) {
580
+ return idl.createOptionalType(type, { extendedAttributes: ext, nodeLocation: sloc() });
581
+ }
582
+ else {
583
+ return type;
584
+ }
585
+ }
586
+ parseReferenceType() {
587
+ trac("parseReferenceType");
588
+ const type = this.parseType();
589
+ if (!idl.isReferenceType(type)) {
590
+ ExpectedReferenceType.reportDiagnosticMessage([type.nodeLocation]);
591
+ }
592
+ return type;
593
+ }
594
+ parsePrimitiveType() {
595
+ trac("parsePrimitiveType");
596
+ const type = this.parseType();
597
+ if (!idl.isPrimitiveType(type)) {
598
+ ExpectedPrimitiveType.reportDiagnosticMessage([type.nodeLocation]);
599
+ }
600
+ return type;
601
+ }
602
+ parseArgTuple() {
603
+ trac("parseArgTuple");
604
+ const args = [];
605
+ const names = new Set();
606
+ const duplicates = new Set();
607
+ this.skip("(");
608
+ let next = false;
609
+ while (!this.seeAndSkip(")")) {
610
+ if (next) {
611
+ this.skip(",");
612
+ }
613
+ next = true;
614
+ const arg = this.parseArg();
615
+ if (names.has(arg.name)) {
616
+ duplicates.add(arg.name);
617
+ }
618
+ names.add(arg.name);
619
+ args.push(arg);
620
+ }
621
+ for (const dup of duplicates) {
622
+ DuplicateArgumentName.reportDiagnosticMessage(args.filter(x => x.name == dup).map(x => x.nameLocation));
623
+ }
624
+ return args;
625
+ }
626
+ parseArg() {
627
+ trac("parseArg");
628
+ const ext = this.parseExtendedAttributes();
629
+ const sloc = this.trackLocation();
630
+ const optional = this.seeAndSkip("optional");
631
+ // Note `extendedAttributes` forwarding
632
+ const type = this.parseType(ext);
633
+ const spread = this.seeAndSkip("...");
634
+ const name = this.parseSingleIdentifier();
635
+ // Note absense of `extendedAttributes`, they are only forwarded to `type`, as it was in the old parsing code
636
+ return idl.createParameter(name.value, type, optional, spread, { nodeLocation: sloc(), nameLocation: name.location });
637
+ }
638
+ parseOperation() {
639
+ trac("parseOperation");
640
+ const sloc = this.trackLocation();
641
+ const ext = this.consumeCurrentExtended();
642
+ const isStatic = !!this.currentModifiers.static;
643
+ const isAsync = !!this.currentModifiers.async;
644
+ const isOptional = extractOptional(ext);
645
+ const isFree = true; // Will be set to false in parseInterface if method is declared within interface
646
+ const typeParameters = this.parseAndPushGenerics(ext);
647
+ // Note `extendedAttributes` forwarding
648
+ const retType = this.parseType(ext);
649
+ const name = this.parseSingleIdentifier();
650
+ const args = this.parseArgTuple();
651
+ this.skip(";");
652
+ if (ext === null || ext === void 0 ? void 0 : ext.some(x => x.name == idl.IDLExtendedAttributes.CallSignature)) {
653
+ return idl.createCallable(name.value, args, retType, { isStatic, isAsync }, { extendedAttributes: ext, documentation: extractDocumentation(ext), nodeLocation: sloc(), nameLocation: name.location }, typeParameters);
654
+ }
655
+ return idl.createMethod(name.value, args, retType, { isStatic, isAsync, isOptional, isFree }, { extendedAttributes: ext, documentation: extractDocumentation(ext), nodeLocation: sloc(), nameLocation: name.location }, typeParameters);
656
+ }
657
+ parseConstructor() {
658
+ trac("parseConstructor");
659
+ const sloc = this.trackLocation();
660
+ const ext = this.consumeCurrentExtended();
661
+ this.skip("constructor");
662
+ const args = this.parseArgTuple();
663
+ this.skip(";");
664
+ return idl.createConstructor(args, undefined, { extendedAttributes: ext, documentation: extractDocumentation(ext), nodeLocation: sloc() });
665
+ }
666
+ parseConst() {
667
+ trac("parseConst");
668
+ const sloc = this.trackLocation();
669
+ const ext = this.consumeCurrentExtended();
670
+ this.skip("const");
671
+ const type = this.parseType();
672
+ const name = this.parseSingleIdentifier();
673
+ this.skip("=");
674
+ const value = this.parseLiteral();
675
+ const extracted = extractLiteral(value);
676
+ this.skip(";");
677
+ return idl.createConstant(name.value, type, extracted.extractedString, { extendedAttributes: ext, nodeLocation: sloc(), nameLocation: name.location, valueLocation: value.location });
678
+ }
679
+ parseAttribute() {
680
+ trac("parseAttribute");
681
+ const sloc = this.trackLocation();
682
+ const ext = this.consumeCurrentExtended();
683
+ const isReadonly = !!this.currentModifiers.readonly;
684
+ const isStatic = !!this.currentModifiers.static;
685
+ const isOptional = extractOptional(ext);
686
+ this.skip("attribute");
687
+ const type = this.parseType();
688
+ const name = this.parseSingleIdentifier();
689
+ this.skip(";");
690
+ return idl.createProperty(name.value, type, isReadonly, isStatic, isOptional, { extendedAttributes: ext, documentation: extractDocumentation(ext), nodeLocation: sloc(), nameLocation: name.location });
691
+ }
692
+ parseTypedef() {
693
+ trac("parseTypedef");
694
+ const sloc = this.trackLocation();
695
+ const ext = this.consumeCurrentExtended();
696
+ this.skip("typedef");
697
+ const typeParameters = this.parseAndPushGenerics(ext);
698
+ const type = this.parseType();
699
+ const name = this.parseSingleIdentifier();
700
+ if (idl.isUnionType(type)) {
701
+ type.name = name.value;
702
+ }
703
+ this.skip(";");
704
+ return idl.createTypedef(name.value, type, typeParameters, { extendedAttributes: ext, documentation: extractDocumentation(ext), nodeLocation: sloc(), nameLocation: name.location });
705
+ }
706
+ parseCallback() {
707
+ trac("parseCallback");
708
+ const sloc = this.trackLocation();
709
+ const ext = this.consumeCurrentExtended();
710
+ this.skip("callback");
711
+ if (this.see("interface")) {
712
+ UnsupportedSyntax.throwDiagnosticMessage([this.curLocation], "Unsupported syntax: callback interface");
713
+ }
714
+ const typeParameters = this.parseAndPushGenerics(ext);
715
+ const name = this.parseSingleIdentifier();
716
+ this.skip("=");
717
+ const retType = this.parseType();
718
+ const args = this.parseArgTuple();
719
+ this.skip(";");
720
+ return idl.createCallback(name.value, args, retType, { extendedAttributes: ext, documentation: extractDocumentation(ext), nodeLocation: sloc(), nameLocation: name.location }, typeParameters);
721
+ }
722
+ parseEnum() {
723
+ trac("parseEnum");
724
+ const sloc = this.trackLocation();
725
+ const ext = this.consumeCurrentExtended();
726
+ this.skip("enum");
727
+ const name = this.parseSingleIdentifier();
728
+ const items = [];
729
+ this.skip("{");
730
+ let next = false;
731
+ while (!this.seeAndSkip("}")) {
732
+ if (next) {
733
+ this.skip(",");
734
+ // Can have trailing comma
735
+ if (this.seeAndSkip("}")) {
736
+ break;
737
+ }
738
+ }
739
+ next = true;
740
+ const ext = this.parseExtendedAttributes();
741
+ const entry = this.parseLiteral();
742
+ const member = idl.createEnumMember(entry.value, undefined, idl.IDLNumberType, undefined, { extendedAttributes: ext, nodeLocation: entry.location, nameLocation: entry.location });
743
+ items.push(member);
744
+ }
745
+ return idl.createEnum(name.value, items, { extendedAttributes: ext, documentation: extractDocumentation(ext), nodeLocation: sloc(), nameLocation: name.location });
746
+ }
747
+ parseDictionary() {
748
+ trac("parseDictionary");
749
+ const sloc = this.trackLocation();
750
+ const ext = this.consumeCurrentExtended();
751
+ this.skip("dictionary");
752
+ const name = this.parseSingleIdentifier();
753
+ const items = [];
754
+ this.skip("{");
755
+ while (!this.seeAndSkip("}")) {
756
+ items.push(this.parseDictionaryEntry());
757
+ }
758
+ this.skip(";");
759
+ return idl.createEnum(name.value, items, { extendedAttributes: ext, documentation: extractDocumentation(ext), nodeLocation: sloc(), nameLocation: name.location });
760
+ }
761
+ parseDictionaryEntry() {
762
+ trac("parseDictionaryEntry");
763
+ const ext = this.parseExtendedAttributes();
764
+ const sloc = this.trackLocation();
765
+ const type = this.parsePrimitiveType();
766
+ const name = this.parseSingleIdentifier();
767
+ this.skip("=");
768
+ const value = this.parseLiteral();
769
+ const extracted = extractLiteral(value);
770
+ this.skip(";");
771
+ return idl.createEnumMember(name.value, undefined, type, extracted.extractedValue, { extendedAttributes: ext, nodeLocation: sloc(), nameLocation: name.location, valueLocation: value.location });
772
+ }
773
+ parsePackage() {
774
+ trac("parsePackage");
775
+ const sloc = this.trackLocation();
776
+ this.skip("package");
777
+ const packagePath = this.parseFullIdentifierOrLiteral();
778
+ this.skip(";");
779
+ return { location: sloc(), name: valueFromIdentifierOrLiteral(packagePath) };
780
+ }
781
+ parseImport() {
782
+ trac("parseImport");
783
+ const sloc = this.trackLocation();
784
+ this.skip("import");
785
+ const importPath = this.parseFullIdentifierOrLiteral();
786
+ let alias;
787
+ if (this.seeAndSkip("as")) {
788
+ alias = this.parseSingleIdentifier();
789
+ }
790
+ this.skip(";");
791
+ return idl.createImport(valueFromIdentifierOrLiteral(importPath).split("."), alias === null || alias === void 0 ? void 0 : alias.value, { nodeLocation: sloc(), nameLocation: alias === null || alias === void 0 ? void 0 : alias.location, valueLocation: importPath.location });
792
+ }
793
+ parseVersion() {
794
+ trac("parseVersion");
795
+ const sloc = this.trackLocation();
796
+ this.skip("version");
797
+ const versionLiteral = this.parseLiteral();
798
+ this.skip(";");
799
+ return idl.createVersion(versionLiteral.value.split("."), { nodeLocation: sloc(), valueLocation: versionLiteral.location });
800
+ }
801
+ }
802
+ function prepareOffsets(lines) {
803
+ let offsets = [];
804
+ let offset = 0;
805
+ for (let line of lines) {
806
+ let plus = line.length;
807
+ offsets.push(offset);
808
+ offset += plus;
809
+ }
810
+ return offsets;
811
+ }
812
+ function valueFromIdentifierOrLiteral(token) {
813
+ if (token.kind == TokenKind.Words && !literalTypes.has(token.value)) {
814
+ return token.value;
815
+ }
816
+ return extractLiteral(token).extractedString;
817
+ }
818
+ const literalTypes = new Map([
819
+ ["true", "boolean"],
820
+ ["false", "boolean"],
821
+ ["Infinity", "number"],
822
+ ["-Infinity", "number"],
823
+ ["NaN", "number"],
824
+ ["null", "null"],
825
+ ["undefined", "undefined"],
826
+ ]);
827
+ const extractedUndefined = { type: "undefined", extractedString: "undefined", extractedValue: "undefined" };
828
+ function extractLiteral(token) {
829
+ if (token.kind == TokenKind.Words) {
830
+ if (!literalTypes.has(token.value)) {
831
+ IncorrectLiteral.reportDiagnosticMessage([token.location]);
832
+ return extractedUndefined;
833
+ }
834
+ const type = literalTypes.get(token.value);
835
+ const extractedString = token.value;
836
+ const extractedValue = type == "number" ? parseFloat(extractedString) : extractedString;
837
+ return { type, extractedString, extractedValue };
838
+ }
839
+ if (token.kind != TokenKind.Literal) {
840
+ IncorrectLiteral.reportDiagnosticMessage([token.location]);
841
+ return extractedUndefined;
842
+ }
843
+ if (token.value[0] == "\"") {
844
+ try {
845
+ const extractedString = unescapeString(token.value);
846
+ return { type: "string", extractedString, extractedValue: extractedString };
847
+ }
848
+ catch (e) {
849
+ IncorrectLiteral.reportDiagnosticMessage([token.location], `Incorrect literal: ${e.message}`);
850
+ return extractedUndefined;
851
+ }
852
+ }
853
+ const extractedValue = parseFloat(token.value);
854
+ if (Number.isNaN(extractedValue)) {
855
+ // Real NaNs are handled before that, so report an error
856
+ IncorrectLiteral.reportDiagnosticMessage([token.location]);
857
+ }
858
+ return { type: "number", extractedString: token.value, extractedValue };
859
+ }
860
+ // Taken from deserialize.ts as is
861
+ function unescapeString(value) {
862
+ if (!value.length || value[0] !== '"')
863
+ return value;
864
+ value = value.slice(1, -1);
865
+ value = value.replace(/\\((['"\\bfnrtv])|([0-7]{1-3})|x([0-9a-fA-F]{2})|u([0-9a-fA-F]{4}))/g, (_, all, c, oct, h2, u4) => {
866
+ if (c !== undefined) {
867
+ switch (c) {
868
+ case "'": return "'";
869
+ case '"': return '"';
870
+ case "\\": return "\\";
871
+ case "b": return "\b";
872
+ case "f": return "\f";
873
+ case "n": return "\n";
874
+ case "r": return "\r";
875
+ case "t": return "\t";
876
+ case "v": return "\v";
877
+ }
878
+ }
879
+ else if (oct !== undefined) {
880
+ return String.fromCharCode(parseInt(oct, 8));
881
+ }
882
+ else if (h2 !== undefined) {
883
+ return String.fromCharCode(parseInt(h2, 16));
884
+ }
885
+ else if (u4 !== undefined) {
886
+ return String.fromCharCode(parseInt(u4, 16));
887
+ }
888
+ throw new Error(`unknown escape sequence: ${_}`);
889
+ });
890
+ return value;
891
+ }
892
+ function extractInterfaceSubkind(ext) {
893
+ var _a;
894
+ const ent = (_a = ext === null || ext === void 0 ? void 0 : ext.find(x => x.name == "Entity")) === null || _a === void 0 ? void 0 : _a.value;
895
+ switch (ent) {
896
+ case idl.IDLEntity.Class: return idl.IDLInterfaceSubkind.Class;
897
+ case idl.IDLEntity.Literal: return idl.IDLInterfaceSubkind.AnonymousInterface;
898
+ case idl.IDLEntity.Tuple: return idl.IDLInterfaceSubkind.Tuple;
899
+ default: return idl.IDLInterfaceSubkind.Interface;
900
+ }
901
+ }
902
+ function extractDocumentation(ext) {
903
+ var _a;
904
+ return (_a = ext === null || ext === void 0 ? void 0 : ext.find(x => x.name == "Documentation")) === null || _a === void 0 ? void 0 : _a.value;
905
+ }
906
+ function extractOptional(ext) {
907
+ var _a;
908
+ return (_a = ext === null || ext === void 0 ? void 0 : ext.some(x => x.name.toLowerCase() == "optional")) !== null && _a !== void 0 ? _a : false;
909
+ }
910
+ function sanitizeTypeParameter(param) {
911
+ const extendsIdx = param.indexOf('extends');
912
+ if (extendsIdx !== -1) {
913
+ return param.substring(0, extendsIdx).trim();
914
+ }
915
+ const eqIdx = param.indexOf('=');
916
+ if (eqIdx !== -1) {
917
+ return param.substring(0, eqIdx).trim();
918
+ }
919
+ return param;
920
+ }
921
+ function extractTypeParameters(ext) {
922
+ var _a, _b, _c;
923
+ return (_c = (_b = (_a = ext === null || ext === void 0 ? void 0 : ext.find(x => x.name == idl.IDLExtendedAttributes.TypeParameters)) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.split(",")) === null || _c === void 0 ? void 0 : _c.map(sanitizeTypeParameter);
924
+ }
925
+ function extractTypeArguments(ext) {
926
+ var _a;
927
+ return (_a = ext === null || ext === void 0 ? void 0 : ext.find(x => x.name == idl.IDLExtendedAttributes.TypeArguments)) === null || _a === void 0 ? void 0 : _a.typesValue;
928
+ }
929
+ const builtinTypesList = [idl.IDLPointerType, idl.IDLVoidType, idl.IDLBooleanType,
930
+ idl.IDLObjectType, idl.IDLI8Type, idl.IDLU8Type, idl.IDLI16Type, idl.IDLU16Type,
931
+ idl.IDLI32Type, idl.IDLU32Type, idl.IDLI64Type, idl.IDLU64Type, idl.IDLF32Type,
932
+ idl.IDLF64Type, idl.IDLBigintType, idl.IDLNumberType, idl.IDLStringType, idl.IDLAnyType,
933
+ idl.IDLUndefinedType, idl.IDLUnknownType, idl.IDLObjectType, idl.IDLThisType, idl.IDLDate,
934
+ idl.IDLBufferType, idl.IDLSerializerBuffer
935
+ ];
936
+ // Better solution will be to make it registry in idl.ts
937
+ const builtinTypes = new Map(builtinTypesList.map(x => [x.name, x]));
938
+ const builtinGenericTypeNames = new Set(["sequence", "record", "Promise"]);
939
+ //# sourceMappingURL=parser.js.map