@ts-for-gir/lib
Version:
Typescript .d.ts generator from GIR for gjs
83 lines • 2.25 kB
JavaScript
export class IntrospectedBase {
name;
doc;
metadata;
deprecated;
resolve_names = [];
_emit = true;
_commentWarning;
_isPrivate;
_isIntrospectable;
_parent;
constructor(name, parent, options = {}) {
this.name = name;
this._parent = parent;
this._isPrivate = options.isPrivate ?? false;
this._isIntrospectable = options.isIntrospectable ?? true;
this.doc = options.doc ?? null;
}
get parent() {
return this._parent;
}
/**
* Set a warning to be emitted with this node. Often used to note type
* conflicts or potential differences from GJS code.
*
* @param warning
*/
setWarning(warning) {
this._commentWarning = warning;
}
getWarning() {
return this._commentWarning;
}
get isIntrospectable() {
return this._isIntrospectable;
}
get isPrivate() {
return this._isPrivate;
}
setPrivate(priv) {
this._isPrivate = priv;
}
noEmit() {
this._emit = false;
}
get emit() {
return this._emit;
}
_copyBaseProperties(from) {
this.doc = from.doc;
this.metadata = from.metadata;
this.deprecated = from.deprecated;
this.resolve_names = from.resolve_names;
// Whether this node should be emitted.
this._emit = from._emit;
this._isPrivate = from._isPrivate;
this._isIntrospectable = from.isIntrospectable;
return this;
}
static fromXML(element, parent, options) {
throw new Error("GirBase cannot be instantiated");
}
}
export class IntrospectedNamespaceMember extends IntrospectedBase {
constructor(name, namespace, options = {}) {
super(name, namespace, options);
}
get namespace() {
return this.parent;
}
static fromXML(element, parent, options) {
throw new Error("GirBase cannot be instantiated");
}
}
export class IntrospectedClassMember extends IntrospectedBase {
get namespace() {
if (!this.parent) {
throw new Error(`Failed to get namespace for ${this.name}`);
}
return this.parent.namespace;
}
}
//# sourceMappingURL=base.js.map