@gtkx/gir 0.19.0 → 0.21.0
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/dist/index.d.ts +25 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +21 -10
- package/dist/index.js.map +1 -1
- package/dist/internal/loader.d.ts +30 -0
- package/dist/internal/loader.d.ts.map +1 -0
- package/dist/internal/loader.js +109 -0
- package/dist/internal/loader.js.map +1 -0
- package/dist/internal/normalizer.d.ts +98 -15
- package/dist/internal/normalizer.d.ts.map +1 -1
- package/dist/internal/normalizer.js +381 -412
- package/dist/internal/normalizer.js.map +1 -1
- package/dist/internal/parser.d.ts +23 -31
- package/dist/internal/parser.d.ts.map +1 -1
- package/dist/internal/parser.js +228 -244
- package/dist/internal/parser.js.map +1 -1
- package/dist/internal/raw-types.d.ts +58 -109
- package/dist/internal/raw-types.d.ts.map +1 -1
- package/dist/internal/raw-types.js +0 -8
- package/dist/internal/raw-types.js.map +1 -1
- package/dist/intrinsics.d.ts.map +1 -1
- package/dist/intrinsics.js +7 -0
- package/dist/intrinsics.js.map +1 -1
- package/dist/model/alias.d.ts +21 -0
- package/dist/model/alias.d.ts.map +1 -0
- package/dist/model/alias.js +22 -0
- package/dist/model/alias.js.map +1 -0
- package/dist/model/callables.d.ts +102 -0
- package/dist/model/callables.d.ts.map +1 -0
- package/dist/model/callables.js +123 -0
- package/dist/model/callables.js.map +1 -0
- package/dist/model/callback.d.ts +22 -0
- package/dist/model/callback.d.ts.map +1 -0
- package/dist/model/callback.js +20 -0
- package/dist/model/callback.js.map +1 -0
- package/dist/model/class.d.ts +92 -0
- package/dist/model/class.d.ts.map +1 -0
- package/dist/model/class.js +171 -0
- package/dist/model/class.js.map +1 -0
- package/dist/model/constant.d.ts +21 -0
- package/dist/model/constant.d.ts.map +1 -0
- package/dist/model/constant.js +20 -0
- package/dist/model/constant.js.map +1 -0
- package/dist/model/enumeration.d.ts +41 -0
- package/dist/model/enumeration.d.ts.map +1 -0
- package/dist/model/enumeration.js +47 -0
- package/dist/model/enumeration.js.map +1 -0
- package/dist/model/field.d.ts +21 -0
- package/dist/model/field.d.ts.map +1 -0
- package/dist/model/field.js +20 -0
- package/dist/model/field.js.map +1 -0
- package/dist/model/interface.d.ts +44 -0
- package/dist/model/interface.d.ts.map +1 -0
- package/dist/model/interface.js +67 -0
- package/dist/model/interface.js.map +1 -0
- package/dist/model/namespace.d.ts +44 -0
- package/dist/model/namespace.d.ts.map +1 -0
- package/dist/model/namespace.js +36 -0
- package/dist/model/namespace.js.map +1 -0
- package/dist/model/parameter.d.ts +43 -0
- package/dist/model/parameter.d.ts.map +1 -0
- package/dist/model/parameter.js +54 -0
- package/dist/model/parameter.js.map +1 -0
- package/dist/model/property.d.ts +62 -0
- package/dist/model/property.d.ts.map +1 -0
- package/dist/model/property.js +69 -0
- package/dist/model/property.js.map +1 -0
- package/dist/model/record.d.ts +56 -0
- package/dist/model/record.d.ts.map +1 -0
- package/dist/model/record.js +70 -0
- package/dist/model/record.js.map +1 -0
- package/dist/model/repository-like.d.ts +19 -0
- package/dist/model/repository-like.d.ts.map +1 -0
- package/dist/model/repository-like.js +2 -0
- package/dist/model/repository-like.js.map +1 -0
- package/dist/model/signal.d.ts +22 -0
- package/dist/model/signal.d.ts.map +1 -0
- package/dist/model/signal.js +22 -0
- package/dist/model/signal.js.map +1 -0
- package/dist/model/type.d.ts +71 -0
- package/dist/model/type.d.ts.map +1 -0
- package/dist/model/type.js +112 -0
- package/dist/model/type.js.map +1 -0
- package/dist/repository.d.ts +92 -138
- package/dist/repository.d.ts.map +1 -1
- package/dist/repository.js +155 -219
- package/dist/repository.js.map +1 -1
- package/package.json +4 -3
- package/src/index.ts +25 -39
- package/src/internal/loader.ts +127 -0
- package/src/internal/normalizer.ts +451 -475
- package/src/internal/parser.ts +242 -284
- package/src/internal/raw-types.ts +65 -116
- package/src/intrinsics.ts +7 -0
- package/src/model/alias.ts +31 -0
- package/src/model/callables.ts +172 -0
- package/src/model/callback.ts +30 -0
- package/src/model/class.ts +215 -0
- package/src/model/constant.ts +29 -0
- package/src/model/enumeration.ts +64 -0
- package/src/model/field.ts +29 -0
- package/src/model/interface.ts +89 -0
- package/src/model/namespace.ts +60 -0
- package/src/model/parameter.ts +74 -0
- package/src/model/property.ts +97 -0
- package/src/model/record.ts +97 -0
- package/src/model/repository-like.ts +20 -0
- package/src/model/signal.ts +32 -0
- package/src/model/type.ts +143 -0
- package/src/repository.ts +197 -283
- package/dist/types.d.ts +0 -655
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -879
- package/dist/types.js.map +0 -1
- package/src/types.ts +0 -1192
|
@@ -1,35 +1,15 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Normalizer that converts raw GIR types to normalized types.
|
|
3
|
-
*
|
|
4
|
-
* The key job is to qualify all type references with their namespace,
|
|
5
|
-
* except for intrinsic types which remain unqualified.
|
|
6
|
-
*
|
|
7
|
-
* @internal
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
1
|
import { isIntrinsicType } from "../intrinsics.js";
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
GirMethod,
|
|
23
|
-
GirNamespace,
|
|
24
|
-
GirParameter,
|
|
25
|
-
GirProperty,
|
|
26
|
-
GirRecord,
|
|
27
|
-
GirSignal,
|
|
28
|
-
GirType,
|
|
29
|
-
parseDefaultValue,
|
|
30
|
-
type QualifiedName,
|
|
31
|
-
qualifiedName,
|
|
32
|
-
} from "../types.js";
|
|
2
|
+
import { GirAlias } from "../model/alias.js";
|
|
3
|
+
import { GirConstructor, GirFunction, GirMethod } from "../model/callables.js";
|
|
4
|
+
import { GirCallback } from "../model/callback.js";
|
|
5
|
+
import { GirConstant } from "../model/constant.js";
|
|
6
|
+
import { GirEnumeration, GirEnumerationMember } from "../model/enumeration.js";
|
|
7
|
+
import { GirField } from "../model/field.js";
|
|
8
|
+
import { GirParameter } from "../model/parameter.js";
|
|
9
|
+
import { GirProperty, parseDefaultValue } from "../model/property.js";
|
|
10
|
+
import { GirRecord } from "../model/record.js";
|
|
11
|
+
import { GirSignal } from "../model/signal.js";
|
|
12
|
+
import { GirType } from "../model/type.js";
|
|
33
13
|
import type {
|
|
34
14
|
RawAlias,
|
|
35
15
|
RawCallback,
|
|
@@ -49,503 +29,499 @@ import type {
|
|
|
49
29
|
RawType,
|
|
50
30
|
} from "./raw-types.js";
|
|
51
31
|
|
|
32
|
+
type TypeIndex = Map<string, Set<string>>;
|
|
33
|
+
|
|
52
34
|
/**
|
|
53
|
-
*
|
|
54
|
-
*
|
|
35
|
+
* Data produced for a class before the repository exists.
|
|
36
|
+
* Used to defer GirClass construction until the repo is available.
|
|
55
37
|
*/
|
|
56
|
-
export type
|
|
57
|
-
|
|
58
|
-
|
|
38
|
+
export type GirClassData = {
|
|
39
|
+
name: string;
|
|
40
|
+
qualifiedName: string;
|
|
41
|
+
cType: string;
|
|
42
|
+
parent: string | null;
|
|
43
|
+
abstract: boolean;
|
|
44
|
+
glibTypeName?: string;
|
|
45
|
+
glibGetType?: string;
|
|
46
|
+
cSymbolPrefix?: string;
|
|
47
|
+
fundamental?: boolean;
|
|
48
|
+
refFunc?: string;
|
|
49
|
+
unrefFunc?: string;
|
|
50
|
+
implements: string[];
|
|
51
|
+
methods: GirMethod[];
|
|
52
|
+
constructors: GirConstructor[];
|
|
53
|
+
staticFunctions: GirFunction[];
|
|
54
|
+
properties: GirProperty[];
|
|
55
|
+
signals: GirSignal[];
|
|
56
|
+
doc?: string;
|
|
59
57
|
};
|
|
60
58
|
|
|
61
59
|
/**
|
|
62
|
-
*
|
|
60
|
+
* Data produced for an interface before the repository exists.
|
|
63
61
|
*/
|
|
64
|
-
export
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
const aliases = new Map<string, GirAlias>();
|
|
76
|
-
|
|
77
|
-
for (const rawClass of raw.classes) {
|
|
78
|
-
const normalized = normalizeClass(rawClass, nsName, ctx);
|
|
79
|
-
classes.set(normalized.name, normalized);
|
|
80
|
-
}
|
|
62
|
+
export type GirInterfaceData = {
|
|
63
|
+
name: string;
|
|
64
|
+
qualifiedName: string;
|
|
65
|
+
cType: string;
|
|
66
|
+
glibTypeName?: string;
|
|
67
|
+
prerequisites: string[];
|
|
68
|
+
methods: GirMethod[];
|
|
69
|
+
properties: GirProperty[];
|
|
70
|
+
signals: GirSignal[];
|
|
71
|
+
doc?: string;
|
|
72
|
+
};
|
|
81
73
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
74
|
+
/**
|
|
75
|
+
* Intermediate namespace data produced by the normalizer.
|
|
76
|
+
*
|
|
77
|
+
* Classes and interfaces are stored as plain data because they need
|
|
78
|
+
* the repository reference at construction time (which doesn't exist yet).
|
|
79
|
+
* All other types are fully constructed model instances.
|
|
80
|
+
*/
|
|
81
|
+
export type GirNamespaceIntermediate = {
|
|
82
|
+
name: string;
|
|
83
|
+
version: string;
|
|
84
|
+
sharedLibrary: string;
|
|
85
|
+
cPrefix: string;
|
|
86
|
+
classes: Map<string, GirClassData>;
|
|
87
|
+
interfaces: Map<string, GirInterfaceData>;
|
|
88
|
+
records: Map<string, GirRecord>;
|
|
89
|
+
enumerations: Map<string, GirEnumeration>;
|
|
90
|
+
bitfields: Map<string, GirEnumeration>;
|
|
91
|
+
callbacks: Map<string, GirCallback>;
|
|
92
|
+
functions: Map<string, GirFunction>;
|
|
93
|
+
constants: Map<string, GirConstant>;
|
|
94
|
+
aliases: Map<string, GirAlias>;
|
|
95
|
+
doc?: string;
|
|
96
|
+
};
|
|
86
97
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
98
|
+
/**
|
|
99
|
+
* Converts raw parsed GIR data into model instances with fully qualified
|
|
100
|
+
* type names.
|
|
101
|
+
*
|
|
102
|
+
* Uses indexed lookups for O(1) type name resolution and strict error
|
|
103
|
+
* handling (throws on unresolvable type references).
|
|
104
|
+
*/
|
|
105
|
+
export class GirNormalizer {
|
|
106
|
+
private typeIndex: TypeIndex = new Map();
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Normalizes all raw namespaces into intermediate namespace data.
|
|
110
|
+
*
|
|
111
|
+
* @param rawNamespaces - Raw namespaces keyed by name, in dependency order
|
|
112
|
+
* @returns Intermediate namespace data keyed by name, in the same order
|
|
113
|
+
*/
|
|
114
|
+
normalize(rawNamespaces: Map<string, RawNamespace>): Map<string, GirNamespaceIntermediate> {
|
|
115
|
+
this.typeIndex = this.buildTypeIndex(rawNamespaces);
|
|
116
|
+
|
|
117
|
+
const result = new Map<string, GirNamespaceIntermediate>();
|
|
118
|
+
for (const [name, raw] of rawNamespaces) {
|
|
119
|
+
result.set(name, this.normalizeNamespace(raw));
|
|
120
|
+
}
|
|
121
|
+
return result;
|
|
90
122
|
}
|
|
91
123
|
|
|
92
|
-
|
|
93
|
-
const
|
|
94
|
-
|
|
124
|
+
private buildTypeIndex(rawNamespaces: Map<string, RawNamespace>): TypeIndex {
|
|
125
|
+
const index: TypeIndex = new Map();
|
|
126
|
+
for (const [nsName, raw] of rawNamespaces) {
|
|
127
|
+
const names = new Set<string>();
|
|
128
|
+
for (const c of raw.classes) names.add(c.name);
|
|
129
|
+
for (const i of raw.interfaces) names.add(i.name);
|
|
130
|
+
for (const r of raw.records) names.add(r.name);
|
|
131
|
+
for (const e of raw.enumerations) names.add(e.name);
|
|
132
|
+
for (const b of raw.bitfields) names.add(b.name);
|
|
133
|
+
for (const cb of raw.callbacks) names.add(cb.name);
|
|
134
|
+
for (const a of raw.aliases) names.add(a.name);
|
|
135
|
+
index.set(nsName, names);
|
|
136
|
+
}
|
|
137
|
+
return index;
|
|
95
138
|
}
|
|
96
139
|
|
|
97
|
-
|
|
98
|
-
const
|
|
99
|
-
bitfields.set(normalized.name, normalized);
|
|
100
|
-
}
|
|
140
|
+
private normalizeNamespace(raw: RawNamespace): GirNamespaceIntermediate {
|
|
141
|
+
const nsName = raw.name;
|
|
101
142
|
|
|
102
|
-
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
|
|
143
|
+
const classes = new Map<string, GirClassData>();
|
|
144
|
+
for (const rawClass of raw.classes) {
|
|
145
|
+
const data = this.normalizeClass(rawClass, nsName);
|
|
146
|
+
classes.set(data.name, data);
|
|
147
|
+
}
|
|
106
148
|
|
|
107
|
-
|
|
108
|
-
const
|
|
109
|
-
|
|
110
|
-
|
|
149
|
+
const interfaces = new Map<string, GirInterfaceData>();
|
|
150
|
+
for (const rawIface of raw.interfaces) {
|
|
151
|
+
const data = this.normalizeInterface(rawIface, nsName);
|
|
152
|
+
interfaces.set(data.name, data);
|
|
153
|
+
}
|
|
111
154
|
|
|
112
|
-
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
|
|
155
|
+
const records = new Map<string, GirRecord>();
|
|
156
|
+
for (const rawRecord of raw.records) {
|
|
157
|
+
const record = this.normalizeRecord(rawRecord, nsName);
|
|
158
|
+
records.set(record.name, record);
|
|
159
|
+
}
|
|
116
160
|
|
|
117
|
-
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
|
|
161
|
+
const enumerations = new Map<string, GirEnumeration>();
|
|
162
|
+
for (const rawEnum of raw.enumerations) {
|
|
163
|
+
const enumeration = this.normalizeEnumeration(rawEnum, nsName);
|
|
164
|
+
enumerations.set(enumeration.name, enumeration);
|
|
165
|
+
}
|
|
121
166
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
classes,
|
|
128
|
-
interfaces,
|
|
129
|
-
records,
|
|
130
|
-
enumerations,
|
|
131
|
-
bitfields,
|
|
132
|
-
callbacks,
|
|
133
|
-
functions,
|
|
134
|
-
constants,
|
|
135
|
-
aliases,
|
|
136
|
-
doc: raw.doc,
|
|
137
|
-
});
|
|
138
|
-
};
|
|
167
|
+
const bitfields = new Map<string, GirEnumeration>();
|
|
168
|
+
for (const rawBitfield of raw.bitfields) {
|
|
169
|
+
const bitfield = this.normalizeEnumeration(rawBitfield, nsName);
|
|
170
|
+
bitfields.set(bitfield.name, bitfield);
|
|
171
|
+
}
|
|
139
172
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
currentNamespace: string,
|
|
146
|
-
ctx: NormalizerContext,
|
|
147
|
-
): QualifiedName | string => {
|
|
148
|
-
if (isIntrinsicType(typeName)) {
|
|
149
|
-
return typeName;
|
|
150
|
-
}
|
|
173
|
+
const callbacks = new Map<string, GirCallback>();
|
|
174
|
+
for (const rawCb of raw.callbacks) {
|
|
175
|
+
const cb = this.normalizeCallback(rawCb, nsName);
|
|
176
|
+
callbacks.set(cb.name, cb);
|
|
177
|
+
}
|
|
151
178
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
179
|
+
const functions = new Map<string, GirFunction>();
|
|
180
|
+
for (const rawFunc of raw.functions) {
|
|
181
|
+
const func = this.normalizeFunction(rawFunc, nsName);
|
|
182
|
+
functions.set(func.name, func);
|
|
183
|
+
}
|
|
155
184
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
185
|
+
const constants = new Map<string, GirConstant>();
|
|
186
|
+
for (const rawConst of raw.constants) {
|
|
187
|
+
const constant = this.normalizeConstant(rawConst, nsName);
|
|
188
|
+
constants.set(constant.name, constant);
|
|
189
|
+
}
|
|
160
190
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
191
|
+
const aliases = new Map<string, GirAlias>();
|
|
192
|
+
for (const rawAlias of raw.aliases) {
|
|
193
|
+
const alias = this.normalizeAlias(rawAlias, nsName);
|
|
194
|
+
aliases.set(alias.name, alias);
|
|
164
195
|
}
|
|
196
|
+
|
|
197
|
+
return {
|
|
198
|
+
name: raw.name,
|
|
199
|
+
version: raw.version,
|
|
200
|
+
sharedLibrary: raw.sharedLibrary,
|
|
201
|
+
cPrefix: raw.cPrefix,
|
|
202
|
+
classes,
|
|
203
|
+
interfaces,
|
|
204
|
+
records,
|
|
205
|
+
enumerations,
|
|
206
|
+
bitfields,
|
|
207
|
+
callbacks,
|
|
208
|
+
functions,
|
|
209
|
+
constants,
|
|
210
|
+
aliases,
|
|
211
|
+
doc: raw.doc,
|
|
212
|
+
};
|
|
165
213
|
}
|
|
166
214
|
|
|
167
|
-
|
|
168
|
-
|
|
215
|
+
private qualifyTypeName(typeName: string, currentNamespace: string): string {
|
|
216
|
+
if (isIntrinsicType(typeName)) return typeName;
|
|
217
|
+
if (typeName.includes(".")) return typeName;
|
|
169
218
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
const typeExistsInNamespace = (typeName: string, ns: RawNamespace): boolean => {
|
|
174
|
-
return (
|
|
175
|
-
ns.classes.some((c) => c.name === typeName) ||
|
|
176
|
-
ns.interfaces.some((i) => i.name === typeName) ||
|
|
177
|
-
ns.records.some((r) => r.name === typeName) ||
|
|
178
|
-
ns.enumerations.some((e) => e.name === typeName) ||
|
|
179
|
-
ns.bitfields.some((b) => b.name === typeName) ||
|
|
180
|
-
ns.callbacks.some((c) => c.name === typeName) ||
|
|
181
|
-
ns.aliases.some((a) => a.name === typeName)
|
|
182
|
-
);
|
|
183
|
-
};
|
|
219
|
+
if (this.typeIndex.get(currentNamespace)?.has(typeName)) {
|
|
220
|
+
return `${currentNamespace}.${typeName}`;
|
|
221
|
+
}
|
|
184
222
|
|
|
185
|
-
const
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
});
|
|
223
|
+
for (const [nsName, names] of this.typeIndex) {
|
|
224
|
+
if (nsName !== currentNamespace && names.has(typeName)) {
|
|
225
|
+
return `${nsName}.${typeName}`;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
191
228
|
|
|
192
|
-
|
|
193
|
-
* Normalizes a raw type to a normalized type.
|
|
194
|
-
*/
|
|
195
|
-
const normalizeType = (raw: RawType, currentNamespace: string, ctx: NormalizerContext): GirType => {
|
|
196
|
-
if (raw.containerType === "ghashtable") {
|
|
197
|
-
const typeParams = (raw.typeParameters ?? []).map((tp) => normalizeType(tp, currentNamespace, ctx));
|
|
198
|
-
return new GirType({
|
|
199
|
-
...buildContainerTypeBase(raw),
|
|
200
|
-
name: qualifiedName("GLib", "HashTable"),
|
|
201
|
-
isArray: false,
|
|
202
|
-
elementType: typeParams[1] ?? null,
|
|
203
|
-
typeParameters: typeParams,
|
|
204
|
-
});
|
|
229
|
+
return `${currentNamespace}.${typeName}`;
|
|
205
230
|
}
|
|
206
231
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
232
|
+
private normalizeType(raw: RawType, currentNamespace: string): GirType {
|
|
233
|
+
if (raw.containerType === "ghashtable") {
|
|
234
|
+
const typeParams = (raw.typeParameters ?? []).map((tp) => this.normalizeType(tp, currentNamespace));
|
|
235
|
+
return new GirType({
|
|
236
|
+
name: `GLib.HashTable`,
|
|
237
|
+
cType: raw.cType,
|
|
238
|
+
containerType: raw.containerType,
|
|
239
|
+
transferOwnership: raw.transferOwnership,
|
|
240
|
+
nullable: raw.nullable ?? false,
|
|
241
|
+
isArray: false,
|
|
242
|
+
elementType: typeParams[1] ?? null,
|
|
243
|
+
typeParameters: typeParams,
|
|
244
|
+
});
|
|
245
|
+
}
|
|
218
246
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
247
|
+
if (raw.containerType === "gptrarray" || raw.containerType === "garray") {
|
|
248
|
+
const typeParams = (raw.typeParameters ?? []).map((tp) => this.normalizeType(tp, currentNamespace));
|
|
249
|
+
const typeName = raw.containerType === "gptrarray" ? "PtrArray" : "Array";
|
|
250
|
+
return new GirType({
|
|
251
|
+
name: `GLib.${typeName}`,
|
|
252
|
+
cType: raw.cType,
|
|
253
|
+
containerType: raw.containerType,
|
|
254
|
+
transferOwnership: raw.transferOwnership,
|
|
255
|
+
nullable: raw.nullable ?? false,
|
|
256
|
+
isArray: true,
|
|
257
|
+
elementType: typeParams[0] ?? null,
|
|
258
|
+
typeParameters: typeParams,
|
|
259
|
+
});
|
|
260
|
+
}
|
|
229
261
|
|
|
230
|
-
|
|
262
|
+
if (raw.containerType === "gbytearray") {
|
|
263
|
+
const elementType = raw.elementType ? this.normalizeType(raw.elementType, currentNamespace) : null;
|
|
264
|
+
return new GirType({
|
|
265
|
+
name: `GLib.ByteArray`,
|
|
266
|
+
cType: raw.cType,
|
|
267
|
+
containerType: raw.containerType,
|
|
268
|
+
transferOwnership: raw.transferOwnership,
|
|
269
|
+
nullable: raw.nullable ?? false,
|
|
270
|
+
isArray: true,
|
|
271
|
+
elementType,
|
|
272
|
+
});
|
|
273
|
+
}
|
|
231
274
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
275
|
+
if (raw.containerType === "glist" || raw.containerType === "gslist") {
|
|
276
|
+
const elementType = raw.elementType ? this.normalizeType(raw.elementType, currentNamespace) : null;
|
|
277
|
+
return new GirType({
|
|
278
|
+
name: "array",
|
|
279
|
+
cType: raw.cType,
|
|
280
|
+
containerType: raw.containerType,
|
|
281
|
+
transferOwnership: raw.transferOwnership,
|
|
282
|
+
nullable: raw.nullable ?? false,
|
|
283
|
+
isArray: true,
|
|
284
|
+
elementType,
|
|
285
|
+
typeParameters: elementType ? [elementType] : [],
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
const isArray = raw.isArray === true || raw.name === "array";
|
|
290
|
+
|
|
291
|
+
if (isArray) {
|
|
292
|
+
return new GirType({
|
|
293
|
+
name: "array",
|
|
294
|
+
cType: raw.cType,
|
|
295
|
+
isArray: true,
|
|
296
|
+
elementType: raw.elementType ? this.normalizeType(raw.elementType, currentNamespace) : null,
|
|
297
|
+
transferOwnership: raw.transferOwnership,
|
|
298
|
+
nullable: raw.nullable ?? false,
|
|
299
|
+
sizeParamIndex: raw.sizeParamIndex,
|
|
300
|
+
zeroTerminated: raw.zeroTerminated,
|
|
301
|
+
fixedSize: raw.fixedSize,
|
|
302
|
+
});
|
|
303
|
+
}
|
|
245
304
|
|
|
246
|
-
if (isArray) {
|
|
247
305
|
return new GirType({
|
|
248
|
-
name:
|
|
306
|
+
name: this.qualifyTypeName(raw.name, currentNamespace),
|
|
249
307
|
cType: raw.cType,
|
|
250
|
-
isArray:
|
|
308
|
+
isArray: false,
|
|
251
309
|
elementType: null,
|
|
252
310
|
transferOwnership: raw.transferOwnership,
|
|
253
311
|
nullable: raw.nullable ?? false,
|
|
254
|
-
sizeParamIndex: raw.sizeParamIndex,
|
|
255
|
-
zeroTerminated: raw.zeroTerminated,
|
|
256
|
-
fixedSize: raw.fixedSize,
|
|
257
312
|
});
|
|
258
313
|
}
|
|
259
314
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
});
|
|
268
|
-
};
|
|
269
|
-
|
|
270
|
-
/**
|
|
271
|
-
* Normalizes a raw class to a normalized class.
|
|
272
|
-
*/
|
|
273
|
-
const normalizeClass = (raw: RawClass, currentNamespace: string, ctx: NormalizerContext): GirClass => {
|
|
274
|
-
const qn = qualifiedName(currentNamespace, raw.name);
|
|
275
|
-
|
|
276
|
-
let parent: QualifiedName | null = null;
|
|
277
|
-
if (raw.parent) {
|
|
278
|
-
const normalizedParent = normalizeTypeName(raw.parent, currentNamespace, ctx);
|
|
279
|
-
if (typeof normalizedParent !== "string" || normalizedParent.includes(".")) {
|
|
280
|
-
parent = normalizedParent as QualifiedName;
|
|
315
|
+
private normalizeClass(raw: RawClass, currentNamespace: string): GirClassData {
|
|
316
|
+
let parent: string | null = null;
|
|
317
|
+
if (raw.parent) {
|
|
318
|
+
const qualified = this.qualifyTypeName(raw.parent, currentNamespace);
|
|
319
|
+
if (qualified.includes(".")) {
|
|
320
|
+
parent = qualified;
|
|
321
|
+
}
|
|
281
322
|
}
|
|
282
|
-
}
|
|
283
323
|
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
properties: raw.properties.map((p) => normalizeProperty(p, currentNamespace, ctx)),
|
|
306
|
-
signals: raw.signals.map((s) => normalizeSignal(s, currentNamespace, ctx)),
|
|
307
|
-
doc: raw.doc,
|
|
308
|
-
});
|
|
309
|
-
};
|
|
324
|
+
return {
|
|
325
|
+
name: raw.name,
|
|
326
|
+
qualifiedName: `${currentNamespace}.${raw.name}`,
|
|
327
|
+
cType: raw.cType,
|
|
328
|
+
parent,
|
|
329
|
+
abstract: raw.abstract ?? false,
|
|
330
|
+
glibTypeName: raw.glibTypeName,
|
|
331
|
+
glibGetType: raw.glibGetType,
|
|
332
|
+
cSymbolPrefix: raw.cSymbolPrefix,
|
|
333
|
+
fundamental: raw.fundamental ?? false,
|
|
334
|
+
refFunc: raw.refFunc,
|
|
335
|
+
unrefFunc: raw.unrefFunc,
|
|
336
|
+
implements: raw.implements.map((impl) => this.qualifyTypeName(impl, currentNamespace)),
|
|
337
|
+
methods: raw.methods.map((m) => this.normalizeMethod(m, currentNamespace)),
|
|
338
|
+
constructors: raw.constructors.map((c) => this.normalizeConstructor(c, currentNamespace)),
|
|
339
|
+
staticFunctions: raw.functions.map((f) => this.normalizeFunction(f, currentNamespace)),
|
|
340
|
+
properties: raw.properties.map((p) => this.normalizeProperty(p, currentNamespace)),
|
|
341
|
+
signals: raw.signals.map((s) => this.normalizeSignal(s, currentNamespace)),
|
|
342
|
+
doc: raw.doc,
|
|
343
|
+
};
|
|
344
|
+
}
|
|
310
345
|
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
qualifiedName: qn,
|
|
325
|
-
cType: raw.cType,
|
|
326
|
-
glibTypeName: raw.glibTypeName,
|
|
327
|
-
prerequisites,
|
|
328
|
-
methods: raw.methods.map((m) => normalizeMethod(m, currentNamespace, ctx)),
|
|
329
|
-
properties: raw.properties.map((p) => normalizeProperty(p, currentNamespace, ctx)),
|
|
330
|
-
signals: raw.signals.map((s) => normalizeSignal(s, currentNamespace, ctx)),
|
|
331
|
-
doc: raw.doc,
|
|
332
|
-
});
|
|
333
|
-
};
|
|
346
|
+
private normalizeInterface(raw: RawInterface, currentNamespace: string): GirInterfaceData {
|
|
347
|
+
return {
|
|
348
|
+
name: raw.name,
|
|
349
|
+
qualifiedName: `${currentNamespace}.${raw.name}`,
|
|
350
|
+
cType: raw.cType,
|
|
351
|
+
glibTypeName: raw.glibTypeName,
|
|
352
|
+
prerequisites: raw.prerequisites.map((prereq) => this.qualifyTypeName(prereq, currentNamespace)),
|
|
353
|
+
methods: raw.methods.map((m) => this.normalizeMethod(m, currentNamespace)),
|
|
354
|
+
properties: raw.properties.map((p) => this.normalizeProperty(p, currentNamespace)),
|
|
355
|
+
signals: raw.signals.map((s) => this.normalizeSignal(s, currentNamespace)),
|
|
356
|
+
doc: raw.doc,
|
|
357
|
+
};
|
|
358
|
+
}
|
|
334
359
|
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
constructors: raw.constructors.map((c) => normalizeConstructor(c, currentNamespace, ctx)),
|
|
355
|
-
staticFunctions: raw.functions.map((f) => normalizeFunction(f, currentNamespace, ctx)),
|
|
356
|
-
doc: raw.doc,
|
|
357
|
-
});
|
|
358
|
-
};
|
|
360
|
+
private normalizeRecord(raw: RawRecord, currentNamespace: string): GirRecord {
|
|
361
|
+
return new GirRecord({
|
|
362
|
+
name: raw.name,
|
|
363
|
+
qualifiedName: `${currentNamespace}.${raw.name}`,
|
|
364
|
+
cType: raw.cType,
|
|
365
|
+
opaque: raw.opaque ?? false,
|
|
366
|
+
disguised: raw.disguised ?? false,
|
|
367
|
+
glibTypeName: raw.glibTypeName,
|
|
368
|
+
glibGetType: raw.glibGetType,
|
|
369
|
+
isGtypeStructFor: raw.isGtypeStructFor,
|
|
370
|
+
copyFunction: raw.copyFunction,
|
|
371
|
+
freeFunction: raw.freeFunction,
|
|
372
|
+
fields: raw.fields.map((f) => this.normalizeField(f, currentNamespace)),
|
|
373
|
+
methods: raw.methods.map((m) => this.normalizeMethod(m, currentNamespace)),
|
|
374
|
+
constructors: raw.constructors.map((c) => this.normalizeConstructor(c, currentNamespace)),
|
|
375
|
+
staticFunctions: raw.functions.map((f) => this.normalizeFunction(f, currentNamespace)),
|
|
376
|
+
doc: raw.doc,
|
|
377
|
+
});
|
|
378
|
+
}
|
|
359
379
|
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
),
|
|
379
|
-
glibGetType: raw.glibGetType,
|
|
380
|
-
doc: raw.doc,
|
|
381
|
-
});
|
|
382
|
-
};
|
|
380
|
+
private normalizeEnumeration(raw: RawEnumeration, currentNamespace: string): GirEnumeration {
|
|
381
|
+
return new GirEnumeration({
|
|
382
|
+
name: raw.name,
|
|
383
|
+
qualifiedName: `${currentNamespace}.${raw.name}`,
|
|
384
|
+
cType: raw.cType,
|
|
385
|
+
members: raw.members.map(
|
|
386
|
+
(m) =>
|
|
387
|
+
new GirEnumerationMember({
|
|
388
|
+
name: m.name,
|
|
389
|
+
value: m.value,
|
|
390
|
+
cIdentifier: m.cIdentifier,
|
|
391
|
+
doc: m.doc,
|
|
392
|
+
}),
|
|
393
|
+
),
|
|
394
|
+
glibGetType: raw.glibGetType,
|
|
395
|
+
doc: raw.doc,
|
|
396
|
+
});
|
|
397
|
+
}
|
|
383
398
|
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
returnType: normalizeType(raw.returnType, currentNamespace, ctx),
|
|
395
|
-
parameters: raw.parameters.map((p) => normalizeParameter(p, currentNamespace, ctx)),
|
|
396
|
-
doc: raw.doc,
|
|
397
|
-
});
|
|
398
|
-
};
|
|
399
|
+
private normalizeCallback(raw: RawCallback, currentNamespace: string): GirCallback {
|
|
400
|
+
return new GirCallback({
|
|
401
|
+
name: raw.name,
|
|
402
|
+
qualifiedName: `${currentNamespace}.${raw.name}`,
|
|
403
|
+
cType: raw.cType,
|
|
404
|
+
returnType: this.normalizeType(raw.returnType, currentNamespace),
|
|
405
|
+
parameters: raw.parameters.map((p) => this.normalizeParameter(p, currentNamespace)),
|
|
406
|
+
doc: raw.doc,
|
|
407
|
+
});
|
|
408
|
+
}
|
|
399
409
|
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
value: raw.value,
|
|
411
|
-
type: normalizeType(raw.type, currentNamespace, ctx),
|
|
412
|
-
doc: raw.doc,
|
|
413
|
-
});
|
|
414
|
-
};
|
|
410
|
+
private normalizeConstant(raw: RawConstant, currentNamespace: string): GirConstant {
|
|
411
|
+
return new GirConstant({
|
|
412
|
+
name: raw.name,
|
|
413
|
+
qualifiedName: `${currentNamespace}.${raw.name}`,
|
|
414
|
+
cType: raw.cType,
|
|
415
|
+
value: raw.value,
|
|
416
|
+
type: this.normalizeType(raw.type, currentNamespace),
|
|
417
|
+
doc: raw.doc,
|
|
418
|
+
});
|
|
419
|
+
}
|
|
415
420
|
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
cType: raw.cType,
|
|
426
|
-
targetType: normalizeType(raw.targetType, currentNamespace, ctx),
|
|
427
|
-
doc: raw.doc,
|
|
428
|
-
});
|
|
429
|
-
};
|
|
421
|
+
private normalizeAlias(raw: RawAlias, currentNamespace: string): GirAlias {
|
|
422
|
+
return new GirAlias({
|
|
423
|
+
name: raw.name,
|
|
424
|
+
qualifiedName: `${currentNamespace}.${raw.name}`,
|
|
425
|
+
cType: raw.cType,
|
|
426
|
+
targetType: this.normalizeType(raw.targetType, currentNamespace),
|
|
427
|
+
doc: raw.doc,
|
|
428
|
+
});
|
|
429
|
+
}
|
|
430
430
|
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
:
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
shadowedBy: raw.shadowedBy,
|
|
449
|
-
});
|
|
450
|
-
};
|
|
431
|
+
private normalizeMethod(raw: RawMethod, currentNamespace: string): GirMethod {
|
|
432
|
+
return new GirMethod({
|
|
433
|
+
name: raw.name,
|
|
434
|
+
cIdentifier: raw.cIdentifier,
|
|
435
|
+
returnType: this.normalizeType(raw.returnType, currentNamespace),
|
|
436
|
+
parameters: raw.parameters.map((p) => this.normalizeParameter(p, currentNamespace)),
|
|
437
|
+
instanceParameter: raw.instanceParameter
|
|
438
|
+
? this.normalizeParameter(raw.instanceParameter, currentNamespace)
|
|
439
|
+
: undefined,
|
|
440
|
+
throws: raw.throws ?? false,
|
|
441
|
+
doc: raw.doc,
|
|
442
|
+
returnDoc: raw.returnDoc,
|
|
443
|
+
finishFunc: raw.finishFunc,
|
|
444
|
+
shadows: raw.shadows,
|
|
445
|
+
shadowedBy: raw.shadowedBy,
|
|
446
|
+
});
|
|
447
|
+
}
|
|
451
448
|
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
throws: raw.throws ?? false,
|
|
466
|
-
doc: raw.doc,
|
|
467
|
-
returnDoc: raw.returnDoc,
|
|
468
|
-
shadows: raw.shadows,
|
|
469
|
-
shadowedBy: raw.shadowedBy,
|
|
470
|
-
});
|
|
471
|
-
};
|
|
449
|
+
private normalizeConstructor(raw: RawConstructor, currentNamespace: string): GirConstructor {
|
|
450
|
+
return new GirConstructor({
|
|
451
|
+
name: raw.name,
|
|
452
|
+
cIdentifier: raw.cIdentifier,
|
|
453
|
+
returnType: this.normalizeType(raw.returnType, currentNamespace),
|
|
454
|
+
parameters: raw.parameters.map((p) => this.normalizeParameter(p, currentNamespace)),
|
|
455
|
+
throws: raw.throws ?? false,
|
|
456
|
+
doc: raw.doc,
|
|
457
|
+
returnDoc: raw.returnDoc,
|
|
458
|
+
shadows: raw.shadows,
|
|
459
|
+
shadowedBy: raw.shadowedBy,
|
|
460
|
+
});
|
|
461
|
+
}
|
|
472
462
|
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
shadowedBy: raw.shadowedBy,
|
|
487
|
-
});
|
|
488
|
-
};
|
|
463
|
+
private normalizeFunction(raw: RawFunction, currentNamespace: string): GirFunction {
|
|
464
|
+
return new GirFunction({
|
|
465
|
+
name: raw.name,
|
|
466
|
+
cIdentifier: raw.cIdentifier,
|
|
467
|
+
returnType: this.normalizeType(raw.returnType, currentNamespace),
|
|
468
|
+
parameters: raw.parameters.map((p) => this.normalizeParameter(p, currentNamespace)),
|
|
469
|
+
throws: raw.throws ?? false,
|
|
470
|
+
doc: raw.doc,
|
|
471
|
+
returnDoc: raw.returnDoc,
|
|
472
|
+
shadows: raw.shadows,
|
|
473
|
+
shadowedBy: raw.shadowedBy,
|
|
474
|
+
});
|
|
475
|
+
}
|
|
489
476
|
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
doc: raw.doc,
|
|
506
|
-
});
|
|
507
|
-
};
|
|
477
|
+
private normalizeParameter(raw: RawParameter, currentNamespace: string): GirParameter {
|
|
478
|
+
return new GirParameter({
|
|
479
|
+
name: raw.name,
|
|
480
|
+
type: this.normalizeType(raw.type, currentNamespace),
|
|
481
|
+
direction: raw.direction ?? "in",
|
|
482
|
+
callerAllocates: raw.callerAllocates ?? false,
|
|
483
|
+
nullable: raw.nullable ?? false,
|
|
484
|
+
optional: raw.optional ?? false,
|
|
485
|
+
scope: raw.scope,
|
|
486
|
+
closure: raw.closure,
|
|
487
|
+
destroy: raw.destroy,
|
|
488
|
+
transferOwnership: raw.transferOwnership,
|
|
489
|
+
doc: raw.doc,
|
|
490
|
+
});
|
|
491
|
+
}
|
|
508
492
|
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
doc: raw.doc,
|
|
523
|
-
});
|
|
524
|
-
};
|
|
493
|
+
private normalizeProperty(raw: RawProperty, currentNamespace: string): GirProperty {
|
|
494
|
+
return new GirProperty({
|
|
495
|
+
name: raw.name,
|
|
496
|
+
type: this.normalizeType(raw.type, currentNamespace),
|
|
497
|
+
readable: raw.readable ?? true,
|
|
498
|
+
writable: raw.writable ?? false,
|
|
499
|
+
constructOnly: raw.constructOnly ?? false,
|
|
500
|
+
defaultValue: parseDefaultValue(raw.defaultValueRaw),
|
|
501
|
+
getter: raw.getter,
|
|
502
|
+
setter: raw.setter,
|
|
503
|
+
doc: raw.doc,
|
|
504
|
+
});
|
|
505
|
+
}
|
|
525
506
|
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
doc: raw.doc,
|
|
536
|
-
});
|
|
537
|
-
};
|
|
507
|
+
private normalizeSignal(raw: RawSignal, currentNamespace: string): GirSignal {
|
|
508
|
+
return new GirSignal({
|
|
509
|
+
name: raw.name,
|
|
510
|
+
when: raw.when ?? "last",
|
|
511
|
+
returnType: raw.returnType ? this.normalizeType(raw.returnType, currentNamespace) : null,
|
|
512
|
+
parameters: (raw.parameters ?? []).map((p) => this.normalizeParameter(p, currentNamespace)),
|
|
513
|
+
doc: raw.doc,
|
|
514
|
+
});
|
|
515
|
+
}
|
|
538
516
|
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
});
|
|
551
|
-
};
|
|
517
|
+
private normalizeField(raw: RawField, currentNamespace: string): GirField {
|
|
518
|
+
return new GirField({
|
|
519
|
+
name: raw.name,
|
|
520
|
+
type: this.normalizeType(raw.type, currentNamespace),
|
|
521
|
+
writable: raw.writable ?? false,
|
|
522
|
+
readable: raw.readable ?? true,
|
|
523
|
+
private: raw.private ?? false,
|
|
524
|
+
doc: raw.doc,
|
|
525
|
+
});
|
|
526
|
+
}
|
|
527
|
+
}
|