@idlizer/core 2.1.10-arktscgen-4 → 2.1.10-arktscgen-6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/lib/src/Language.d.ts +0 -1
- package/build/lib/src/Language.js +1 -3
- package/build/lib/src/LanguageWriters/ArgConvertors.d.ts +18 -7
- package/build/lib/src/LanguageWriters/ArgConvertors.js +95 -103
- package/build/lib/src/LanguageWriters/LanguageWriter.d.ts +13 -7
- package/build/lib/src/LanguageWriters/LanguageWriter.js +10 -2
- package/build/lib/src/LanguageWriters/common.d.ts +1 -0
- package/build/lib/src/LanguageWriters/common.js +2 -1
- package/build/lib/src/LanguageWriters/convertors/CJConvertors.d.ts +0 -1
- package/build/lib/src/LanguageWriters/convertors/CJConvertors.js +1 -3
- package/build/lib/src/LanguageWriters/convertors/CppConvertors.d.ts +14 -8
- package/build/lib/src/LanguageWriters/convertors/CppConvertors.js +88 -36
- package/build/lib/src/LanguageWriters/convertors/ETSConvertors.d.ts +1 -0
- package/build/lib/src/LanguageWriters/convertors/ETSConvertors.js +10 -8
- package/build/lib/src/LanguageWriters/convertors/InteropConvertors.js +1 -1
- package/build/lib/src/LanguageWriters/convertors/KotlinConvertors.js +9 -5
- package/build/lib/src/LanguageWriters/convertors/TSConvertors.d.ts +4 -4
- package/build/lib/src/LanguageWriters/convertors/TSConvertors.js +98 -44
- package/build/lib/src/LanguageWriters/index.d.ts +5 -4
- package/build/lib/src/LanguageWriters/index.js +8 -15
- package/build/lib/src/LanguageWriters/nameConvertor.d.ts +2 -0
- package/build/lib/src/LanguageWriters/nameConvertor.js +11 -0
- package/build/lib/src/LanguageWriters/writers/CJLanguageWriter.d.ts +2 -0
- package/build/lib/src/LanguageWriters/writers/CJLanguageWriter.js +13 -1
- package/build/lib/src/LanguageWriters/writers/CppLanguageWriter.d.ts +2 -0
- package/build/lib/src/LanguageWriters/writers/CppLanguageWriter.js +8 -2
- package/build/lib/src/LanguageWriters/writers/ETSLanguageWriter.d.ts +2 -10
- package/build/lib/src/LanguageWriters/writers/ETSLanguageWriter.js +52 -92
- package/build/lib/src/LanguageWriters/writers/KotlinLanguageWriter.d.ts +8 -0
- package/build/lib/src/LanguageWriters/writers/KotlinLanguageWriter.js +75 -27
- package/build/lib/src/LanguageWriters/writers/TsLanguageWriter.d.ts +5 -0
- package/build/lib/src/LanguageWriters/writers/TsLanguageWriter.js +58 -18
- package/build/lib/src/LibraryInterface.d.ts +0 -1
- package/build/lib/src/config.d.ts +2 -1461
- package/build/lib/src/config.js +16 -32
- package/build/lib/src/configMerge.d.ts +3 -0
- package/build/lib/src/configMerge.js +63 -0
- package/build/lib/src/diagnostictypes.d.ts +1 -5
- package/build/lib/src/diagnostictypes.js +1 -27
- package/build/lib/src/from-idl/DtsPrinter.js +13 -6
- package/build/lib/src/from-idl/IDLLinter.d.ts +3 -4
- package/build/lib/src/from-idl/IDLLinter.js +30 -32
- package/build/lib/src/from-idl/deserialize.d.ts +3 -4
- package/build/lib/src/from-idl/deserialize.js +30 -642
- package/build/lib/src/from-idl/parser.d.ts +20 -2
- package/build/lib/src/from-idl/parser.js +97 -29
- package/build/lib/src/idl/builders.d.ts +43 -0
- package/build/lib/src/idl/builders.js +135 -0
- package/build/lib/src/idl/discriminators.d.ts +53 -0
- package/build/lib/src/idl/discriminators.js +232 -0
- package/build/lib/src/idl/dump.d.ts +48 -0
- package/build/lib/src/idl/dump.js +327 -0
- package/build/lib/src/idl/index.d.ts +9 -0
- package/build/lib/src/idl/index.js +23 -0
- package/build/lib/src/idl/keywords.d.ts +2 -0
- package/build/lib/src/{options.js → idl/keywords.js} +7 -3
- package/build/lib/src/idl/node.d.ts +233 -0
- package/build/lib/src/idl/node.js +103 -0
- package/build/lib/src/idl/stdlib.d.ts +34 -0
- package/build/lib/src/idl/stdlib.js +54 -0
- package/build/lib/src/idl/utils.d.ts +44 -0
- package/build/lib/src/idl/utils.js +215 -0
- package/build/lib/src/idl/visitors.d.ts +15 -0
- package/build/lib/src/idl/visitors.js +593 -0
- package/build/lib/src/index.d.ts +5 -6
- package/build/lib/src/index.js +6 -7
- package/build/lib/src/inheritance.d.ts +0 -2
- package/build/lib/src/inheritance.js +0 -17
- package/build/lib/src/inputPaths.d.ts +11 -0
- package/build/lib/src/inputPaths.js +81 -0
- package/build/lib/src/languageSpecificKeywords.d.ts +0 -1
- package/build/lib/src/languageSpecificKeywords.js +0 -5
- package/build/lib/src/peer-generation/ConflictingDeclarations.d.ts +6 -0
- package/build/lib/src/peer-generation/ConflictingDeclarations.js +43 -0
- package/build/lib/src/peer-generation/LayoutManager.d.ts +3 -1
- package/build/lib/src/peer-generation/LayoutManager.js +15 -0
- package/build/lib/src/peer-generation/Materialized.d.ts +8 -0
- package/build/lib/src/peer-generation/Materialized.js +26 -1
- package/build/lib/src/peer-generation/PeerLibrary.d.ts +10 -18
- package/build/lib/src/peer-generation/PeerLibrary.js +63 -227
- package/build/lib/src/peer-generation/ReferenceResolver.d.ts +6 -1
- package/build/lib/src/peer-generation/ReferenceResolver.js +93 -2
- package/build/lib/src/peer-generation/idl/IdlNameConvertor.d.ts +6 -0
- package/build/lib/src/peer-generation/idl/IdlNameConvertor.js +15 -3
- package/build/lib/src/peer-generation/idl/common.d.ts +6 -2
- package/build/lib/src/peer-generation/idl/common.js +7 -7
- package/build/lib/src/peer-generation/isMaterialized.js +2 -3
- package/build/lib/src/peer-generation/modules.js +2 -0
- package/build/lib/src/peer-generation/toDeclaration.d.ts +4 -0
- package/build/lib/src/peer-generation/toDeclaration.js +53 -0
- package/build/lib/src/peer-generation/unions.d.ts +1 -1
- package/build/lib/src/peer-generation/unions.js +15 -7
- package/build/lib/src/resolveNamedNode.d.ts +1 -0
- package/build/lib/src/resolveNamedNode.js +7 -0
- package/build/lib/src/transformers/FqnTransformer.d.ts +1 -1
- package/build/lib/src/transformers/FqnTransformer.js +20 -12
- package/build/lib/src/transformers/GenericTransformer.d.ts +4 -3
- package/build/lib/src/transformers/GenericTransformer.js +252 -158
- package/build/lib/src/transformers/IdlTransformer.d.ts +6 -0
- package/build/lib/src/transformers/IdlTransformer.js +7 -0
- package/build/lib/src/transformers/NullTransformer.d.ts +1 -1
- package/build/lib/src/transformers/NullTransformer.js +27 -21
- package/build/lib/src/transformers/OnSerializeTransformer.d.ts +1 -1
- package/build/lib/src/transformers/OnSerializeTransformer.js +28 -13
- package/build/lib/src/util.d.ts +9 -39
- package/build/lib/src/util.js +65 -369
- package/package.json +44 -49
- package/build/lib/src/LanguageWriters/convertors/JavaConvertors.d.ts +0 -37
- package/build/lib/src/LanguageWriters/convertors/JavaConvertors.js +0 -210
- package/build/lib/src/LanguageWriters/writers/JavaLanguageWriter.d.ts +0 -83
- package/build/lib/src/LanguageWriters/writers/JavaLanguageWriter.js +0 -295
- package/build/lib/src/from-idl/webidl2-utils.d.ts +0 -21
- package/build/lib/src/from-idl/webidl2-utils.js +0 -87
- package/build/lib/src/idl.d.ts +0 -439
- package/build/lib/src/idl.js +0 -1367
- package/build/lib/src/idlize.d.ts +0 -25
- package/build/lib/src/idlize.js +0 -198
- package/build/lib/src/options.d.ts +0 -13
- package/build/lib/src/peer-generation/BuilderClass.d.ts +0 -20
- package/build/lib/src/peer-generation/BuilderClass.js +0 -68
- package/webidl2.js/dist/webidl2.js +0 -4622
- package/webidl2.js/package.json +0 -55
|
@@ -14,26 +14,24 @@
|
|
|
14
14
|
*/
|
|
15
15
|
import { warn } from 'console';
|
|
16
16
|
import * as idl from '../idl';
|
|
17
|
-
import { resolveNamedNode } from '../resolveNamedNode';
|
|
18
17
|
import { Language } from '../Language';
|
|
19
18
|
import { createLanguageWriter } from '../LanguageWriters';
|
|
20
|
-
import { BufferConvertor, CallbackConvertor, DateConvertor, MapConvertor, PointerConvertor, TupleConvertor, TypeAliasConvertor, AggregateConvertor, StringConvertor,
|
|
21
|
-
import {
|
|
19
|
+
import { BufferConvertor, CallbackConvertor, DateConvertor, MapConvertor, PointerConvertor, TupleConvertor, TypeAliasConvertor, AggregateConvertor, StringConvertor, ArrayConvertor, FunctionConvertor, OptionConvertor, NumberConvertor, NumericConvertor, CustomTypeConvertor, UnionConvertor, MaterializedClassConvertor, BooleanConvertor, EnumConvertor, UndefinedConvertor, VoidConvertor, ImportTypeConvertor, InterfaceConvertor, BigIntToU64Convertor, ObjectConvertor, TransformOnSerializeConvertor, } from "../LanguageWriters/ArgConvertors";
|
|
20
|
+
import { StructureNameConvertor } from '../LanguageWriters/convertors/CppConvertors';
|
|
22
21
|
import { CJTypeNameConvertor } from '../LanguageWriters/convertors/CJConvertors';
|
|
23
22
|
import { CppConvertor } from '../LanguageWriters/convertors/CppConvertors';
|
|
24
23
|
import { ETSTypeNameConvertor } from '../LanguageWriters/convertors/ETSConvertors';
|
|
25
|
-
import { JavaTypeNameConvertor } from '../LanguageWriters/convertors/JavaConvertors';
|
|
26
24
|
import { TSTypeNameConvertor } from '../LanguageWriters/convertors/TSConvertors';
|
|
27
|
-
import { isBuilderClass } from './BuilderClass';
|
|
28
25
|
import { generateSyntheticFunctionName, isImportAttr } from './idl/common';
|
|
29
26
|
import { LayoutManager } from './LayoutManager';
|
|
30
27
|
import { lib, query } from '../library';
|
|
31
28
|
import { isMaterialized } from './isMaterialized';
|
|
32
|
-
import { isInIdlizeInternal } from '../idlize';
|
|
33
29
|
import { isInCurrentModule } from './modules';
|
|
34
30
|
import { generatorConfiguration } from '../config';
|
|
35
31
|
import { KotlinTypeNameConvertor } from '../LanguageWriters/convertors/KotlinConvertors';
|
|
36
32
|
import { toIdlType } from '../from-idl/deserialize';
|
|
33
|
+
import { createCachedReferenceResolver } from './ReferenceResolver';
|
|
34
|
+
import { toDeclaration } from './toDeclaration';
|
|
37
35
|
export const lenses = {
|
|
38
36
|
globals: lib.lens(lib.select.files())
|
|
39
37
|
.pipe(lib.select.nodes())
|
|
@@ -79,14 +77,12 @@ export class PeerLibrary {
|
|
|
79
77
|
get globals() {
|
|
80
78
|
return query(this.asIDLLibrary(), lenses.globals);
|
|
81
79
|
}
|
|
82
|
-
|
|
83
|
-
this.
|
|
80
|
+
get files() {
|
|
81
|
+
return this._files;
|
|
84
82
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
get buildersToGenerate() {
|
|
89
|
-
return Array.from(this.builderClasses.values()).filter(it => it.needBeGenerated);
|
|
83
|
+
set files(value) {
|
|
84
|
+
this._files = value;
|
|
85
|
+
this.resolver = createCachedReferenceResolver(value);
|
|
90
86
|
}
|
|
91
87
|
get orderedMaterialized() {
|
|
92
88
|
function accessorName(decl) {
|
|
@@ -100,16 +96,12 @@ export class PeerLibrary {
|
|
|
100
96
|
this.interopNativeModule = interopNativeModule;
|
|
101
97
|
this.useMemoM3 = useMemoM3;
|
|
102
98
|
this.layout = LayoutManager.Empty();
|
|
103
|
-
this.
|
|
104
|
-
this.files = [];
|
|
99
|
+
this._files = [];
|
|
105
100
|
this.auxFiles = [];
|
|
106
|
-
this.
|
|
101
|
+
this.resolver = createCachedReferenceResolver([]);
|
|
107
102
|
this.materializedClasses = new Map();
|
|
108
103
|
this.name = "";
|
|
109
104
|
this.customComponentMethods = [];
|
|
110
|
-
this.targetNameConvertorInstance = this.createTypeNameConvertor(this.language);
|
|
111
|
-
this.interopNameConvertorInstance = new CppNameConvertor(this);
|
|
112
|
-
this._useFallback = true;
|
|
113
105
|
}
|
|
114
106
|
createLanguageWriter(language) {
|
|
115
107
|
return createLanguageWriter(language !== null && language !== void 0 ? language : this.language, this);
|
|
@@ -118,7 +110,6 @@ export class PeerLibrary {
|
|
|
118
110
|
switch (language) {
|
|
119
111
|
case Language.TS: return new TSTypeNameConvertor(this);
|
|
120
112
|
case Language.ARKTS: return new ETSTypeNameConvertor(this);
|
|
121
|
-
case Language.JAVA: return new JavaTypeNameConvertor(this);
|
|
122
113
|
case Language.CJ: return new CJTypeNameConvertor(this);
|
|
123
114
|
case Language.CPP: return new CppConvertor(this);
|
|
124
115
|
case Language.KOTLIN: return new KotlinTypeNameConvertor(this);
|
|
@@ -145,8 +136,11 @@ export class PeerLibrary {
|
|
|
145
136
|
}
|
|
146
137
|
createContinuationCallbackReference(continuationType) {
|
|
147
138
|
const continuationParameters = this.createContinuationParameters(continuationType);
|
|
148
|
-
const syntheticName = generateSyntheticFunctionName(continuationParameters, idl.IDLVoidType);
|
|
149
|
-
|
|
139
|
+
const syntheticName = generateSyntheticFunctionName(continuationParameters, idl.IDLVoidType, { nameConvertor: new StructureNameConvertor(this) });
|
|
140
|
+
const primaryReference = idl.createReferenceType(`synthetic.${syntheticName}`);
|
|
141
|
+
if (this.resolveTypeReference(primaryReference, { unresolvedOk: true }))
|
|
142
|
+
return primaryReference;
|
|
143
|
+
return idl.createReferenceType(`synthetic.synthetic_${syntheticName}`);
|
|
150
144
|
}
|
|
151
145
|
getCurrentContext() {
|
|
152
146
|
return this.context;
|
|
@@ -158,126 +152,10 @@ export class PeerLibrary {
|
|
|
158
152
|
return this.files.find(it => it.fileName === filename);
|
|
159
153
|
}
|
|
160
154
|
mapType(type) {
|
|
161
|
-
return this.
|
|
162
|
-
}
|
|
163
|
-
enableCache() {
|
|
164
|
-
this.referenceCache = new Map();
|
|
165
|
-
}
|
|
166
|
-
resolveTypeReference(type, singleStep) {
|
|
167
|
-
var _a, _b;
|
|
168
|
-
const key = type.parent ? type : type.name; // does entry have resolve context or just FQN
|
|
169
|
-
let result = ((_a = this.referenceCache) === null || _a === void 0 ? void 0 : _a.has(key))
|
|
170
|
-
? this.referenceCache.get(key)
|
|
171
|
-
: this.resolveTypeReferenceUncached(type, singleStep);
|
|
172
|
-
(_b = this.referenceCache) === null || _b === void 0 ? void 0 : _b.set(key, result);
|
|
173
|
-
return result;
|
|
174
|
-
}
|
|
175
|
-
resolveTypeReferenceUncached(type, singleStep) {
|
|
176
|
-
var _a, _b;
|
|
177
|
-
if ((_a = this.referenceCache) === null || _a === void 0 ? void 0 : _a.has(type))
|
|
178
|
-
return this.referenceCache.get(type);
|
|
179
|
-
let result = this.resolveNamedNode(type.name.split("."), type.parent);
|
|
180
|
-
if (!singleStep) {
|
|
181
|
-
const seen = new Set;
|
|
182
|
-
while (result) {
|
|
183
|
-
let nextResult = undefined;
|
|
184
|
-
if (idl.isImport(result))
|
|
185
|
-
nextResult = this.resolveImport(result);
|
|
186
|
-
else if (idl.isReferenceType(result))
|
|
187
|
-
nextResult = this.resolveNamedNode(result.name.split("."));
|
|
188
|
-
else if (idl.isTypedef(result) && idl.isReferenceType(result.type))
|
|
189
|
-
nextResult = this.resolveNamedNode(result.type.name.split("."));
|
|
190
|
-
if (!nextResult)
|
|
191
|
-
break;
|
|
192
|
-
if (seen.has(nextResult)) {
|
|
193
|
-
console.warn(`Cyclic referenceType: ${type.name}, seen: [${[...seen.values()].map(idl.getFQName).join(", ")}]`);
|
|
194
|
-
break;
|
|
195
|
-
}
|
|
196
|
-
seen.add(nextResult);
|
|
197
|
-
result = nextResult;
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
if (result && (idl.isImport(result) || idl.isNamespace(result)))
|
|
201
|
-
result = undefined;
|
|
202
|
-
(_b = this.referenceCache) === null || _b === void 0 ? void 0 : _b.set(type, result);
|
|
203
|
-
return result;
|
|
155
|
+
return this.createTypeNameConvertor(this.language).convert(type);
|
|
204
156
|
}
|
|
205
|
-
|
|
206
|
-
this.
|
|
207
|
-
}
|
|
208
|
-
resolveNamedNode(target, pov = undefined) {
|
|
209
|
-
const qualifiedName = target.join(".");
|
|
210
|
-
const entry = this._syntheticFile.entries.find(it => it.name === qualifiedName);
|
|
211
|
-
if (entry)
|
|
212
|
-
return entry;
|
|
213
|
-
if (1 === target.length) {
|
|
214
|
-
const predefined = this.files.flatMap(it => it.entries).filter(isInIdlizeInternal);
|
|
215
|
-
const found = predefined.find(it => it.name === target.at(-1));
|
|
216
|
-
if (found)
|
|
217
|
-
return found;
|
|
218
|
-
}
|
|
219
|
-
const corpus = this.files.concat(this.auxFiles);
|
|
220
|
-
let result = resolveNamedNode(target, pov, corpus);
|
|
221
|
-
if (result && idl.isEntry(result))
|
|
222
|
-
return result;
|
|
223
|
-
if (1 == target.length) {
|
|
224
|
-
const stdScopes = generatorConfiguration().globalPackages.map(it => it.split('.'));
|
|
225
|
-
for (const stdScope of stdScopes) {
|
|
226
|
-
result = resolveNamedNode([...stdScope, ...target], undefined, corpus);
|
|
227
|
-
if (result && idl.isEntry(result))
|
|
228
|
-
return result;
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
// TODO: remove the next block after namespaces out of quarantine
|
|
232
|
-
if (this._useFallback) {
|
|
233
|
-
const povAsReadableString = pov
|
|
234
|
-
? `'${idl.getFQName(pov)}'`
|
|
235
|
-
: "[root]";
|
|
236
|
-
// retry from root
|
|
237
|
-
pov = undefined;
|
|
238
|
-
const resolveds = [];
|
|
239
|
-
for (let file of this.files) {
|
|
240
|
-
result = resolveNamedNode([...file.packageClause, ...target], pov, corpus);
|
|
241
|
-
if (result && idl.isEntry(result)) {
|
|
242
|
-
// too much spam
|
|
243
|
-
// console.warn(`WARNING: Type reference '${qualifiedName}' is not resolved from ${povAsReadableString} but resolved from some package '${file.packageClause().join(".")}'`)
|
|
244
|
-
resolveds.push(result);
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
// and from each namespace
|
|
248
|
-
const traverseNamespaces = (entry) => {
|
|
249
|
-
if (entry && idl.isNamespace(entry) && entry.members.length) {
|
|
250
|
-
const resolved = resolveNamedNode([...idl.getNamespacesPathFor(entry).map(it => it.name), ...target], pov, corpus);
|
|
251
|
-
if (resolved) {
|
|
252
|
-
console.warn(`WARNING: Name '${qualifiedName}' is not resolved from ${povAsReadableString} but resolved from some namespace: '${idl.getNamespacesPathFor(resolved).map(obj => obj.name).join(".")}'`);
|
|
253
|
-
resolveds.push(resolved);
|
|
254
|
-
}
|
|
255
|
-
entry.members.forEach(traverseNamespaces);
|
|
256
|
-
}
|
|
257
|
-
};
|
|
258
|
-
this.files.forEach(file => file.entries.forEach(traverseNamespaces));
|
|
259
|
-
for (const resolved of resolveds)
|
|
260
|
-
if (idl.isEntry(resolved))
|
|
261
|
-
return resolved;
|
|
262
|
-
} // end of block to remove
|
|
263
|
-
return undefined;
|
|
264
|
-
}
|
|
265
|
-
resolveImport(target) {
|
|
266
|
-
let result = this.resolveNamedNode(target.clause);
|
|
267
|
-
if (result) {
|
|
268
|
-
if (idl.isReferenceType(result))
|
|
269
|
-
return this.resolveTypeReference(result);
|
|
270
|
-
if (idl.isImport(result)) {
|
|
271
|
-
if (result == target) {
|
|
272
|
-
console.log("Self-targeted Import?");
|
|
273
|
-
return undefined;
|
|
274
|
-
}
|
|
275
|
-
return this.resolveImport(result);
|
|
276
|
-
}
|
|
277
|
-
if (idl.isEntry(result))
|
|
278
|
-
return result;
|
|
279
|
-
}
|
|
280
|
-
return undefined;
|
|
157
|
+
resolveTypeReference(type, options) {
|
|
158
|
+
return this.resolver.resolveTypeReference(type, options);
|
|
281
159
|
}
|
|
282
160
|
typeConvertor(param, type, isOptionalParam = false) {
|
|
283
161
|
if (isOptionalParam) {
|
|
@@ -288,17 +166,17 @@ export class PeerLibrary {
|
|
|
288
166
|
}
|
|
289
167
|
if (idl.isPrimitiveType(type)) {
|
|
290
168
|
switch (type) {
|
|
291
|
-
case idl.IDLI8Type: return new NumericConvertor(param, type);
|
|
292
|
-
case idl.IDLU8Type: return new NumericConvertor(param, type);
|
|
293
|
-
case idl.IDLI16Type: return new NumericConvertor(param, type);
|
|
294
|
-
case idl.IDLU16Type: return new NumericConvertor(param, type);
|
|
295
|
-
case idl.IDLI32Type: return new NumericConvertor(param, type);
|
|
296
|
-
case idl.IDLU32Type: return new NumericConvertor(param, type);
|
|
297
|
-
case idl.IDLI64Type: return new NumericConvertor(param, type);
|
|
298
|
-
case idl.IDLU64Type: return new NumericConvertor(param, type);
|
|
299
|
-
case idl.IDLF16Type: return new NumericConvertor(param, type);
|
|
300
|
-
case idl.IDLF32Type: return new NumericConvertor(param, type);
|
|
301
|
-
case idl.IDLF64Type: return new NumericConvertor(param, type);
|
|
169
|
+
case idl.IDLI8Type: return new NumericConvertor(this, param, type);
|
|
170
|
+
case idl.IDLU8Type: return new NumericConvertor(this, param, type);
|
|
171
|
+
case idl.IDLI16Type: return new NumericConvertor(this, param, type);
|
|
172
|
+
case idl.IDLU16Type: return new NumericConvertor(this, param, type);
|
|
173
|
+
case idl.IDLI32Type: return new NumericConvertor(this, param, type);
|
|
174
|
+
case idl.IDLU32Type: return new NumericConvertor(this, param, type);
|
|
175
|
+
case idl.IDLI64Type: return new NumericConvertor(this, param, type);
|
|
176
|
+
case idl.IDLU64Type: return new NumericConvertor(this, param, type);
|
|
177
|
+
case idl.IDLF16Type: return new NumericConvertor(this, param, type);
|
|
178
|
+
case idl.IDLF32Type: return new NumericConvertor(this, param, type);
|
|
179
|
+
case idl.IDLF64Type: return new NumericConvertor(this, param, type);
|
|
302
180
|
case idl.IDLBigintType: return new BigIntToU64Convertor(param);
|
|
303
181
|
case idl.IDLSerializerBuffer: new PointerConvertor(param);
|
|
304
182
|
case idl.IDLPointerType: return new PointerConvertor(param);
|
|
@@ -321,10 +199,10 @@ export class PeerLibrary {
|
|
|
321
199
|
// TODO: this types are not references! NativeModulePrinter must be fixed
|
|
322
200
|
switch (type.name.replaceAll('%TEXT%:', '')) { // this is really bad stub, to fix legacy references
|
|
323
201
|
case 'KBoolean': return new BooleanConvertor(param);
|
|
324
|
-
case 'KInt': return new NumericConvertor(param, idl.IDLI32Type);
|
|
325
|
-
case 'KFloat': return new NumericConvertor(param, idl.IDLF32Type);
|
|
326
|
-
case 'KLong': return new NumericConvertor(param, idl.IDLI64Type);
|
|
327
|
-
case 'KDouble': return new NumericConvertor(param, idl.IDLF64Type);
|
|
202
|
+
case 'KInt': return new NumericConvertor(this, param, idl.IDLI32Type);
|
|
203
|
+
case 'KFloat': return new NumericConvertor(this, param, idl.IDLF32Type);
|
|
204
|
+
case 'KLong': return new NumericConvertor(this, param, idl.IDLI64Type);
|
|
205
|
+
case 'KDouble': return new NumericConvertor(this, param, idl.IDLF64Type);
|
|
328
206
|
case 'KStringPtr': return new StringConvertor(param);
|
|
329
207
|
case 'number': return new NumberConvertor(param);
|
|
330
208
|
case 'KPointer': return new PointerConvertor(param);
|
|
@@ -334,7 +212,7 @@ export class PeerLibrary {
|
|
|
334
212
|
}
|
|
335
213
|
const decl = this.resolveTypeReference(type);
|
|
336
214
|
if (decl && isImportAttr(decl) || !decl && isImportAttr(type))
|
|
337
|
-
return new ImportTypeConvertor(param, this.
|
|
215
|
+
return new ImportTypeConvertor(param, this.createTypeNameConvertor(this.language).convert(type));
|
|
338
216
|
return this.declarationConvertor(param, type, decl);
|
|
339
217
|
}
|
|
340
218
|
if (idl.isUnionType(type)) {
|
|
@@ -348,7 +226,7 @@ export class PeerLibrary {
|
|
|
348
226
|
}
|
|
349
227
|
if (idl.isTypeParameterType(type)) {
|
|
350
228
|
// TODO: unlikely correct.
|
|
351
|
-
return new CustomTypeConvertor(param, this.
|
|
229
|
+
return new CustomTypeConvertor(param, this.createTypeNameConvertor(this.language).convert(type), true, `<${type.name}>`);
|
|
352
230
|
}
|
|
353
231
|
throw new Error(`Cannot convert: ${type.kind}`);
|
|
354
232
|
}
|
|
@@ -360,24 +238,18 @@ export class PeerLibrary {
|
|
|
360
238
|
if (customConv)
|
|
361
239
|
return customConv;
|
|
362
240
|
if (!declaration) {
|
|
363
|
-
return new CustomTypeConvertor(param, this.
|
|
241
|
+
return new CustomTypeConvertor(param, this.createTypeNameConvertor(this.language).convert(type), false, this.createTypeNameConvertor(this.language).convert(type)); // assume some predefined type
|
|
364
242
|
}
|
|
365
243
|
const declarationName = declaration.name;
|
|
366
244
|
if (isImportAttr(declaration)) {
|
|
367
|
-
return new ImportTypeConvertor(param, this.
|
|
245
|
+
return new ImportTypeConvertor(param, this.createTypeNameConvertor(this.language).convert(type));
|
|
368
246
|
}
|
|
369
247
|
if (idl.isImport(declaration)) {
|
|
370
|
-
|
|
371
|
-
if (target && idl.isEntry(target))
|
|
372
|
-
return this.declarationConvertor(param, type, target);
|
|
373
|
-
else {
|
|
374
|
-
warn(`Unable to resolve Import ${declaration.clause.join(".")} as ${declaration.name}`);
|
|
375
|
-
return new CustomTypeConvertor(param, declaration.name, false, declaration.name);
|
|
376
|
-
}
|
|
248
|
+
throw new Error(`Unexpected declaration ${declaration.kind}`);
|
|
377
249
|
}
|
|
378
250
|
if (idl.hasExtAttribute(declaration, idl.IDLExtendedAttributes.TransformOnSerialize)) {
|
|
379
|
-
const
|
|
380
|
-
return new TransformOnSerializeConvertor(param, this, declaration,
|
|
251
|
+
const targetType = toIdlType("", idl.getExtAttribute(declaration, idl.IDLExtendedAttributes.TransformOnSerialize));
|
|
252
|
+
return new TransformOnSerializeConvertor(param, this, declaration, targetType);
|
|
381
253
|
}
|
|
382
254
|
if (idl.isEnum(declaration)) {
|
|
383
255
|
return new EnumConvertor(param, declaration);
|
|
@@ -389,19 +261,17 @@ export class PeerLibrary {
|
|
|
389
261
|
return new CallbackConvertor(this, param, declaration, this.interopNativeModule);
|
|
390
262
|
}
|
|
391
263
|
if (idl.isTypedef(declaration)) {
|
|
392
|
-
if (
|
|
393
|
-
|
|
394
|
-
return new CustomTypeConvertor(param, declaration.name, false, declaration.name);
|
|
395
|
-
}
|
|
264
|
+
if (forceTypedefAsResource(this, type, declaration))
|
|
265
|
+
return new ObjectConvertor(param, type);
|
|
396
266
|
return new TypeAliasConvertor(this, param, declaration);
|
|
397
267
|
}
|
|
398
268
|
if (idl.isInterface(declaration)) {
|
|
269
|
+
if (generatorConfiguration().forceResource.includes(declaration.name)) {
|
|
270
|
+
return new ObjectConvertor(param, type);
|
|
271
|
+
}
|
|
399
272
|
if (isMaterialized(declaration, this)) {
|
|
400
273
|
return new MaterializedClassConvertor(this, param, declaration);
|
|
401
274
|
}
|
|
402
|
-
if (isBuilderClass(declaration)) {
|
|
403
|
-
return new ClassConvertor(this, declarationName, param, declaration);
|
|
404
|
-
}
|
|
405
275
|
switch (declaration.subkind) {
|
|
406
276
|
case idl.IDLInterfaceSubkind.Interface:
|
|
407
277
|
case idl.IDLInterfaceSubkind.Class:
|
|
@@ -430,56 +300,8 @@ export class PeerLibrary {
|
|
|
430
300
|
}
|
|
431
301
|
return undefined;
|
|
432
302
|
}
|
|
433
|
-
getInteropName(node) {
|
|
434
|
-
return this.interopNameConvertorInstance.convert(node);
|
|
435
|
-
}
|
|
436
303
|
toDeclaration(type) {
|
|
437
|
-
|
|
438
|
-
case idl.IDLAnyType: return ArkCustomObject;
|
|
439
|
-
case idl.IDLVoidType: return idl.IDLVoidType;
|
|
440
|
-
case idl.IDLUndefinedType: return idl.IDLUndefinedType;
|
|
441
|
-
case idl.IDLUnknownType: return ArkCustomObject;
|
|
442
|
-
// case idl.IDLObjectType: return ArkCustomObject
|
|
443
|
-
}
|
|
444
|
-
const typeName = idl.isNamedNode(type) ? type.name : undefined;
|
|
445
|
-
switch (typeName) {
|
|
446
|
-
case "object":
|
|
447
|
-
case "Object": return idl.IDLObjectType;
|
|
448
|
-
}
|
|
449
|
-
if (idl.isReferenceType(type)) {
|
|
450
|
-
// TODO: remove all this!
|
|
451
|
-
if (type.name === 'Date') {
|
|
452
|
-
return ArkDate;
|
|
453
|
-
}
|
|
454
|
-
if (type.name === 'AnimationRange') {
|
|
455
|
-
return ArkCustomObject;
|
|
456
|
-
}
|
|
457
|
-
if (type.name === 'Function') {
|
|
458
|
-
return ArkFunction;
|
|
459
|
-
}
|
|
460
|
-
if (type.name === 'Optional') {
|
|
461
|
-
return this.toDeclaration(type.typeArguments[0]);
|
|
462
|
-
}
|
|
463
|
-
const decl = this.resolveTypeReference(type);
|
|
464
|
-
if (!decl) {
|
|
465
|
-
warn(`undeclared type ${idl.DebugUtils.debugPrintType(type)}`);
|
|
466
|
-
}
|
|
467
|
-
if (decl && idl.isTypedef(decl) && isCyclicTypeDef(decl)) {
|
|
468
|
-
warn(`Cyclic typedef: ${idl.DebugUtils.debugPrintType(type)}`);
|
|
469
|
-
return ArkCustomObject;
|
|
470
|
-
}
|
|
471
|
-
if (decl && idl.hasExtAttribute(decl, idl.IDLExtendedAttributes.TransformOnSerialize)) {
|
|
472
|
-
const type = toIdlType("", idl.getExtAttribute(decl, idl.IDLExtendedAttributes.TransformOnSerialize));
|
|
473
|
-
return this.toDeclaration(type);
|
|
474
|
-
}
|
|
475
|
-
return !decl ? ArkCustomObject // assume some builtin type
|
|
476
|
-
: idl.isTypedef(decl) ? this.toDeclaration(decl.type)
|
|
477
|
-
: decl;
|
|
478
|
-
}
|
|
479
|
-
if (isImportAttr(type)) {
|
|
480
|
-
return ArkCustomObject;
|
|
481
|
-
}
|
|
482
|
-
return type;
|
|
304
|
+
return toDeclaration(type, this);
|
|
483
305
|
}
|
|
484
306
|
setFileLayout(strategy) {
|
|
485
307
|
this.layout = new LayoutManager(strategy);
|
|
@@ -499,7 +321,21 @@ export const ArkCustomObject = idl.IDLCustomObjectType;
|
|
|
499
321
|
export function cleanPrefix(name, prefix) {
|
|
500
322
|
return name.replace(prefix, "");
|
|
501
323
|
}
|
|
502
|
-
function
|
|
503
|
-
|
|
324
|
+
export function forceTypedefAsResource(resolver, type, decl) {
|
|
325
|
+
if (generatorConfiguration().forceResource.includes(idl.getFQName(decl)))
|
|
326
|
+
return true;
|
|
327
|
+
if (isCyclicTypeDef(resolver, decl)) {
|
|
328
|
+
warn(`Cyclic typedef: ${idl.DebugUtils.debugPrintType(type)}`);
|
|
329
|
+
return true;
|
|
330
|
+
}
|
|
331
|
+
return false;
|
|
332
|
+
}
|
|
333
|
+
function isCyclicTypeDef(resolver, decl) {
|
|
334
|
+
let foundCycle = false;
|
|
335
|
+
idl.forEachChild(decl, (node) => {
|
|
336
|
+
if (idl.isReferenceType(node) && resolver.resolveTypeReference(node) === decl)
|
|
337
|
+
foundCycle = true;
|
|
338
|
+
});
|
|
339
|
+
return foundCycle;
|
|
504
340
|
}
|
|
505
341
|
//# sourceMappingURL=PeerLibrary.js.map
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import * as idl from '../idl';
|
|
2
2
|
export interface ReferenceResolver {
|
|
3
|
-
resolveTypeReference(type: idl.IDLReferenceType,
|
|
3
|
+
resolveTypeReference(type: idl.IDLReferenceType, options?: {
|
|
4
|
+
terminalImports?: boolean;
|
|
5
|
+
unresolvedOk?: boolean;
|
|
6
|
+
}): idl.IDLEntry | undefined;
|
|
4
7
|
toDeclaration(type: idl.IDLNode): idl.IDLNode;
|
|
5
8
|
}
|
|
6
9
|
export declare function createEmptyReferenceResolver(): ReferenceResolver;
|
|
7
10
|
/** Please do not store any global instances */
|
|
8
11
|
export declare function createAlternativeReferenceResolver(mainResolver: ReferenceResolver, alternatives: Map<string, idl.IDLEntry>): ReferenceResolver;
|
|
12
|
+
export declare function createAlgotithmicReferenceResolver(files: idl.IDLFile[], useFallback?: boolean): ReferenceResolver;
|
|
13
|
+
export declare function createCachedReferenceResolver(files: idl.IDLFile[]): ReferenceResolver;
|
|
9
14
|
//# sourceMappingURL=ReferenceResolver.d.ts.map
|
|
@@ -12,6 +12,9 @@
|
|
|
12
12
|
* See the License for the specific language governing permissions and
|
|
13
13
|
* limitations under the License.
|
|
14
14
|
*/
|
|
15
|
+
import * as idl from '../idl';
|
|
16
|
+
import { getPov, resolveNamedNode } from '../resolveNamedNode';
|
|
17
|
+
import { consoleWarn } from '../util';
|
|
15
18
|
export function createEmptyReferenceResolver() {
|
|
16
19
|
return {
|
|
17
20
|
resolveTypeReference() {
|
|
@@ -25,13 +28,101 @@ export function createEmptyReferenceResolver() {
|
|
|
25
28
|
/** Please do not store any global instances */
|
|
26
29
|
export function createAlternativeReferenceResolver(mainResolver, alternatives) {
|
|
27
30
|
return {
|
|
28
|
-
resolveTypeReference(type,
|
|
31
|
+
resolveTypeReference(type, options) {
|
|
29
32
|
var _a;
|
|
30
|
-
return (_a = mainResolver.resolveTypeReference(type,
|
|
33
|
+
return (_a = mainResolver.resolveTypeReference(type, options)) !== null && _a !== void 0 ? _a : alternatives.get(type.name);
|
|
31
34
|
},
|
|
32
35
|
toDeclaration(type) {
|
|
33
36
|
return mainResolver.toDeclaration(type);
|
|
34
37
|
},
|
|
35
38
|
};
|
|
36
39
|
}
|
|
40
|
+
export function createAlgotithmicReferenceResolver(files, useFallback = false) {
|
|
41
|
+
const resolveFallback = (type) => {
|
|
42
|
+
const target = type.name.split('.');
|
|
43
|
+
const resolveds = new Set();
|
|
44
|
+
for (let file of files) {
|
|
45
|
+
const result = resolveNamedNode([...file.packageClause, ...target], undefined, files);
|
|
46
|
+
if (result && idl.isEntry(result)) {
|
|
47
|
+
// too much spam
|
|
48
|
+
// console.warn(`WARNING: Type reference '${qualifiedName}' is not resolved from ${povAsReadableString} but resolved from some package '${file.packageClause().join(".")}'`)
|
|
49
|
+
resolveds.add(result);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
// and from each namespace
|
|
53
|
+
const traverseNamespaces = (entry) => {
|
|
54
|
+
if (entry && idl.isNamespace(entry) && entry.members.length) {
|
|
55
|
+
const resolved = resolveNamedNode([...idl.getNamespacesPathFor(entry).map(it => it.name), ...target], undefined, files);
|
|
56
|
+
if (resolved) {
|
|
57
|
+
console.warn(`WARNING: Name '${type.name}' resolved by fallback from some namespace: '${idl.getNamespacesPathFor(resolved).map(obj => obj.name).join(".")}'`);
|
|
58
|
+
resolveds.add(resolved);
|
|
59
|
+
}
|
|
60
|
+
entry.members.forEach(traverseNamespaces);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
files.forEach(file => file.entries.forEach(traverseNamespaces));
|
|
64
|
+
if (resolveds.size > 1)
|
|
65
|
+
console.error(`Resolved multiple possible declarations by ${idl.DebugUtils.debugPrintType(type)}`);
|
|
66
|
+
return resolveds.size ? resolveds.values().next().value : undefined;
|
|
67
|
+
};
|
|
68
|
+
return {
|
|
69
|
+
resolveTypeReference(type, options) {
|
|
70
|
+
var _a;
|
|
71
|
+
let result = (_a = resolveNamedNode(type.name.split("."), getPov(type), files)) !== null && _a !== void 0 ? _a : (useFallback ? resolveFallback(type) : undefined);
|
|
72
|
+
if (!(options === null || options === void 0 ? void 0 : options.terminalImports)) {
|
|
73
|
+
const seen = new Set;
|
|
74
|
+
while (result) {
|
|
75
|
+
let nextResult = undefined;
|
|
76
|
+
if (idl.isImport(result))
|
|
77
|
+
nextResult = resolveNamedNode(result.clause, undefined, files);
|
|
78
|
+
if (!nextResult)
|
|
79
|
+
break;
|
|
80
|
+
if (seen.has(nextResult)) {
|
|
81
|
+
console.warn(`Cyclic referenceType: ${type.name}, seen: [${[...seen.values()].map(idl.getFQName).join(", ")}]`);
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
seen.add(nextResult);
|
|
85
|
+
result = nextResult;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
if (result) {
|
|
89
|
+
if (!idl.isEntry(result)) {
|
|
90
|
+
throw new Error(`Resolved reference ${idl.DebugUtils.debugPrintType(type)} to not entry type`);
|
|
91
|
+
}
|
|
92
|
+
if (idl.isNamespace(result)) {
|
|
93
|
+
throw new Error(`Resolved reference ${idl.DebugUtils.debugPrintType(type)} to namespace`);
|
|
94
|
+
}
|
|
95
|
+
return result;
|
|
96
|
+
}
|
|
97
|
+
return undefined;
|
|
98
|
+
},
|
|
99
|
+
toDeclaration(type) {
|
|
100
|
+
throw new Error("To declaration is not available for default references resolver");
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
export function createCachedReferenceResolver(files) {
|
|
105
|
+
const cache = new Map();
|
|
106
|
+
for (const file of files) {
|
|
107
|
+
idl.forEachChild(file, node => {
|
|
108
|
+
if (idl.isEnum(node) || idl.isCallback(node) || idl.isInterface(node) || idl.isTypedef(node)) {
|
|
109
|
+
const fqn = idl.getFQName(node);
|
|
110
|
+
if (cache.has(fqn))
|
|
111
|
+
consoleWarn(`WARNING: multiple entries with FQN=${fqn} found`);
|
|
112
|
+
else
|
|
113
|
+
cache.set(fqn, node);
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
return {
|
|
118
|
+
resolveTypeReference(type, options) {
|
|
119
|
+
if (!(options === null || options === void 0 ? void 0 : options.unresolvedOk) && !cache.has(type.name))
|
|
120
|
+
consoleWarn(`WARNING: reference ${idl.DebugUtils.debugPrintType(type)} was not found`);
|
|
121
|
+
return cache.get(type.name);
|
|
122
|
+
},
|
|
123
|
+
toDeclaration(type) {
|
|
124
|
+
throw new Error("Not implemented");
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
}
|
|
37
128
|
//# sourceMappingURL=ReferenceResolver.js.map
|
|
@@ -26,6 +26,11 @@ export declare class CJDeclarationNameConvertor extends DeclarationNameConvertor
|
|
|
26
26
|
convertEnum(decl: idl.IDLEnum): string;
|
|
27
27
|
static readonly I: CJDeclarationNameConvertor;
|
|
28
28
|
}
|
|
29
|
+
export declare class KotlinDeclarationNameConvertor extends DeclarationNameConvertor {
|
|
30
|
+
convertInterface(decl: idl.IDLInterface): string;
|
|
31
|
+
convertEnum(decl: idl.IDLEnum): string;
|
|
32
|
+
static readonly I: KotlinDeclarationNameConvertor;
|
|
33
|
+
}
|
|
29
34
|
export declare class ETSFeatureNameConvertor extends DeclarationNameConvertor {
|
|
30
35
|
convertEnum(decl: idl.IDLEnum): string;
|
|
31
36
|
static readonly I: ETSFeatureNameConvertor;
|
|
@@ -35,6 +40,7 @@ export declare class CJFeatureNameConvertor extends DeclarationNameConvertor {
|
|
|
35
40
|
static readonly I: CJFeatureNameConvertor;
|
|
36
41
|
}
|
|
37
42
|
export declare class KotlinFeatureNameConvertor extends DeclarationNameConvertor {
|
|
43
|
+
convertInterface(decl: idl.IDLInterface): string;
|
|
38
44
|
convertEnum(decl: idl.IDLEnum): string;
|
|
39
45
|
static readonly I: KotlinFeatureNameConvertor;
|
|
40
46
|
}
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
*/
|
|
15
15
|
import * as idl from "../../idl";
|
|
16
16
|
import { Language } from "../../Language";
|
|
17
|
+
import { removePoints } from "../../util";
|
|
17
18
|
export class DeclarationNameConvertor {
|
|
18
19
|
convertImport(decl) {
|
|
19
20
|
console.warn("Imports are not implemented yet");
|
|
@@ -70,6 +71,15 @@ export class CJDeclarationNameConvertor extends DeclarationNameConvertor {
|
|
|
70
71
|
}
|
|
71
72
|
}
|
|
72
73
|
CJDeclarationNameConvertor.I = new CJDeclarationNameConvertor();
|
|
74
|
+
export class KotlinDeclarationNameConvertor extends DeclarationNameConvertor {
|
|
75
|
+
convertInterface(decl) {
|
|
76
|
+
return removePoints(idl.getQualifiedName(decl, "namespace.name"));
|
|
77
|
+
}
|
|
78
|
+
convertEnum(decl) {
|
|
79
|
+
return removePoints(idl.getQualifiedName(decl, "namespace.name"));
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
KotlinDeclarationNameConvertor.I = new KotlinDeclarationNameConvertor();
|
|
73
83
|
export class ETSFeatureNameConvertor extends DeclarationNameConvertor {
|
|
74
84
|
convertEnum(decl) {
|
|
75
85
|
const namespace = idl.getNamespacesPathFor(decl).map(it => it.name);
|
|
@@ -86,25 +96,27 @@ export class CJFeatureNameConvertor extends DeclarationNameConvertor {
|
|
|
86
96
|
}
|
|
87
97
|
CJFeatureNameConvertor.I = new CJFeatureNameConvertor();
|
|
88
98
|
export class KotlinFeatureNameConvertor extends DeclarationNameConvertor {
|
|
99
|
+
convertInterface(decl) {
|
|
100
|
+
return removePoints(idl.getQualifiedName(decl, "namespace.name"));
|
|
101
|
+
}
|
|
89
102
|
convertEnum(decl) {
|
|
90
|
-
return decl.name;
|
|
103
|
+
return removePoints(idl.getQualifiedName(decl, "namespace.name"));
|
|
91
104
|
}
|
|
92
105
|
}
|
|
93
106
|
KotlinFeatureNameConvertor.I = new KotlinFeatureNameConvertor();
|
|
94
107
|
export function createDeclarationNameConvertor(language) {
|
|
95
108
|
switch (language) {
|
|
96
109
|
case Language.ARKTS: return ETSDeclarationNameConvertor.I;
|
|
97
|
-
case Language.JAVA:
|
|
98
110
|
case Language.CPP:
|
|
99
111
|
case Language.TS: return DeclarationNameConvertor.I;
|
|
100
112
|
case Language.CJ: CJDeclarationNameConvertor.I;
|
|
113
|
+
case Language.KOTLIN: KotlinDeclarationNameConvertor.I;
|
|
101
114
|
default: throw new Error(`Language ${language.toString()} is not supported`);
|
|
102
115
|
}
|
|
103
116
|
}
|
|
104
117
|
export function createFeatureNameConvertor(language) {
|
|
105
118
|
switch (language) {
|
|
106
119
|
case Language.ARKTS: return ETSFeatureNameConvertor.I;
|
|
107
|
-
case Language.JAVA:
|
|
108
120
|
case Language.CPP:
|
|
109
121
|
case Language.TS: return TSFeatureNameConvertor.I;
|
|
110
122
|
case Language.CJ: return CJFeatureNameConvertor.I;
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import * as idl from "../../idl";
|
|
2
2
|
import { Language } from "../../Language";
|
|
3
|
+
import { IdlNameConvertor } from "../../LanguageWriters";
|
|
3
4
|
export declare function generateSyntheticIdlNodeName(type: idl.IDLType): string;
|
|
4
5
|
export declare function qualifiedName(decl: idl.IDLNode, languageOrDelimiter: Language | string, pattern: idl.QNPattern): string;
|
|
5
6
|
export declare function collapseTypes(types: idl.IDLType[], name?: string): idl.IDLType;
|
|
6
|
-
export declare function generifiedTypeName(refType: idl.IDLReferenceType
|
|
7
|
+
export declare function generifiedTypeName(refType: idl.IDLReferenceType, nameConvertor: IdlNameConvertor, refName?: string): string;
|
|
7
8
|
export declare function sanitizeGenerics(genericDeclarationString: string): string;
|
|
8
9
|
export declare function generateSyntheticUnionName(types: idl.IDLType[]): string;
|
|
9
10
|
export declare function generateSyntheticFunctionParameterName(parameter: idl.IDLParameter): string;
|
|
10
|
-
export declare function generateSyntheticFunctionName(parameters: idl.IDLParameter[], returnType: idl.IDLType,
|
|
11
|
+
export declare function generateSyntheticFunctionName(parameters: idl.IDLParameter[], returnType: idl.IDLType, options?: {
|
|
12
|
+
isAsync?: boolean;
|
|
13
|
+
nameConvertor?: IdlNameConvertor;
|
|
14
|
+
}): string;
|
|
11
15
|
export declare function isImportAttr(decl: idl.IDLNode): boolean;
|
|
12
16
|
//# sourceMappingURL=common.d.ts.map
|