@idlizer/core 2.1.9-arktscgen-9 → 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.
@@ -35,11 +35,13 @@ export declare enum IDLEntity {
35
35
  }
36
36
  export declare enum IDLExtendedAttributes {
37
37
  Accessor = "Accessor",
38
+ Annotations = "Annotations",
38
39
  Async = "Async",
39
40
  CallSignature = "CallSignature",
40
41
  CommonMethod = "CommonMethod",
41
42
  Component = "Component",
42
43
  ComponentInterface = "ComponentInterface",
44
+ ComponentModifier = "ComponentModifier",
43
45
  Deprecated = "Deprecated",
44
46
  Documentation = "Documentation",
45
47
  DtsName = "DtsName",
@@ -60,11 +62,14 @@ export declare enum IDLExtendedAttributes {
60
62
  Synthetic = "Synthetic",
61
63
  Throws = "Throws",
62
64
  TraceKey = "TraceKey",
65
+ TypeAnnotations = "TypeAnnotations",
63
66
  TypeArguments = "TypeArguments",
64
67
  TypeParameters = "TypeParameters",
65
68
  VerbatimDts = "VerbatimDts",
66
69
  HandWrittenImplementation = "HandWrittenImplementation",
67
- ExtraMethod = "ExtraMethod"
70
+ ExtraMethod = "ExtraMethod",
71
+ OverloadAlias = "OverloadAlias",
72
+ OverloadPriority = "OverloadPriority"
68
73
  }
69
74
  export declare enum IDLAccessorAttribute {
70
75
  Getter = "Getter",
@@ -73,6 +78,9 @@ export declare enum IDLAccessorAttribute {
73
78
  export interface IDLExtendedAttribute {
74
79
  name: string;
75
80
  value?: string;
81
+ typesValue?: IDLType[];
82
+ nameLocation?: Location;
83
+ valueLocation?: Location;
76
84
  }
77
85
  export interface IDLNode {
78
86
  _idlNodeBrand: any;
@@ -296,6 +304,9 @@ export type IDLNodeInitializer = {
296
304
  extendedAttributes?: IDLExtendedAttribute[];
297
305
  fileName?: string;
298
306
  documentation?: string;
307
+ nodeLocation?: Location;
308
+ nameLocation?: Location;
309
+ valueLocation?: Location;
299
310
  };
300
311
  export declare function createNamespace(name: string, members?: IDLEntry[], nodeInitializer?: IDLNodeInitializer): IDLNamespace;
301
312
  export declare function linkParentBack<T extends IDLNode>(node: T): T;
@@ -54,11 +54,13 @@ export var IDLEntity;
54
54
  export var IDLExtendedAttributes;
55
55
  (function (IDLExtendedAttributes) {
56
56
  IDLExtendedAttributes["Accessor"] = "Accessor";
57
+ IDLExtendedAttributes["Annotations"] = "Annotations";
57
58
  IDLExtendedAttributes["Async"] = "Async";
58
59
  IDLExtendedAttributes["CallSignature"] = "CallSignature";
59
60
  IDLExtendedAttributes["CommonMethod"] = "CommonMethod";
60
61
  IDLExtendedAttributes["Component"] = "Component";
61
62
  IDLExtendedAttributes["ComponentInterface"] = "ComponentInterface";
63
+ IDLExtendedAttributes["ComponentModifier"] = "ComponentModifier";
62
64
  IDLExtendedAttributes["Deprecated"] = "Deprecated";
63
65
  IDLExtendedAttributes["Documentation"] = "Documentation";
64
66
  IDLExtendedAttributes["DtsName"] = "DtsName";
@@ -79,11 +81,14 @@ export var IDLExtendedAttributes;
79
81
  IDLExtendedAttributes["Synthetic"] = "Synthetic";
80
82
  IDLExtendedAttributes["Throws"] = "Throws";
81
83
  IDLExtendedAttributes["TraceKey"] = "TraceKey";
84
+ IDLExtendedAttributes["TypeAnnotations"] = "TypeAnnotations";
82
85
  IDLExtendedAttributes["TypeArguments"] = "TypeArguments";
83
86
  IDLExtendedAttributes["TypeParameters"] = "TypeParameters";
84
87
  IDLExtendedAttributes["VerbatimDts"] = "VerbatimDts";
85
88
  IDLExtendedAttributes["HandWrittenImplementation"] = "HandWrittenImplementation";
86
89
  IDLExtendedAttributes["ExtraMethod"] = "ExtraMethod";
90
+ IDLExtendedAttributes["OverloadAlias"] = "OverloadAlias";
91
+ IDLExtendedAttributes["OverloadPriority"] = "OverloadPriority";
87
92
  })(IDLExtendedAttributes || (IDLExtendedAttributes = {}));
88
93
  export var IDLAccessorAttribute;
89
94
  (function (IDLAccessorAttribute) {
@@ -58,5 +58,6 @@ export * from "./from-idl/IDLLinter";
58
58
  export { fromIDL, scanIDL } from "./from-idl/common";
59
59
  export { idlToDtsString, CustomPrintVisitor } from "./from-idl/DtsPrinter";
60
60
  export { toIDLFile, addSyntheticType, resolveSyntheticType, IDLTokenInfoMap } from "./from-idl/deserialize";
61
+ export { Parser, FatalParserException } from "./from-idl/parser";
61
62
  export { D, ConfigTypeInfer, ConfigSchema, inspectSchema } from './configDescriber';
62
63
  //# sourceMappingURL=index.d.ts.map
@@ -72,5 +72,6 @@ export * from "./from-idl/IDLLinter";
72
72
  export { fromIDL, scanIDL } from "./from-idl/common";
73
73
  export { idlToDtsString, CustomPrintVisitor } from "./from-idl/DtsPrinter";
74
74
  export { toIDLFile, addSyntheticType, resolveSyntheticType } from "./from-idl/deserialize";
75
+ export { Parser, FatalParserException } from "./from-idl/parser";
75
76
  export { D, inspectSchema } from './configDescriber';
76
77
  //# sourceMappingURL=index.js.map
@@ -6,7 +6,7 @@ export declare enum LayoutNodeRole {
6
6
  COMPONENT = 3,
7
7
  SERIALIZER = 4
8
8
  }
9
- export type LayoutTargetDescriptionHint = 'component.implementation' | 'component.interface' | 'component.function';
9
+ export type LayoutTargetDescriptionHint = 'component.implementation' | 'component.interface' | 'component.function' | 'component.modifier';
10
10
  export interface LayoutTargetDescription {
11
11
  node: IDLEntry;
12
12
  role: LayoutNodeRole;
@@ -14,7 +14,7 @@ export declare class MaterializedField {
14
14
  }
15
15
  export declare class MaterializedMethod extends PeerMethod {
16
16
  implementationParentName: string;
17
- constructor(sig: PeerMethodSignature, originalParentName: string, implementationParentName: string, returnType: idl.IDLType, isCallSignature: boolean, method: Method);
17
+ constructor(sig: PeerMethodSignature, originalParentName: string, implementationParentName: string, returnType: idl.IDLType, isCallSignature: boolean, uniqueOverloadName: string, method: Method);
18
18
  tsReturnType(): idl.IDLType | undefined;
19
19
  getPrivateMethod(): MaterializedMethod;
20
20
  withReturnType(returnType: idl.IDLType): MaterializedMethod;
@@ -27,8 +27,8 @@ export class MaterializedField {
27
27
  }
28
28
  }
29
29
  export class MaterializedMethod extends PeerMethod {
30
- constructor(sig, originalParentName, implementationParentName, returnType, isCallSignature, method) {
31
- super(sig, originalParentName, returnType, isCallSignature, method);
30
+ constructor(sig, originalParentName, implementationParentName, returnType, isCallSignature, uniqueOverloadName, method) {
31
+ super(sig, originalParentName, returnType, isCallSignature, uniqueOverloadName, method);
32
32
  this.implementationParentName = implementationParentName;
33
33
  }
34
34
  tsReturnType() {
@@ -59,7 +59,7 @@ export class MaterializedMethod extends PeerMethod {
59
59
  }
60
60
  export function copyMaterializedMethod(method, overrides) {
61
61
  var _a;
62
- return new MaterializedMethod(method.sig, method.originalParentName, method.implementationParentName, method.returnType, method.isCallSignature, (_a = overrides.method) !== null && _a !== void 0 ? _a : method.method);
62
+ return new MaterializedMethod(method.sig, method.originalParentName, method.implementationParentName, method.returnType, method.isCallSignature, method.uniqueOverloadName, (_a = overrides.method) !== null && _a !== void 0 ? _a : method.method);
63
63
  }
64
64
  export class MaterializedClass {
65
65
  constructor(decl, className, isInterface, isStaticMaterialized, superClass, interfaces, generics, fields, ctors, // zero size when used for global functions
@@ -97,7 +97,7 @@ export function createDestroyPeerMethod(clazz) {
97
97
  if (clazz.isGlobalScope() || clazz.isStaticMaterialized) {
98
98
  return undefined;
99
99
  }
100
- return new MaterializedMethod(new PeerMethodSignature(PeerMethodSignature.DESTROY, '%NEVER_USED$', [], idl.IDLVoidType, clazz.decl), idl.getQualifiedName(clazz.decl, "namespace.name").split('.').join('_'), clazz.getImplementationName(), idl.IDLVoidType, false, new Method('destroyPeer', new NamedMethodSignature(idl.IDLVoidType, [idl.createReferenceType(clazz.decl)], ['peer'])));
100
+ return new MaterializedMethod(new PeerMethodSignature(PeerMethodSignature.DESTROY, '%NEVER_USED$', [], idl.IDLVoidType, clazz.decl), idl.getQualifiedName(clazz.decl, "namespace.name").split('.').join('_'), clazz.getImplementationName(), idl.IDLVoidType, false, PeerMethodSignature.DESTROY, new Method(PeerMethodSignature.DESTROY, new NamedMethodSignature(idl.IDLVoidType, [idl.createReferenceType(clazz.decl)], ['peer'])));
101
101
  }
102
102
  export function getInternalClassName(name) {
103
103
  return `${name}Internal`;
@@ -3,6 +3,10 @@ import { PeerMethod } from "./PeerMethod";
3
3
  export interface PeerClassBase {
4
4
  generatedName(isCallSignature: boolean): string;
5
5
  }
6
+ export interface ComponentBuilderInfo {
7
+ uniqueOverloadName: string;
8
+ peerMethodName: string;
9
+ }
6
10
  export declare class PeerClass implements PeerClassBase {
7
11
  readonly file: IDLFile;
8
12
  readonly componentName: string;
@@ -10,6 +14,7 @@ export declare class PeerClass implements PeerClassBase {
10
14
  constructor(file: IDLFile, componentName: string, originalFilename: string);
11
15
  generatedName(isCallSignature: boolean): string;
12
16
  methods: PeerMethod[];
17
+ componentBuilderInfos: ComponentBuilderInfo[];
13
18
  originalClassName: string | undefined;
14
19
  originalInterfaceName: string | undefined;
15
20
  originalParentName: string | undefined;
@@ -21,6 +21,7 @@ export class PeerClass {
21
21
  this.componentName = componentName;
22
22
  this.originalFilename = originalFilename;
23
23
  this.methods = [];
24
+ this.componentBuilderInfos = [];
24
25
  this.originalClassName = undefined;
25
26
  this.originalInterfaceName = undefined;
26
27
  this.originalParentName = undefined;
@@ -36,6 +37,6 @@ export class PeerClass {
36
37
  export function createConstructPeerMethod(clazz) {
37
38
  // TODO here is class FQName needed, but can not calculate if from current PeerClass data
38
39
  const classFQN = [clazz.componentName];
39
- return new PeerMethod(new PeerMethodSignature(PeerMethodSignature.CTOR, classFQN.concat(PeerMethodSignature.CTOR).join('_'), [new PeerMethodArg('id', IDLI32Type), new PeerMethodArg('flags', IDLI32Type)], IDLPointerType), clazz.componentName, IDLPointerType, false, new Method('construct', new NamedMethodSignature(IDLPointerType, [IDLI32Type, IDLI32Type], ['id', 'flags']), [MethodModifier.STATIC]));
40
+ return new PeerMethod(new PeerMethodSignature(PeerMethodSignature.CTOR, classFQN.concat(PeerMethodSignature.CTOR).join('_'), [new PeerMethodArg('id', IDLI32Type), new PeerMethodArg('flags', IDLI32Type)], IDLPointerType), clazz.componentName, IDLPointerType, false, PeerMethodSignature.CTOR, new Method('construct', new NamedMethodSignature(IDLPointerType, [IDLI32Type, IDLI32Type], ['id', 'flags']), [MethodModifier.STATIC]));
40
41
  }
41
42
  //# sourceMappingURL=PeerClass.js.map
@@ -10297,6 +10297,7 @@ export declare class PeerLibrary implements LibraryInterface {
10297
10297
  getInteropName(node: idl.IDLNode): string;
10298
10298
  toDeclaration(type: idl.IDLType | idl.IDLTypedef | idl.IDLCallback | idl.IDLEnum | idl.IDLInterface): idl.IDLEntry | idl.IDLType;
10299
10299
  setFileLayout(strategy: LayoutManagerStrategy): void;
10300
+ withFileLayout(strategy: LayoutManagerStrategy, op: () => void): void;
10300
10301
  }
10301
10302
  export declare const ArkInt32: idl.IDLPrimitiveType;
10302
10303
  export declare const ArkInt64: idl.IDLPrimitiveType;
@@ -17,7 +17,7 @@ import * as idl from '../idl';
17
17
  import { resolveNamedNode } from '../resolveNamedNode';
18
18
  import { Language } from '../Language';
19
19
  import { createLanguageWriter } from '../LanguageWriters';
20
- import { BufferConvertor, CallbackConvertor, DateConvertor, MapConvertor, PointerConvertor, TupleConvertor, TypeAliasConvertor, AggregateConvertor, StringConvertor, ClassConvertor, ArrayConvertor, FunctionConvertor, OptionConvertor, NumberConvertor, NumericConvertor, CustomTypeConvertor, UnionConvertor, MaterializedClassConvertor, BooleanConvertor, EnumConvertor, UndefinedConvertor, VoidConvertor, ImportTypeConvertor, InterfaceConvertor, BigIntToU64Convertor, ObjectConvertor, } from "../LanguageWriters/ArgConvertors";
20
+ import { BufferConvertor, CallbackConvertor, DateConvertor, MapConvertor, PointerConvertor, TupleConvertor, TypeAliasConvertor, AggregateConvertor, StringConvertor, ClassConvertor, ArrayConvertor, FunctionConvertor, OptionConvertor, NumberConvertor, NumericConvertor, CustomTypeConvertor, UnionConvertor, MaterializedClassConvertor, BooleanConvertor, EnumConvertor, UndefinedConvertor, VoidConvertor, ImportTypeConvertor, InterfaceConvertor, BigIntToU64Convertor, ObjectConvertor, DoubleConvertor, } from "../LanguageWriters/ArgConvertors";
21
21
  import { CppNameConvertor } from '../LanguageWriters/convertors/CppConvertors';
22
22
  import { CJTypeNameConvertor } from '../LanguageWriters/convertors/CJConvertors';
23
23
  import { CppConvertor } from '../LanguageWriters/convertors/CppConvertors';
@@ -297,7 +297,7 @@ export class PeerLibrary {
297
297
  case idl.IDLU64Type: return new NumericConvertor(param, type);
298
298
  case idl.IDLF16Type: return new NumericConvertor(param, type);
299
299
  case idl.IDLF32Type: return new NumericConvertor(param, type);
300
- case idl.IDLF64Type: return new NumericConvertor(param, type);
300
+ case idl.IDLF64Type: return new DoubleConvertor(param);
301
301
  case idl.IDLBigintType: return new BigIntToU64Convertor(param);
302
302
  case idl.IDLSerializerBuffer: new PointerConvertor(param);
303
303
  case idl.IDLPointerType: return new PointerConvertor(param);
@@ -474,6 +474,12 @@ export class PeerLibrary {
474
474
  setFileLayout(strategy) {
475
475
  this.layout = new LayoutManager(strategy);
476
476
  }
477
+ withFileLayout(strategy, op) {
478
+ const old = this.layout;
479
+ this.layout = new LayoutManager(strategy);
480
+ op();
481
+ this.layout = old;
482
+ }
477
483
  }
478
484
  export const ArkInt32 = idl.IDLI32Type;
479
485
  export const ArkInt64 = idl.IDLI64Type;
@@ -8,6 +8,11 @@ export declare class PeerMethodArg {
8
8
  readonly type: idl.IDLType;
9
9
  constructor(name: string, type: idl.IDLType);
10
10
  }
11
+ export type OverloadInfo = {
12
+ postfix: string;
13
+ alias?: string;
14
+ priority?: number;
15
+ };
11
16
  export declare class PeerMethodSignature {
12
17
  readonly name: string;
13
18
  readonly fqname: string;
@@ -16,7 +21,7 @@ export declare class PeerMethodSignature {
16
21
  readonly context: idl.IDLEntry | undefined;
17
22
  readonly modifiers: (MethodModifier.FORCE_CONTEXT | MethodModifier.THROWS)[];
18
23
  constructor(name: string, fqname: string, args: PeerMethodArg[], returnType: idl.IDLType, context?: idl.IDLEntry | undefined, modifiers?: (MethodModifier.FORCE_CONTEXT | MethodModifier.THROWS)[]);
19
- static generateOverloadPostfix(decl: idl.IDLConstructor | idl.IDLMethod | idl.IDLCallable | idl.IDLProperty): string;
24
+ static mangleOverloadedName(decl: idl.IDLConstructor | idl.IDLMethod | idl.IDLCallable | idl.IDLProperty): OverloadInfo;
20
25
  static get CTOR(): string;
21
26
  static get GET_FINALIZER(): string;
22
27
  static get DESTROY(): string;
@@ -26,8 +31,9 @@ export declare class PeerMethod {
26
31
  originalParentName: string;
27
32
  returnType: IDLType;
28
33
  isCallSignature: boolean;
34
+ uniqueOverloadName: string;
29
35
  method: Method;
30
- constructor(sig: PeerMethodSignature, originalParentName: string, returnType: IDLType, isCallSignature: boolean, method: Method);
36
+ constructor(sig: PeerMethodSignature, originalParentName: string, returnType: IDLType, isCallSignature: boolean, uniqueOverloadName: string, method: Method);
31
37
  argConvertors(library: PeerLibrary): ArgConvertor[];
32
38
  argAndOutConvertors(library: PeerLibrary): ArgConvertor[];
33
39
  }
@@ -36,9 +36,15 @@ export class PeerMethodSignature {
36
36
  this.context = context;
37
37
  this.modifiers = modifiers;
38
38
  }
39
- static generateOverloadPostfix(decl) {
39
+ static mangleOverloadedName(decl) {
40
40
  if (!decl.parent)
41
- return ``;
41
+ return { postfix: "", };
42
+ let alias;
43
+ let forcedPriority;
44
+ if (idl.hasExtAttribute(decl, idl.IDLExtendedAttributes.OverloadAlias)) {
45
+ alias = idl.getExtAttribute(decl, idl.IDLExtendedAttributes.OverloadAlias);
46
+ forcedPriority = Number.parseInt(idl.getExtAttribute(decl, idl.IDLExtendedAttributes.OverloadPriority));
47
+ }
42
48
  let sameNamed = [];
43
49
  if (idl.isMethod(decl) || idl.isProperty(decl)) {
44
50
  let members = [];
@@ -59,19 +65,31 @@ export class PeerMethodSignature {
59
65
  else {
60
66
  throw new Error("unexpected type of declaration");
61
67
  }
62
- return sameNamed.length > 1 ? sameNamed.indexOf(decl).toString() : '';
68
+ return sameNamed.length > 1 ? {
69
+ postfix: sameNamed.indexOf(decl).toString(),
70
+ alias,
71
+ priority: forcedPriority !== null && forcedPriority !== void 0 ? forcedPriority : sameNamed.indexOf(decl)
72
+ } : {
73
+ postfix: '',
74
+ alias,
75
+ priority: forcedPriority,
76
+ };
63
77
  }
64
78
  static get CTOR() { return "construct"; }
65
79
  static get GET_FINALIZER() { return "getFinalizer"; }
66
80
  static get DESTROY() { return "destroyPeer"; }
67
81
  }
68
82
  export class PeerMethod {
69
- constructor(sig, originalParentName, returnType, isCallSignature, method) {
83
+ constructor(sig, originalParentName, returnType, isCallSignature,
84
+ // arkts specific feature, where overloads - are different functions grouped by overload keyword.
85
+ // Must be moved to interface description as so as `method` field
86
+ uniqueOverloadName, method) {
70
87
  var _a, _b;
71
88
  this.sig = sig;
72
89
  this.originalParentName = originalParentName;
73
90
  this.returnType = returnType;
74
91
  this.isCallSignature = isCallSignature;
92
+ this.uniqueOverloadName = uniqueOverloadName;
75
93
  this.method = method;
76
94
  // todo remove me
77
95
  if ((_a = method.modifiers) === null || _a === void 0 ? void 0 : _a.includes(MethodModifier.FORCE_CONTEXT))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@idlizer/core",
3
- "version": "2.1.9-arktscgen-9",
3
+ "version": "2.1.10-arktscgen-2",
4
4
  "description": "",
5
5
  "types": "build/lib/src/index.d.ts",
6
6
  "exports": {
@@ -27,18 +27,25 @@
27
27
  "webidl2.js/dist/**/*.js",
28
28
  "webidl2.js/package.json"
29
29
  ],
30
- "type": "module",
31
30
  "engines": {
32
31
  "npm": ">= 8",
33
32
  "node": ">= 18"
34
33
  },
35
34
  "keywords": [],
36
35
  "dependencies": {
37
- "@koalaui/interop": "1.7.6",
36
+ "@koalaui/interop": "1.7.9",
38
37
  "typescript": "4.9.5",
39
38
  "@types/node": "^18.0.0"
40
39
  },
40
+ "devDependencies": {
41
+ "@koalaui/harness": "1.7.6+devel",
42
+ "@koalaui/ets-tsc": "4.9.5-r5",
43
+ "@types/mocha": "^9.1.0",
44
+ "mocha": "^9.2.2",
45
+ "ts-node": "^10.9.2"
46
+ },
41
47
  "scripts": {
48
+ "test": "mocha",
42
49
  "clean": "rimraf -g build",
43
50
  "compile": "tsc -b ."
44
51
  }