@gtkx/codegen 1.0.0-rc.4 → 1.1.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/README.md +5 -5
- package/dist/analysis/descriptor-render.d.ts +13 -9
- package/dist/analysis/descriptor-render.d.ts.map +1 -1
- package/dist/analysis/descriptor-render.js +80 -50
- package/dist/analysis/descriptor-render.js.map +1 -1
- package/dist/analysis/descriptor.d.ts +16 -7
- package/dist/analysis/descriptor.d.ts.map +1 -1
- package/dist/analysis/descriptor.js +15 -3
- package/dist/analysis/descriptor.js.map +1 -1
- package/dist/analysis/inheritance.d.ts +4 -3
- package/dist/analysis/inheritance.d.ts.map +1 -1
- package/dist/analysis/inheritance.js +103 -58
- package/dist/analysis/inheritance.js.map +1 -1
- package/dist/analysis/interface-conflicts.d.ts +23 -0
- package/dist/analysis/interface-conflicts.d.ts.map +1 -0
- package/dist/analysis/interface-conflicts.js +144 -0
- package/dist/analysis/interface-conflicts.js.map +1 -0
- package/dist/analysis/nul-terminated-bytes.d.ts +5 -0
- package/dist/analysis/nul-terminated-bytes.d.ts.map +1 -0
- package/dist/analysis/nul-terminated-bytes.js +18 -0
- package/dist/analysis/nul-terminated-bytes.js.map +1 -0
- package/dist/analysis/param-capability.d.ts +5 -0
- package/dist/analysis/param-capability.d.ts.map +1 -0
- package/dist/analysis/param-capability.js +129 -0
- package/dist/analysis/param-capability.js.map +1 -0
- package/dist/analysis/param-structure.d.ts +11 -4
- package/dist/analysis/param-structure.d.ts.map +1 -1
- package/dist/analysis/param-structure.js +42 -16
- package/dist/analysis/param-structure.js.map +1 -1
- package/dist/analysis/ts-type.d.ts.map +1 -1
- package/dist/analysis/ts-type.js +10 -17
- package/dist/analysis/ts-type.js.map +1 -1
- package/dist/analysis/type-key.d.ts +5 -0
- package/dist/analysis/type-key.d.ts.map +1 -0
- package/dist/analysis/type-key.js +9 -0
- package/dist/analysis/type-key.js.map +1 -0
- package/dist/analysis/type-shape.d.ts +8 -0
- package/dist/analysis/type-shape.d.ts.map +1 -0
- package/dist/analysis/type-shape.js +12 -0
- package/dist/analysis/type-shape.js.map +1 -0
- package/dist/compile.d.ts +12 -3
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +73 -24
- package/dist/compile.js.map +1 -1
- package/dist/docs/api-reference.d.ts +2 -2
- package/dist/docs/api-reference.d.ts.map +1 -1
- package/dist/docs/api-reference.js +17 -23
- package/dist/docs/api-reference.js.map +1 -1
- package/dist/docs/element-page.d.ts +4 -4
- package/dist/docs/element-page.d.ts.map +1 -1
- package/dist/docs/element-page.js +36 -22
- package/dist/docs/element-page.js.map +1 -1
- package/dist/docs/handwritten-props.d.ts +9 -0
- package/dist/docs/handwritten-props.d.ts.map +1 -0
- package/dist/docs/handwritten-props.js +149 -0
- package/dist/docs/handwritten-props.js.map +1 -0
- package/dist/docs/pipeline.d.ts.map +1 -1
- package/dist/docs/pipeline.js +87 -20
- package/dist/docs/pipeline.js.map +1 -1
- package/dist/docs/render.d.ts +26 -5
- package/dist/docs/render.d.ts.map +1 -1
- package/dist/docs/render.js +88 -25
- package/dist/docs/render.js.map +1 -1
- package/dist/docs/symbol-page.d.ts +17 -0
- package/dist/docs/symbol-page.d.ts.map +1 -1
- package/dist/docs/symbol-page.js +132 -44
- package/dist/docs/symbol-page.js.map +1 -1
- package/dist/fingerprint.d.ts +12 -1
- package/dist/fingerprint.d.ts.map +1 -1
- package/dist/fingerprint.js +44 -28
- package/dist/fingerprint.js.map +1 -1
- package/dist/gi.d.ts.map +1 -1
- package/dist/gi.js +1 -0
- package/dist/gi.js.map +1 -1
- package/dist/gir/ancestry.d.ts +8 -2
- package/dist/gir/ancestry.d.ts.map +1 -1
- package/dist/gir/ancestry.js +19 -1
- package/dist/gir/ancestry.js.map +1 -1
- package/dist/gir/annotations.d.ts +21 -0
- package/dist/gir/annotations.d.ts.map +1 -0
- package/dist/gir/annotations.js +15 -0
- package/dist/gir/annotations.js.map +1 -0
- package/dist/gir/callback.d.ts +1 -0
- package/dist/gir/callback.d.ts.map +1 -1
- package/dist/gir/callback.js +1 -0
- package/dist/gir/callback.js.map +1 -1
- package/dist/gir/class.d.ts +32 -1
- package/dist/gir/class.d.ts.map +1 -1
- package/dist/gir/class.js +8 -3
- package/dist/gir/class.js.map +1 -1
- package/dist/gir/cursor-overrides.d.ts +8 -0
- package/dist/gir/cursor-overrides.d.ts.map +1 -0
- package/dist/gir/cursor-overrides.js +6 -0
- package/dist/gir/cursor-overrides.js.map +1 -0
- package/dist/gir/emittable.d.ts +7 -0
- package/dist/gir/emittable.d.ts.map +1 -0
- package/dist/gir/emittable.js +3 -0
- package/dist/gir/emittable.js.map +1 -0
- package/dist/gir/enum.d.ts +21 -1
- package/dist/gir/enum.d.ts.map +1 -1
- package/dist/gir/enum.js +9 -9
- package/dist/gir/enum.js.map +1 -1
- package/dist/gir/field.d.ts +19 -3
- package/dist/gir/field.d.ts.map +1 -1
- package/dist/gir/field.js +7 -8
- package/dist/gir/field.js.map +1 -1
- package/dist/gir/function.d.ts +15 -0
- package/dist/gir/function.d.ts.map +1 -1
- package/dist/gir/function.js +28 -2
- package/dist/gir/function.js.map +1 -1
- package/dist/gir/libraries.d.ts +1 -3
- package/dist/gir/libraries.d.ts.map +1 -1
- package/dist/gir/libraries.js +0 -1
- package/dist/gir/libraries.js.map +1 -1
- package/dist/gir/library.d.ts +36 -0
- package/dist/gir/library.d.ts.map +1 -1
- package/dist/gir/library.js +35 -1
- package/dist/gir/library.js.map +1 -1
- package/dist/gir/namespace.d.ts +43 -1
- package/dist/gir/namespace.d.ts.map +1 -1
- package/dist/gir/namespace.js +8 -7
- package/dist/gir/namespace.js.map +1 -1
- package/dist/gir/parameter.d.ts +52 -1
- package/dist/gir/parameter.d.ts.map +1 -1
- package/dist/gir/parameter.js +8 -3
- package/dist/gir/parameter.js.map +1 -1
- package/dist/gir/parse.d.ts +3 -1
- package/dist/gir/parse.d.ts.map +1 -1
- package/dist/gir/parse.js +9 -9
- package/dist/gir/parse.js.map +1 -1
- package/dist/gir/primitives.d.ts +1 -0
- package/dist/gir/primitives.d.ts.map +1 -1
- package/dist/gir/primitives.js.map +1 -1
- package/dist/gir/property.d.ts +16 -0
- package/dist/gir/property.d.ts.map +1 -1
- package/dist/gir/property.js +3 -3
- package/dist/gir/property.js.map +1 -1
- package/dist/gir/record.d.ts +22 -0
- package/dist/gir/record.d.ts.map +1 -1
- package/dist/gir/record.js +3 -2
- package/dist/gir/record.js.map +1 -1
- package/dist/gir/size.d.ts +5 -4
- package/dist/gir/size.d.ts.map +1 -1
- package/dist/gir/size.js.map +1 -1
- package/dist/gir/type-id.d.ts +35 -0
- package/dist/gir/type-id.d.ts.map +1 -1
- package/dist/gir/type-id.js +1 -0
- package/dist/gir/type-id.js.map +1 -1
- package/dist/gir/type-ref.d.ts.map +1 -1
- package/dist/gir/type-ref.js +1 -0
- package/dist/gir/type-ref.js.map +1 -1
- package/dist/gir/type.d.ts +20 -0
- package/dist/gir/type.d.ts.map +1 -1
- package/dist/gir/type.js.map +1 -1
- package/dist/guards.d.ts +16 -0
- package/dist/guards.d.ts.map +1 -0
- package/dist/guards.js +11 -0
- package/dist/guards.js.map +1 -0
- package/dist/internal.d.ts +2 -0
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +2 -0
- package/dist/internal.js.map +1 -1
- package/dist/json.d.ts +3 -0
- package/dist/json.d.ts.map +1 -0
- package/dist/json.js +11 -0
- package/dist/json.js.map +1 -0
- package/dist/khronos/args.d.ts +7 -6
- package/dist/khronos/args.d.ts.map +1 -1
- package/dist/khronos/args.js +28 -6
- package/dist/khronos/args.js.map +1 -1
- package/dist/khronos/doc-context.d.ts +29 -0
- package/dist/khronos/doc-context.d.ts.map +1 -0
- package/dist/khronos/doc-context.js +29 -0
- package/dist/khronos/doc-context.js.map +1 -0
- package/dist/khronos/extensions.d.ts +13 -0
- package/dist/khronos/extensions.d.ts.map +1 -0
- package/dist/khronos/extensions.js +49 -0
- package/dist/khronos/extensions.js.map +1 -0
- package/dist/khronos/jsdoc.d.ts +17 -11
- package/dist/khronos/jsdoc.d.ts.map +1 -1
- package/dist/khronos/jsdoc.js +104 -46
- package/dist/khronos/jsdoc.js.map +1 -1
- package/dist/khronos/model.d.ts +42 -3
- package/dist/khronos/model.d.ts.map +1 -1
- package/dist/khronos/model.js +218 -63
- package/dist/khronos/model.js.map +1 -1
- package/dist/khronos/modules.d.ts +9 -6
- package/dist/khronos/modules.d.ts.map +1 -1
- package/dist/khronos/modules.js +112 -27
- package/dist/khronos/modules.js.map +1 -1
- package/dist/khronos/notes.d.ts +19 -0
- package/dist/khronos/notes.d.ts.map +1 -0
- package/dist/khronos/notes.js +35 -0
- package/dist/khronos/notes.js.map +1 -0
- package/dist/khronos/param-pair.d.ts +1 -1
- package/dist/khronos/param-pair.d.ts.map +1 -1
- package/dist/khronos/param-pair.js.map +1 -1
- package/dist/khronos/parse.d.ts.map +1 -1
- package/dist/khronos/parse.js +3 -4
- package/dist/khronos/parse.js.map +1 -1
- package/dist/khronos/pipeline.d.ts +4 -2
- package/dist/khronos/pipeline.d.ts.map +1 -1
- package/dist/khronos/pipeline.js +58 -27
- package/dist/khronos/pipeline.js.map +1 -1
- package/dist/khronos/plan.d.ts +3 -9
- package/dist/khronos/plan.d.ts.map +1 -1
- package/dist/khronos/plan.js +3 -3
- package/dist/khronos/plan.js.map +1 -1
- package/dist/khronos/render.d.ts +8 -6
- package/dist/khronos/render.d.ts.map +1 -1
- package/dist/khronos/render.js +35 -26
- package/dist/khronos/render.js.map +1 -1
- package/dist/khronos/select.d.ts +21 -4
- package/dist/khronos/select.d.ts.map +1 -1
- package/dist/khronos/select.js +47 -34
- package/dist/khronos/select.js.map +1 -1
- package/dist/react/element-config.d.ts +2 -2
- package/dist/react/element-config.d.ts.map +1 -1
- package/dist/react/element-config.js.map +1 -1
- package/dist/runner.d.ts +6 -8
- package/dist/runner.d.ts.map +1 -1
- package/dist/runner.js +16 -0
- package/dist/runner.js.map +1 -1
- package/dist/staging.d.ts +5 -0
- package/dist/staging.d.ts.map +1 -0
- package/dist/staging.js +57 -0
- package/dist/staging.js.map +1 -0
- package/dist/store/compile-store.d.ts +1 -1
- package/dist/store/compile-store.d.ts.map +1 -1
- package/dist/store/compile-store.js +4 -2
- package/dist/store/compile-store.js.map +1 -1
- package/dist/store/gi/callable-doc.d.ts +11 -0
- package/dist/store/gi/callable-doc.d.ts.map +1 -0
- package/dist/store/gi/callable-doc.js +62 -0
- package/dist/store/gi/callable-doc.js.map +1 -0
- package/dist/store/gi/callables.d.ts +9 -2
- package/dist/store/gi/callables.d.ts.map +1 -1
- package/dist/store/gi/callables.js +35 -40
- package/dist/store/gi/callables.js.map +1 -1
- package/dist/store/gi/callback.d.ts.map +1 -1
- package/dist/store/gi/callback.js +10 -6
- package/dist/store/gi/callback.js.map +1 -1
- package/dist/store/gi/class.d.ts.map +1 -1
- package/dist/store/gi/class.js +63 -40
- package/dist/store/gi/class.js.map +1 -1
- package/dist/store/gi/closure-invocation.d.ts +4 -0
- package/dist/store/gi/closure-invocation.d.ts.map +1 -0
- package/dist/store/gi/closure-invocation.js +22 -0
- package/dist/store/gi/closure-invocation.js.map +1 -0
- package/dist/store/gi/companion.d.ts.map +1 -1
- package/dist/store/gi/companion.js +6 -6
- package/dist/store/gi/companion.js.map +1 -1
- package/dist/store/gi/constant.d.ts.map +1 -1
- package/dist/store/gi/constant.js +12 -3
- package/dist/store/gi/constant.js.map +1 -1
- package/dist/store/gi/constructor-props.d.ts.map +1 -1
- package/dist/store/gi/constructor-props.js +18 -20
- package/dist/store/gi/constructor-props.js.map +1 -1
- package/dist/store/gi/doc-spec.d.ts +14 -0
- package/dist/store/gi/doc-spec.d.ts.map +1 -0
- package/dist/store/gi/doc-spec.js +23 -0
- package/dist/store/gi/doc-spec.js.map +1 -0
- package/dist/store/gi/enum.d.ts.map +1 -1
- package/dist/store/gi/enum.js +52 -19
- package/dist/store/gi/enum.js.map +1 -1
- package/dist/store/gi/function.d.ts +1 -3
- package/dist/store/gi/function.d.ts.map +1 -1
- package/dist/store/gi/function.js +50 -29
- package/dist/store/gi/function.js.map +1 -1
- package/dist/store/gi/gtype-binding.d.ts.map +1 -1
- package/dist/store/gi/gtype-binding.js +4 -1
- package/dist/store/gi/gtype-binding.js.map +1 -1
- package/dist/store/gi/interface.d.ts.map +1 -1
- package/dist/store/gi/interface.js +155 -26
- package/dist/store/gi/interface.js.map +1 -1
- package/dist/store/gi/item-comparators.d.ts.map +1 -1
- package/dist/store/gi/item-comparators.js +3 -5
- package/dist/store/gi/item-comparators.js.map +1 -1
- package/dist/store/gi/method.d.ts +11 -2
- package/dist/store/gi/method.d.ts.map +1 -1
- package/dist/store/gi/method.js +80 -45
- package/dist/store/gi/method.js.map +1 -1
- package/dist/store/gi/param-marshal.d.ts +6 -2
- package/dist/store/gi/param-marshal.d.ts.map +1 -1
- package/dist/store/gi/param-marshal.js +54 -5
- package/dist/store/gi/param-marshal.js.map +1 -1
- package/dist/store/gi/pipeline.d.ts.map +1 -1
- package/dist/store/gi/pipeline.js +23 -11
- package/dist/store/gi/pipeline.js.map +1 -1
- package/dist/store/gi/properties.d.ts +2 -1
- package/dist/store/gi/properties.d.ts.map +1 -1
- package/dist/store/gi/properties.js +7 -4
- package/dist/store/gi/properties.js.map +1 -1
- package/dist/store/gi/property-accessor.d.ts +12 -5
- package/dist/store/gi/property-accessor.d.ts.map +1 -1
- package/dist/store/gi/property-accessor.js +98 -46
- package/dist/store/gi/property-accessor.js.map +1 -1
- package/dist/store/gi/record-constructor.d.ts +8 -1
- package/dist/store/gi/record-constructor.d.ts.map +1 -1
- package/dist/store/gi/record-constructor.js +34 -11
- package/dist/store/gi/record-constructor.js.map +1 -1
- package/dist/store/gi/record-field-accessor.d.ts +3 -1
- package/dist/store/gi/record-field-accessor.d.ts.map +1 -1
- package/dist/store/gi/record-field-accessor.js +8 -3
- package/dist/store/gi/record-field-accessor.js.map +1 -1
- package/dist/store/gi/record-layout.d.ts +6 -1
- package/dist/store/gi/record-layout.d.ts.map +1 -1
- package/dist/store/gi/record-layout.js +9 -2
- package/dist/store/gi/record-layout.js.map +1 -1
- package/dist/store/gi/record.d.ts.map +1 -1
- package/dist/store/gi/record.js +21 -9
- package/dist/store/gi/record.js.map +1 -1
- package/dist/store/gi/registration.d.ts +1 -1
- package/dist/store/gi/registration.js +4 -4
- package/dist/store/gi/registration.js.map +1 -1
- package/dist/store/gi/runtime-override.d.ts +2 -1
- package/dist/store/gi/runtime-override.d.ts.map +1 -1
- package/dist/store/gi/runtime-override.js +8 -5
- package/dist/store/gi/runtime-override.js.map +1 -1
- package/dist/store/gi/signal.d.ts +2 -1
- package/dist/store/gi/signal.d.ts.map +1 -1
- package/dist/store/gi/signal.js +42 -37
- package/dist/store/gi/signal.js.map +1 -1
- package/dist/store/gi/value-marshalable.d.ts +1 -2
- package/dist/store/gi/value-marshalable.d.ts.map +1 -1
- package/dist/store/gi/value-marshalable.js +3 -2
- package/dist/store/gi/value-marshalable.js.map +1 -1
- package/dist/store/gi/vtable.d.ts +19 -1
- package/dist/store/gi/vtable.d.ts.map +1 -1
- package/dist/store/gi/vtable.js +257 -51
- package/dist/store/gi/vtable.js.map +1 -1
- package/dist/store/gi-store.d.ts +1 -0
- package/dist/store/gi-store.d.ts.map +1 -1
- package/dist/store/gi-store.js +15 -20
- package/dist/store/gi-store.js.map +1 -1
- package/dist/store/jsx/element-components.d.ts +1 -1
- package/dist/store/jsx/element-components.d.ts.map +1 -1
- package/dist/store/jsx/element-components.js +6 -4
- package/dist/store/jsx/element-components.js.map +1 -1
- package/dist/store/jsx/element-prop-imports.d.ts +1 -3
- package/dist/store/jsx/element-prop-imports.d.ts.map +1 -1
- package/dist/store/jsx/element-prop-imports.js.map +1 -1
- package/dist/store/jsx/element-prop-types.d.ts +3 -0
- package/dist/store/jsx/element-prop-types.d.ts.map +1 -1
- package/dist/store/jsx/element-prop-types.js +7 -1
- package/dist/store/jsx/element-prop-types.js.map +1 -1
- package/dist/store/jsx/generated-elements.d.ts +2 -1
- package/dist/store/jsx/generated-elements.d.ts.map +1 -1
- package/dist/store/jsx/generated-elements.js +13 -7
- package/dist/store/jsx/generated-elements.js.map +1 -1
- package/dist/store/jsx/intrinsic-elements.d.ts +4 -0
- package/dist/store/jsx/intrinsic-elements.d.ts.map +1 -1
- package/dist/store/jsx/intrinsic-elements.js.map +1 -1
- package/dist/store/jsx/jsx.d.ts.map +1 -1
- package/dist/store/jsx/jsx.js +10 -9
- package/dist/store/jsx/jsx.js.map +1 -1
- package/dist/store/jsx/metadata.d.ts.map +1 -1
- package/dist/store/jsx/metadata.js +5 -3
- package/dist/store/jsx/metadata.js.map +1 -1
- package/dist/store/jsx/pipeline.d.ts +1 -1
- package/dist/store/jsx/pipeline.d.ts.map +1 -1
- package/dist/store/jsx/pipeline.js.map +1 -1
- package/dist/store/jsx/props.d.ts +1 -7
- package/dist/store/jsx/props.d.ts.map +1 -1
- package/dist/store/jsx/props.js +14 -6
- package/dist/store/jsx/props.js.map +1 -1
- package/dist/store/jsx-store.d.ts.map +1 -1
- package/dist/store/jsx-store.js +3 -3
- package/dist/store/jsx-store.js.map +1 -1
- package/dist/store/resolve-store.d.ts +14 -3
- package/dist/store/resolve-store.d.ts.map +1 -1
- package/dist/store/resolve-store.js +98 -15
- package/dist/store/resolve-store.js.map +1 -1
- package/dist/store/store-fs.d.ts +9 -6
- package/dist/store/store-fs.d.ts.map +1 -1
- package/dist/store/store-fs.js +59 -25
- package/dist/store/store-fs.js.map +1 -1
- package/dist/store/store-links.d.ts +3 -0
- package/dist/store/store-links.d.ts.map +1 -0
- package/dist/store/store-links.js +39 -0
- package/dist/store/store-links.js.map +1 -0
- package/dist/writer/comparison-context.d.ts +4 -0
- package/dist/writer/comparison-context.d.ts.map +1 -0
- package/dist/writer/comparison-context.js +13 -0
- package/dist/writer/comparison-context.js.map +1 -0
- package/dist/writer/context.d.ts +3 -2
- package/dist/writer/context.d.ts.map +1 -1
- package/dist/writer/context.js +11 -3
- package/dist/writer/context.js.map +1 -1
- package/dist/writer/doc-tags.d.ts +21 -0
- package/dist/writer/doc-tags.d.ts.map +1 -0
- package/dist/writer/doc-tags.js +38 -0
- package/dist/writer/doc-tags.js.map +1 -0
- package/dist/writer/doc.d.ts +3 -1
- package/dist/writer/doc.d.ts.map +1 -1
- package/dist/writer/doc.js +19 -6
- package/dist/writer/doc.js.map +1 -1
- package/dist/writer/gtk-doc.d.ts +1 -1
- package/dist/writer/gtk-doc.d.ts.map +1 -1
- package/dist/writer/gtk-doc.js +64 -15
- package/dist/writer/gtk-doc.js.map +1 -1
- package/dist/writer/module.d.ts +17 -3
- package/dist/writer/module.d.ts.map +1 -1
- package/dist/writer/module.js +72 -3
- package/dist/writer/module.js.map +1 -1
- package/dist/xml.d.ts +7 -1
- package/dist/xml.d.ts.map +1 -1
- package/dist/xml.js +43 -1
- package/dist/xml.js.map +1 -1
- package/overrides/gdk/rgba.ts.ejs +26 -0
- package/overrides/gobject/object.ts.ejs +48 -3
- package/overrides/gobject/value.ts.ejs +7 -0
- package/overrides/graphene/structs.ts.ejs +55 -0
- package/package.json +15 -4
- package/src/analysis/descriptor-render.ts +130 -66
- package/src/analysis/descriptor.ts +35 -11
- package/src/analysis/inheritance.ts +166 -75
- package/src/analysis/interface-conflicts.ts +237 -0
- package/src/analysis/nul-terminated-bytes.ts +31 -0
- package/src/analysis/param-capability.ts +169 -0
- package/src/analysis/param-structure.ts +85 -25
- package/src/analysis/ts-type.ts +13 -17
- package/src/analysis/type-key.ts +14 -0
- package/src/analysis/type-shape.ts +24 -0
- package/src/compile.ts +110 -26
- package/src/docs/api-reference.ts +46 -34
- package/src/docs/element-page.ts +58 -49
- package/src/docs/handwritten-props.ts +230 -0
- package/src/docs/pipeline.ts +131 -21
- package/src/docs/render.ts +153 -35
- package/src/docs/symbol-page.ts +230 -80
- package/src/fingerprint.ts +86 -32
- package/src/gi.ts +1 -0
- package/src/gir/ancestry.ts +31 -1
- package/src/gir/annotations.ts +37 -0
- package/src/gir/callback.ts +2 -0
- package/src/gir/class.ts +42 -4
- package/src/gir/cursor-overrides.ts +12 -0
- package/src/gir/emittable.ts +8 -0
- package/src/gir/enum.ts +30 -10
- package/src/gir/field.ts +24 -9
- package/src/gir/function.ts +60 -9
- package/src/gir/libraries.ts +11 -3
- package/src/gir/library.ts +52 -3
- package/src/gir/namespace.ts +49 -7
- package/src/gir/parameter.ts +62 -3
- package/src/gir/parse.ts +13 -9
- package/src/gir/primitives.ts +1 -0
- package/src/gir/property.ts +18 -3
- package/src/gir/record.ts +24 -2
- package/src/gir/size.ts +8 -3
- package/src/gir/type-id.ts +49 -3
- package/src/gir/type-ref.ts +1 -0
- package/src/gir/type.ts +50 -6
- package/src/guards.ts +23 -0
- package/src/internal.ts +2 -0
- package/src/json.ts +11 -0
- package/src/khronos/args.ts +36 -13
- package/src/khronos/doc-context.ts +62 -0
- package/src/khronos/extensions.ts +85 -0
- package/src/khronos/jsdoc.ts +152 -56
- package/src/khronos/model.ts +314 -69
- package/src/khronos/modules.ts +150 -40
- package/src/khronos/notes.ts +74 -0
- package/src/khronos/param-pair.ts +1 -1
- package/src/khronos/parse.ts +3 -4
- package/src/khronos/pipeline.ts +95 -42
- package/src/khronos/plan.ts +4 -6
- package/src/khronos/render.ts +62 -50
- package/src/khronos/select.ts +91 -50
- package/src/react/element-config.ts +2 -2
- package/src/runner.ts +20 -9
- package/src/staging.ts +69 -0
- package/src/store/compile-store.ts +7 -5
- package/src/store/gi/callable-doc.ts +102 -0
- package/src/store/gi/callables.ts +58 -44
- package/src/store/gi/callback.ts +10 -9
- package/src/store/gi/class.ts +83 -49
- package/src/store/gi/closure-invocation.ts +26 -0
- package/src/store/gi/companion.ts +7 -6
- package/src/store/gi/constant.ts +14 -5
- package/src/store/gi/constructor-props.ts +19 -23
- package/src/store/gi/doc-spec.ts +38 -0
- package/src/store/gi/enum.ts +75 -26
- package/src/store/gi/function.ts +72 -44
- package/src/store/gi/gtype-binding.ts +7 -2
- package/src/store/gi/interface.ts +244 -37
- package/src/store/gi/item-comparators.ts +3 -5
- package/src/store/gi/method.ts +124 -69
- package/src/store/gi/param-marshal.ts +91 -6
- package/src/store/gi/pipeline.ts +28 -13
- package/src/store/gi/properties.ts +10 -5
- package/src/store/gi/property-accessor.ts +163 -75
- package/src/store/gi/record-constructor.ts +56 -19
- package/src/store/gi/record-field-accessor.ts +13 -4
- package/src/store/gi/record-layout.ts +12 -2
- package/src/store/gi/record.ts +24 -10
- package/src/store/gi/registration.ts +5 -5
- package/src/store/gi/runtime-override.ts +13 -6
- package/src/store/gi/signal.ts +54 -57
- package/src/store/gi/value-marshalable.ts +4 -2
- package/src/store/gi/vtable.ts +439 -61
- package/src/store/gi-store.ts +26 -31
- package/src/store/jsx/element-components.ts +8 -5
- package/src/store/jsx/element-prop-imports.ts +1 -3
- package/src/store/jsx/element-prop-types.ts +10 -1
- package/src/store/jsx/generated-elements.ts +17 -8
- package/src/store/jsx/intrinsic-elements.ts +4 -0
- package/src/store/jsx/jsx.ts +11 -9
- package/src/store/jsx/metadata.ts +6 -3
- package/src/store/jsx/pipeline.ts +1 -1
- package/src/store/jsx/props.ts +20 -7
- package/src/store/jsx-store.ts +3 -3
- package/src/store/resolve-store.ts +133 -18
- package/src/store/store-fs.ts +87 -34
- package/src/store/store-links.ts +49 -0
- package/src/writer/comparison-context.ts +18 -0
- package/src/writer/context.ts +14 -4
- package/src/writer/doc-tags.ts +70 -0
- package/src/writer/doc.ts +29 -6
- package/src/writer/gtk-doc.ts +82 -15
- package/src/writer/module.ts +114 -4
- package/src/xml.ts +61 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"value-marshalable.d.ts","sourceRoot":"","sources":["../../../src/store/gi/value-marshalable.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"value-marshalable.d.ts","sourceRoot":"","sources":["../../../src/store/gi/value-marshalable.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AA6E7D,QAAA,MAAM,kBAAkB,GAAI,SAAS,aAAa,EAAE,eAAe,MAAM,EAAE,QAAQ,SAAS,KAAG,OACb,CAAC;AAEnF,QAAA,MAAM,qBAAqB,GAAI,SAAS,aAAa,EAAE,eAAe,MAAM,EAAE,QAAQ,SAAS,KAAG,OACgB,CAAC;AAEnH,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -2,6 +2,7 @@ const POINTER_CATEGORIES = new Set(["string", "pointer"]);
|
|
|
2
2
|
const recordKey = (namespaceName, record) => `${namespaceName}.${record.name}`;
|
|
3
3
|
const hasOwnCopySemantics = (record) => record.glibGetType !== undefined ||
|
|
4
4
|
((record.glibRefFunc ?? record.copyFunc) !== undefined && (record.glibUnrefFunc ?? record.freeFunc) !== undefined);
|
|
5
|
+
const isOpaqueRecord = (record) => record.opaque || record.disguised;
|
|
5
6
|
const isValueSafeArray = (scope, type) => type.fixedSize !== undefined && isValueSafeRef(scope, type.element, type.elementCType);
|
|
6
7
|
const isValueSafeAlias = (scope, type) => isValueSafeRef(scope, type.value.target, type.value.targetCType);
|
|
7
8
|
function isValueSafeType(scope, type) {
|
|
@@ -52,6 +53,6 @@ function isValueSafeRecord(scope, namespaceName, record) {
|
|
|
52
53
|
return isSafe;
|
|
53
54
|
}
|
|
54
55
|
const isValueMarshalable = (context, namespaceName, record) => isValueSafeRecord({ context, seen: new Set() }, namespaceName, record);
|
|
55
|
-
const isConstructibleRecord = (context, namespaceName, record) => hasOwnCopySemantics(record) || isValueMarshalable(context, namespaceName, record);
|
|
56
|
-
export {
|
|
56
|
+
const isConstructibleRecord = (context, namespaceName, record) => !isOpaqueRecord(record) && (hasOwnCopySemantics(record) || isValueMarshalable(context, namespaceName, record));
|
|
57
|
+
export { isConstructibleRecord, isValueMarshalable };
|
|
57
58
|
//# sourceMappingURL=value-marshalable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"value-marshalable.js","sourceRoot":"","sources":["../../../src/store/gi/value-marshalable.ts"],"names":[],"mappings":"AASA,MAAM,kBAAkB,GAA2B,IAAI,GAAG,CAAoB,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC;AAErG,MAAM,SAAS,GAAG,CAAC,aAAqB,EAAE,MAAiB,EAAU,EAAE,CAAC,GAAG,aAAa,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;AAE1G,MAAM,mBAAmB,GAAG,CAAC,MAAiB,EAAW,EAAE,CACvD,MAAM,CAAC,WAAW,KAAK,SAAS;IAChC,CAAC,CAAC,MAAM,CAAC,WAAW,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,SAAS,IAAI,CAAC,MAAM,CAAC,aAAa,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,SAAS,CAAC,CAAC;AAEvH,MAAM,gBAAgB,GAAG,CAAC,KAAY,EAAE,IAA0C,EAAW,EAAE,CAC3F,IAAI,CAAC,SAAS,KAAK,SAAS,IAAI,cAAc,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;AAE3F,MAAM,gBAAgB,GAAG,CAAC,KAAY,EAAE,IAAyC,EAAW,EAAE,CAC1F,cAAc,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;AAErE,SAAS,eAAe,CAAC,KAAY,EAAE,IAAa;IAChD,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;QAChB,KAAK,WAAW,CAAC,CAAC,CAAC;YACf,OAAO,CAAC,kBAAkB,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CA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;AAEjF,SAAS,iBAAiB,CAAC,KAAY,EAAE,aAAqB,EAAE,MAAiB;IAC7E,MAAM,GAAG,GAAG,SAAS,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;IAE7C,IAAI,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACpD,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACpB,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,gBAAgB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;IAC9E,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAEvB,OAAO,MAAM,CAAC;AAClB,CAAC;AAED,MAAM,kBAAkB,GAAG,CAAC,OAAsB,EAAE,aAAqB,EAAE,MAAiB,EAAW,EAAE,CACrG,iBAAiB,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,GAAG,EAAU,EAAE,EAAE,aAAa,EAAE,MAAM,CAAC,CAAC;AAEnF,MAAM,qBAAqB,GAAG,CAAC,OAAsB,EAAE,aAAqB,EAAE,MAAiB,EAAW,EAAE,CACxG,CAAC,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,IAAI,kBAAkB,CAAC,OAAO,EAAE,aAAa,EAAE,MAAM,CAAC,CAAC,CAAC;AAEnH,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,CAAC","sourcesContent":["import type { GirField } from \"../../gir/field.js\";\nimport type { PrimitiveCategory } from \"../../gir/primitives.js\";\nimport type { GirRecord } from \"../../gir/record.js\";\nimport type { TypeId } from \"../../gir/type-id.js\";\nimport type { GirType } from \"../../gir/type.js\";\nimport type { ModuleContext } from \"../../writer/context.js\";\n\ntype Scope = { context: ModuleContext; seen: Set<string> };\n\nconst POINTER_CATEGORIES: Set<PrimitiveCategory> = new Set<PrimitiveCategory>([\"string\", \"pointer\"]);\n\nconst recordKey = (namespaceName: string, record: GirRecord): string => `${namespaceName}.${record.name}`;\n\nconst hasOwnCopySemantics = (record: GirRecord): boolean =>\n record.glibGetType !== undefined ||\n ((record.glibRefFunc ?? record.copyFunc) !== undefined && (record.glibUnrefFunc ?? record.freeFunc) !== undefined);\n\nconst isOpaqueRecord = (record: GirRecord): boolean => record.opaque || record.disguised;\n\nconst isValueSafeArray = (scope: Scope, type: Extract<GirType, { kind: \"carray\" }>): boolean =>\n type.fixedSize !== undefined && isValueSafeRef(scope, type.element, type.elementCType);\n\nconst isValueSafeAlias = (scope: Scope, type: Extract<GirType, { kind: \"alias\" }>): boolean =>\n isValueSafeRef(scope, type.value.target, type.value.targetCType);\n\nfunction isValueSafeType(scope: Scope, type: GirType): boolean {\n switch (type.kind) {\n case \"primitive\": {\n return !POINTER_CATEGORIES.has(type.category);\n }\n case \"enum\": {\n return true;\n }\n case \"record\": {\n return isValueSafeRecord(scope, type.namespace.name, type.value);\n }\n case \"carray\": {\n return isValueSafeArray(scope, type);\n }\n case \"alias\": {\n return isValueSafeAlias(scope, type);\n }\n case \"callback\":\n case \"class\":\n case \"hashtable\":\n case \"interface\":\n case \"list\":\n case \"varargs\": {\n return false;\n }\n }\n}\n\nfunction isValueSafeRef(scope: Scope, ref: TypeId | undefined, cType: string | undefined): boolean {\n if (ref === undefined || cType?.endsWith(\"*\") === true) {\n return false;\n }\n\n const type = scope.context.library.typeFor(ref);\n\n return type === undefined ? false : isValueSafeType(scope, type);\n}\n\nconst isValueSafeField = (scope: Scope, field: GirField): boolean =>\n field.inlineMembers === undefined\n ? isValueSafeRef(scope, field.type, field.cType)\n : field.inlineMembers.every((member) => isValueSafeField(scope, member));\n\nfunction isValueSafeRecord(scope: Scope, namespaceName: string, record: GirRecord): boolean {\n const key = recordKey(namespaceName, record);\n\n if (scope.seen.has(key) || record.fields.length === 0) {\n return false;\n }\n\n scope.seen.add(key);\n const isSafe = record.fields.every((field) => isValueSafeField(scope, field));\n scope.seen.delete(key);\n\n return isSafe;\n}\n\nconst isValueMarshalable = (context: ModuleContext, namespaceName: string, record: GirRecord): boolean =>\n isValueSafeRecord({ context, seen: new Set<string>() }, namespaceName, record);\n\nconst isConstructibleRecord = (context: ModuleContext, namespaceName: string, record: GirRecord): boolean =>\n !isOpaqueRecord(record) && (hasOwnCopySemantics(record) || isValueMarshalable(context, namespaceName, record));\n\nexport { isConstructibleRecord, isValueMarshalable };\n"]}
|
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
import type { GirClass } from "../../gir/class.js";
|
|
2
|
+
import type { GirFunction } from "../../gir/function.js";
|
|
2
3
|
import type { ModuleContext } from "../../writer/context.js";
|
|
4
|
+
type VfuncMemberMode = "implementation" | "requirement" | "signature";
|
|
5
|
+
type VfuncMembersOptions = {
|
|
6
|
+
context: ModuleContext;
|
|
7
|
+
klass: GirClass;
|
|
8
|
+
mode: VfuncMemberMode;
|
|
9
|
+
};
|
|
10
|
+
type VfuncEntry = {
|
|
11
|
+
name: string;
|
|
12
|
+
signature: string;
|
|
13
|
+
doc: string | undefined;
|
|
14
|
+
};
|
|
15
|
+
declare const vfuncMemberNames: (context: ModuleContext, namespaceName: string, klass: GirClass) => string[];
|
|
3
16
|
declare const renderVfuncMetadata: (context: ModuleContext, klass: GirClass) => string | undefined;
|
|
4
|
-
|
|
17
|
+
declare const vfuncCallables: (context: ModuleContext, namespaceName: string, klass: GirClass) => Map<string, GirFunction>;
|
|
18
|
+
declare const protectedChainSlotKeys: (context: ModuleContext, klass: GirClass) => Set<string>;
|
|
19
|
+
declare const hasCallableVfuncSlots: (context: ModuleContext, namespaceName: string, klass: GirClass) => boolean;
|
|
20
|
+
declare const vfuncEntries: (context: ModuleContext, namespaceName: string, klass: GirClass) => VfuncEntry[];
|
|
21
|
+
declare const renderVfuncMembers: (options: VfuncMembersOptions) => string[];
|
|
22
|
+
export { hasCallableVfuncSlots, protectedChainSlotKeys, renderVfuncMembers, vfuncCallables, renderVfuncMetadata, vfuncEntries, vfuncMemberNames, type VfuncMemberMode, };
|
|
5
23
|
//# sourceMappingURL=vtable.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vtable.d.ts","sourceRoot":"","sources":["../../../src/store/gi/vtable.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"vtable.d.ts","sourceRoot":"","sources":["../../../src/store/gi/vtable.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAoB,MAAM,oBAAoB,CAAC;AAErE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAKzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AA0B7D,KAAK,eAAe,GAAG,gBAAgB,GAAG,aAAa,GAAG,WAAW,CAAC;AAkBtE,KAAK,mBAAmB,GAAG;IACvB,OAAO,EAAE,aAAa,CAAC;IACvB,KAAK,EAAE,QAAQ,CAAC;IAChB,IAAI,EAAE,eAAe,CAAC;CACzB,CAAC;AAOF,KAAK,UAAU,GAAG;IACd,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;CAC3B,CAAC;AA8MF,QAAA,MAAM,gBAAgB,GAAI,SAAS,aAAa,EAAE,eAAe,MAAM,EAAE,OAAO,QAAQ,KAAG,MAAM,EACZ,CAAC;AAEtF,QAAA,MAAM,mBAAmB,GAAI,SAAS,aAAa,EAAE,OAAO,QAAQ,KAAG,MAAM,GAAG,SAU/E,CAAC;AAuDF,QAAA,MAAM,cAAc,GAAI,SAAS,aAAa,EAAE,eAAe,MAAM,EAAE,OAAO,QAAQ,KAAG,GAAG,CAAC,MAAM,EAAE,WAAW,CAS/G,CAAC;AAYF,QAAA,MAAM,sBAAsB,GAAI,SAAS,aAAa,EAAE,OAAO,QAAQ,KAAG,GAAG,CAAC,MAAM,CAQnF,CAAC;AAcF,QAAA,MAAM,qBAAqB,GAAI,SAAS,aAAa,EAAE,eAAe,MAAM,EAAE,OAAO,QAAQ,KAAG,OAChC,CAAC;AAsBjE,QAAA,MAAM,YAAY,GAAI,SAAS,aAAa,EAAE,eAAe,MAAM,EAAE,OAAO,QAAQ,KAAG,UAAU,EAK1F,CAAC;AAER,QAAA,MAAM,kBAAkB,GAAI,SAAS,mBAAmB,KAAG,MAAM,EAiBhE,CAAC;AAgHF,OAAO,EACH,qBAAqB,EACrB,sBAAsB,EACtB,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,YAAY,EACZ,gBAAgB,EAChB,KAAK,eAAe,GACvB,CAAC"}
|
package/dist/store/gi/vtable.js
CHANGED
|
@@ -1,19 +1,39 @@
|
|
|
1
|
-
import { pascalCase,
|
|
1
|
+
import { pascalCase, sanitizeTypeIdentifier, sourceStringLiteral } from "@gtkx/utils";
|
|
2
2
|
import { isInlineCallbackRef, isScalarRef, renderDescriptor, renderParamDescriptor, } from "../../analysis/descriptor-render.js";
|
|
3
|
-
import {
|
|
3
|
+
import { foldedLengthParameters, handlerParameters, parameterIdentifier, renamesWithInstance, renderHandlerParameters, renderHandlerResultType, } from "../../analysis/param-structure.js";
|
|
4
|
+
import { renderTsType } from "../../analysis/ts-type.js";
|
|
5
|
+
import { typeKey } from "../../analysis/type-key.js";
|
|
6
|
+
import { ancestorChain, resolveInterfaces } from "../../gir/ancestry.js";
|
|
7
|
+
import { callbackAsFunction } from "../../gir/callback.js";
|
|
8
|
+
import { renderJsDoc } from "../../writer/doc.js";
|
|
9
|
+
import { renderBlock, renderBraced } from "../../writer/emit.js";
|
|
10
|
+
import { handlerSpec, THROWS_TEXT } from "./doc-spec.js";
|
|
4
11
|
import { computeRecordFieldSlots } from "./record-layout.js";
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
const PADDING_FIELD_NAME = /^(?:reserved|padding)\d*$/i;
|
|
13
|
+
const UNCALLABLE_SLOT_KEYS = new Set([
|
|
14
|
+
"vfuncDispose",
|
|
15
|
+
"vfuncFinalize",
|
|
16
|
+
"vfuncGetProperty",
|
|
17
|
+
"vfuncSetProperty",
|
|
18
|
+
]);
|
|
19
|
+
const VTABLE_CACHE = new WeakMap();
|
|
20
|
+
const PROTECTED_SLOT_NOTE = "It is `protected`, so only a subclass chaining up reaches it.";
|
|
21
|
+
const PUBLIC_SLOT_NOTE = "Calling it from anywhere else re-enters the slot on a live instance.";
|
|
22
|
+
const vfuncMemberName = (fieldName) => `vfunc${pascalCase(fieldName)}`;
|
|
23
|
+
const vfuncOverrideNote = (slot, isProtected) => [
|
|
24
|
+
`Invokes the \`${slot.field.name}\` vtable slot. Override it on a class passed to \`registerClass\``,
|
|
25
|
+
`and chain up with \`super.${slot.key}()\`.`,
|
|
26
|
+
isProtected ? PROTECTED_SLOT_NOTE : PUBLIC_SLOT_NOTE,
|
|
27
|
+
].join("\n");
|
|
28
|
+
const vfuncRequirementNote = (slot, ownerRef) => [
|
|
29
|
+
`Fills the \`${slot.field.name}\` vtable slot. Declare it on a class passed to \`registerClass\``,
|
|
30
|
+
`with \`${ownerRef}\` in \`implements\`, which installs it in the interface vtable. Leaving it out`,
|
|
31
|
+
"keeps whatever the interface installs by default, the way it does for a C implementer.",
|
|
32
|
+
].join("\n");
|
|
33
|
+
const vfuncMemberNote = (options) => options.mode === "requirement"
|
|
34
|
+
? vfuncRequirementNote(options.slot, options.ownerRef)
|
|
35
|
+
: vfuncOverrideNote(options.slot, options.isProtected);
|
|
36
|
+
const isPaddingField = (field) => field.name.startsWith("_") || PADDING_FIELD_NAME.test(field.name);
|
|
17
37
|
const vtableCallbackType = (context, field) => {
|
|
18
38
|
if (field.type === undefined) {
|
|
19
39
|
return undefined;
|
|
@@ -25,12 +45,15 @@ const vtableCallbackType = (context, field) => {
|
|
|
25
45
|
return type.value;
|
|
26
46
|
};
|
|
27
47
|
const vtableSlotEntry = (context, field, claimedNames) => {
|
|
48
|
+
if (field.name === "constructor" || isPaddingField(field)) {
|
|
49
|
+
return undefined;
|
|
50
|
+
}
|
|
28
51
|
const callback = vtableCallbackType(context, field);
|
|
29
52
|
if (callback === undefined) {
|
|
30
53
|
return undefined;
|
|
31
54
|
}
|
|
32
|
-
const key =
|
|
33
|
-
if (
|
|
55
|
+
const key = vfuncMemberName(field.name);
|
|
56
|
+
if (claimedNames.has(key)) {
|
|
34
57
|
return undefined;
|
|
35
58
|
}
|
|
36
59
|
if (!isVtableSlotEligible(context, callback)) {
|
|
@@ -38,42 +61,222 @@ const vtableSlotEntry = (context, field, claimedNames) => {
|
|
|
38
61
|
}
|
|
39
62
|
return { key, callback };
|
|
40
63
|
};
|
|
41
|
-
const
|
|
42
|
-
const
|
|
43
|
-
if (resolved?.kind !== "record") {
|
|
44
|
-
return [];
|
|
45
|
-
}
|
|
46
|
-
const { slots, size } = computeRecordFieldSlots(context, resolved.value.fields, resolved.value.isUnion);
|
|
64
|
+
const collectVtableSlots = (context, fields, isUnion) => {
|
|
65
|
+
const { slots, size } = computeRecordFieldSlots(context, fields, isUnion);
|
|
47
66
|
const entries = [];
|
|
48
67
|
const claimedNames = new Set();
|
|
49
68
|
for (const { field, slot } of slots) {
|
|
50
69
|
const entry = vtableSlotEntry(context, field, claimedNames);
|
|
51
|
-
if (entry
|
|
52
|
-
|
|
70
|
+
if (entry !== undefined) {
|
|
71
|
+
claimedNames.add(entry.key);
|
|
72
|
+
entries.push({ ...entry, field, vfunc: undefined, byteOffset: slot.byteOffset });
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return { slots: entries, vtableSize: size };
|
|
76
|
+
};
|
|
77
|
+
const resolveVtableRecord = (context, namespaceName, klass) => {
|
|
78
|
+
const typeStruct = klass.glibTypeStruct;
|
|
79
|
+
const resolved = typeStruct === undefined ? undefined : context.library.resolveType(namespaceName, typeStruct);
|
|
80
|
+
if (typeStruct === undefined || resolved?.kind !== "record" || resolved.value.fields.length === 0) {
|
|
81
|
+
return undefined;
|
|
82
|
+
}
|
|
83
|
+
return { typeStruct, record: resolved.value };
|
|
84
|
+
};
|
|
85
|
+
const attachVirtualMethods = (slots, klass) => {
|
|
86
|
+
const byKey = new Map(klass.vfuncs.map((vfunc) => [vfuncMemberName(vfunc.name), vfunc]));
|
|
87
|
+
return slots.map((slot) => ({ ...slot, vfunc: byKey.get(slot.key) }));
|
|
88
|
+
};
|
|
89
|
+
const buildVtable = (context, namespaceName, klass) => {
|
|
90
|
+
const resolved = resolveVtableRecord(context, namespaceName, klass);
|
|
91
|
+
if (resolved === undefined) {
|
|
92
|
+
return undefined;
|
|
93
|
+
}
|
|
94
|
+
const { slots, vtableSize } = collectVtableSlots(context, resolved.record.fields, resolved.record.isUnion);
|
|
95
|
+
if (slots.length === 0) {
|
|
96
|
+
return undefined;
|
|
97
|
+
}
|
|
98
|
+
return {
|
|
99
|
+
structName: pascalCase(resolved.typeStruct),
|
|
100
|
+
kind: klass.isInterface ? "interface" : "class",
|
|
101
|
+
vtableSize,
|
|
102
|
+
slots: disambiguateSlots(context, namespaceName, klass, attachVirtualMethods(slots, klass)),
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
const collectVtable = (context, namespaceName, klass) => {
|
|
106
|
+
const cached = VTABLE_CACHE.get(klass);
|
|
107
|
+
if (cached !== undefined) {
|
|
108
|
+
return cached;
|
|
109
|
+
}
|
|
110
|
+
const vtable = buildVtable(context, namespaceName, klass);
|
|
111
|
+
if (vtable !== undefined) {
|
|
112
|
+
VTABLE_CACHE.set(klass, vtable);
|
|
113
|
+
}
|
|
114
|
+
return vtable;
|
|
115
|
+
};
|
|
116
|
+
const shadowedSlotKey = (klass, slot) => `vfunc${sanitizeTypeIdentifier(klass.name)}${pascalCase(slot.field.name)}`;
|
|
117
|
+
const slotSignatureKey = (library, slot) => {
|
|
118
|
+
const [, ...parameters] = slot.callback.parameters;
|
|
119
|
+
const parts = parameters.map((parameter) => `${typeKey(library, parameter.type)}/${parameter.direction}/${String(parameter.nullable)}`);
|
|
120
|
+
return `${parts.join(",")}->${typeKey(library, slot.callback.returnValue.type)}`;
|
|
121
|
+
};
|
|
122
|
+
const isShadowingSlot = (library, slot, inherited) => inherited.some((other) => other.key === slot.key &&
|
|
123
|
+
slotIdentity(other) !== slotIdentity(slot) &&
|
|
124
|
+
slotSignatureKey(library, other) !== slotSignatureKey(library, slot));
|
|
125
|
+
const disambiguateSlots = (context, namespaceName, klass, slots) => {
|
|
126
|
+
const inherited = ancestorSlots(context, namespaceName, klass);
|
|
127
|
+
return slots.map((slot) => isShadowingSlot(context.library, slot, inherited) ? { ...slot, key: shadowedSlotKey(klass, slot) } : slot);
|
|
128
|
+
};
|
|
129
|
+
const ancestorSlots = (context, namespaceName, klass) => {
|
|
130
|
+
const [, ...ancestors] = [...ancestorChain(context.library, klass, namespaceName)];
|
|
131
|
+
return ancestors.flatMap((ancestor) => collectVtable(context, ancestor.namespaceName, ancestor.klass)?.slots ?? []);
|
|
132
|
+
};
|
|
133
|
+
const vfuncMemberNames = (context, namespaceName, klass) => collectVtable(context, namespaceName, klass)?.slots.map((slot) => slot.key) ?? [];
|
|
134
|
+
const renderVfuncMetadata = (context, klass) => {
|
|
135
|
+
const vtable = collectVtable(context, context.namespace.name, klass);
|
|
136
|
+
if (vtable === undefined) {
|
|
137
|
+
return undefined;
|
|
138
|
+
}
|
|
139
|
+
const entries = vtable.slots.map((slot) => renderVtableSlotDescriptor(context, vtable, slot));
|
|
140
|
+
return renderBraced(entries.join("\n"));
|
|
141
|
+
};
|
|
142
|
+
const slotIdentity = (slot) => `${slot.key}:${String(slot.byteOffset)}`;
|
|
143
|
+
const inheritedSlotIdentities = (context, namespaceName, klass) => new Set(ancestorSlots(context, namespaceName, klass).map((slot) => slotIdentity(slot)));
|
|
144
|
+
const addInterfaceSlotKeys = (context, iface, keys, seen) => {
|
|
145
|
+
const identity = `${iface.namespaceName}.${iface.klass.name}`;
|
|
146
|
+
if (seen.has(identity)) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
seen.add(identity);
|
|
150
|
+
for (const key of vfuncMemberNames(context, iface.namespaceName, iface.klass)) {
|
|
151
|
+
keys.add(key);
|
|
152
|
+
}
|
|
153
|
+
for (const ref of resolveInterfaces(context.library, iface.namespaceName, iface.klass.prerequisites)) {
|
|
154
|
+
addInterfaceSlotKeys(context, ref, keys, seen);
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
const implementedSlotKeys = (context, namespaceName, klass) => {
|
|
158
|
+
const keys = new Set();
|
|
159
|
+
const seen = new Set();
|
|
160
|
+
for (const ancestor of ancestorChain(context.library, klass, namespaceName)) {
|
|
161
|
+
for (const ref of resolveInterfaces(context.library, ancestor.namespaceName, ancestor.klass.implements)) {
|
|
162
|
+
addInterfaceSlotKeys(context, ref, keys, seen);
|
|
53
163
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
164
|
+
}
|
|
165
|
+
return keys;
|
|
166
|
+
};
|
|
167
|
+
const protectedSlotKeys = (options, slots) => {
|
|
168
|
+
const { context, klass } = options;
|
|
169
|
+
if (klass.isInterface) {
|
|
170
|
+
return new Set();
|
|
171
|
+
}
|
|
172
|
+
const shared = implementedSlotKeys(context, context.namespace.name, klass);
|
|
173
|
+
return new Set(slots.map((slot) => slot.key).filter((key) => !shared.has(key)));
|
|
174
|
+
};
|
|
175
|
+
const vfuncCallables = (context, namespaceName, klass) => {
|
|
176
|
+
const members = new Map();
|
|
177
|
+
for (const slot of callableVfuncSlots(context, namespaceName, klass)) {
|
|
178
|
+
const [, ...parameters] = slot.callback.parameters;
|
|
179
|
+
members.set(slot.key, { ...callbackAsFunction(slot.callback), parameters });
|
|
180
|
+
}
|
|
181
|
+
return members;
|
|
182
|
+
};
|
|
183
|
+
const addProtectedSlotKeys = (context, ancestor, keys) => {
|
|
184
|
+
const shared = implementedSlotKeys(context, ancestor.namespaceName, ancestor.klass);
|
|
185
|
+
for (const slot of callableVfuncSlots(context, ancestor.namespaceName, ancestor.klass)) {
|
|
186
|
+
if (!shared.has(slot.key)) {
|
|
187
|
+
keys.add(slot.key);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
const protectedChainSlotKeys = (context, klass) => {
|
|
192
|
+
const keys = new Set();
|
|
193
|
+
for (const ancestor of ancestorChain(context.library, klass, context.namespace.name)) {
|
|
194
|
+
addProtectedSlotKeys(context, ancestor, keys);
|
|
195
|
+
}
|
|
196
|
+
return keys;
|
|
197
|
+
};
|
|
198
|
+
const callableVfuncSlots = (context, namespaceName, klass) => {
|
|
199
|
+
const vtable = collectVtable(context, namespaceName, klass);
|
|
200
|
+
if (vtable === undefined) {
|
|
201
|
+
return [];
|
|
202
|
+
}
|
|
203
|
+
const inherited = inheritedSlotIdentities(context, namespaceName, klass);
|
|
204
|
+
return vtable.slots.filter((slot) => isCallableSlot(context, slot) && !inherited.has(slotIdentity(slot)));
|
|
205
|
+
};
|
|
206
|
+
const hasCallableVfuncSlots = (context, namespaceName, klass) => callableVfuncSlots(context, namespaceName, klass).length > 0;
|
|
207
|
+
const slotDoc = (slot) => slot.vfunc?.doc ?? slot.field.doc ?? slot.callback.doc;
|
|
208
|
+
const slotDocParameters = (slot) => {
|
|
209
|
+
const [, ...parameters] = slot.callback.parameters;
|
|
210
|
+
const vfuncParameters = slot.vfunc?.parameters ?? [];
|
|
211
|
+
return parameters.map((parameter, index) => ({ ...parameter, doc: vfuncParameters[index]?.doc ?? parameter.doc }));
|
|
212
|
+
};
|
|
213
|
+
const slotDocSpec = (slot) => {
|
|
214
|
+
const parameters = slotDocParameters(slot);
|
|
215
|
+
const source = slot.vfunc ?? slot.callback;
|
|
216
|
+
return {
|
|
217
|
+
...handlerSpec(source, parameters, renamesWithInstance(parameters, slot.callback.parameters[0])),
|
|
218
|
+
returns: slot.vfunc?.returnValue.doc ?? slot.callback.returnValue.doc,
|
|
219
|
+
throws: slot.callback.throws ? THROWS_TEXT : undefined,
|
|
220
|
+
};
|
|
221
|
+
};
|
|
222
|
+
const vfuncEntries = (context, namespaceName, klass) => callableVfuncSlots(context, namespaceName, klass).map((slot) => ({
|
|
223
|
+
name: slot.key,
|
|
224
|
+
signature: vfuncSlotSignature(context, slot).header,
|
|
225
|
+
doc: slotDoc(slot),
|
|
226
|
+
}));
|
|
227
|
+
const renderVfuncMembers = (options) => {
|
|
228
|
+
const { context, klass, mode } = options;
|
|
229
|
+
const ownerRef = sanitizeTypeIdentifier(klass.name);
|
|
230
|
+
const slots = callableVfuncSlots(context, context.namespace.name, klass);
|
|
231
|
+
if (slots.length === 0) {
|
|
232
|
+
return [];
|
|
233
|
+
}
|
|
234
|
+
if (mode === "implementation") {
|
|
235
|
+
context.addRuntimeImport("callVfunc");
|
|
236
|
+
}
|
|
237
|
+
const protectedKeys = protectedSlotKeys(options, slots);
|
|
238
|
+
return slots.map((slot) => renderVfuncMember({ context, ownerRef, slot, mode, isProtected: protectedKeys.has(slot.key) }));
|
|
239
|
+
};
|
|
240
|
+
const hasUnannotatedPointerParam = (context, slot) => {
|
|
241
|
+
const [, ...parameters] = slot.callback.parameters;
|
|
242
|
+
return parameters.some((parameter) => parameter.direction === "in" &&
|
|
243
|
+
parameter.cType?.endsWith("*") === true &&
|
|
244
|
+
isScalarRef(context.library, parameter.type));
|
|
245
|
+
};
|
|
246
|
+
const isCallableSlot = (context, slot) => !UNCALLABLE_SLOT_KEYS.has(slot.key) && !hasUnannotatedPointerParam(context, slot);
|
|
247
|
+
const vfuncSlotSignature = (context, slot, isOptional = false) => {
|
|
248
|
+
const [, ...parameters] = slot.callback.parameters;
|
|
249
|
+
const renderType = (ref, isNullable) => renderTsType(context, ref, isNullable);
|
|
250
|
+
const signature = renderHandlerParameters(parameters, renderType).join(", ");
|
|
251
|
+
const folded = foldedLengthParameters(context.library, slot.callback);
|
|
252
|
+
const returnType = renderHandlerResultType({
|
|
253
|
+
library: context.library,
|
|
254
|
+
signal: { ...slot.callback, parameters },
|
|
255
|
+
renderType,
|
|
256
|
+
shouldIncludeCallerAllocated: true,
|
|
257
|
+
isOptOut: false,
|
|
258
|
+
shouldExcludeOut: (parameter) => folded.has(parameter),
|
|
259
|
+
});
|
|
260
|
+
return { header: `${slot.key}${isOptional ? "?" : ""}(${signature}): ${returnType}`, returnType };
|
|
261
|
+
};
|
|
262
|
+
const renderVfuncMember = (options) => {
|
|
263
|
+
const { context, ownerRef, slot, mode, isProtected } = options;
|
|
264
|
+
const { header, returnType } = vfuncSlotSignature(context, slot, mode === "requirement");
|
|
265
|
+
const declaration = `${isProtected ? "protected " : ""}${header}`;
|
|
266
|
+
const doc = renderJsDoc(slotDoc(slot), vfuncMemberNote(options), slotDocSpec(slot));
|
|
267
|
+
if (mode !== "implementation") {
|
|
268
|
+
return `${doc}${declaration};`;
|
|
269
|
+
}
|
|
270
|
+
const [, ...parameters] = slot.callback.parameters;
|
|
271
|
+
const inputs = handlerParameters(parameters).map((parameter, index) => parameterIdentifier(parameter, index));
|
|
272
|
+
const call = `callVfunc(${ownerRef}, ${sourceStringLiteral(slot.key)}, this, [${inputs.join(", ")}])`;
|
|
273
|
+
const body = returnType === "void" ? `${call};` : `return ${call} as ${returnType};`;
|
|
274
|
+
return `${doc}${renderBlock(declaration, body)}`;
|
|
275
|
+
};
|
|
70
276
|
const isEligibleVtableParam = (context, param) => {
|
|
71
277
|
if (param.isVarargs) {
|
|
72
278
|
return false;
|
|
73
279
|
}
|
|
74
|
-
if (isUnsupportedOutParam(context, param)) {
|
|
75
|
-
return false;
|
|
76
|
-
}
|
|
77
280
|
return !isInlineCallbackRef(context.library, param.type);
|
|
78
281
|
};
|
|
79
282
|
const isVtableSlotEligible = (context, callback) => {
|
|
@@ -87,22 +290,25 @@ const isVtableSlotEligible = (context, callback) => {
|
|
|
87
290
|
}
|
|
88
291
|
return !isInlineCallbackRef(context.library, callback.returnValue.type);
|
|
89
292
|
};
|
|
90
|
-
const renderVtableSlotDescriptor = (context,
|
|
91
|
-
const { key,
|
|
293
|
+
const renderVtableSlotDescriptor = (context, vtable, slot) => {
|
|
294
|
+
const { key, field, callback, byteOffset } = slot;
|
|
92
295
|
const argDescriptors = callback.parameters
|
|
93
296
|
.map((param) => renderParamDescriptor(context, param, param.type))
|
|
94
297
|
.join(", ");
|
|
95
298
|
const returnDescriptor = renderDescriptor(context, callback.returnValue.type, callback.returnValue.transferOwnership);
|
|
96
299
|
const lines = [
|
|
97
|
-
`
|
|
98
|
-
`className: ${sourceStringLiteral(structName)},`,
|
|
300
|
+
`className: ${sourceStringLiteral(vtable.structName)},`,
|
|
99
301
|
`vfuncName: ${sourceStringLiteral(field.name)},`,
|
|
100
302
|
`byteOffset: ${String(byteOffset)},`,
|
|
101
|
-
`vtableSize: ${String(vtableSize)},`,
|
|
102
|
-
`argDescriptors: [${argDescriptors}],`,
|
|
103
|
-
`returnDescriptor: ${returnDescriptor},`,
|
|
104
303
|
];
|
|
304
|
+
if (vtable.kind === "interface") {
|
|
305
|
+
lines.push(`vtableSize: ${String(vtable.vtableSize)},`);
|
|
306
|
+
}
|
|
307
|
+
lines.push(`argDescriptors: [${argDescriptors}],`, `returnDescriptor: ${returnDescriptor},`);
|
|
308
|
+
if (callback.throws) {
|
|
309
|
+
lines.push("canThrow: true,");
|
|
310
|
+
}
|
|
105
311
|
return `${key}: ${renderBraced(lines.join("\n"))},`;
|
|
106
312
|
};
|
|
107
|
-
export { renderVfuncMetadata };
|
|
313
|
+
export { hasCallableVfuncSlots, protectedChainSlotKeys, renderVfuncMembers, vfuncCallables, renderVfuncMetadata, vfuncEntries, vfuncMemberNames, };
|
|
108
314
|
//# sourceMappingURL=vtable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vtable.js","sourceRoot":"","sources":["../../../src/store/gi/vtable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAMjF,OAAO,EACH,mBAAmB,EACnB,WAAW,EACX,gBAAgB,EAChB,qBAAqB,GACxB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAc7D,MAAM,mBAAmB,GAAG,CAAC,OAAsB,EAAE,KAAe,EAAsB,EAAE;IACxF,IAAI,KAAK,CAAC,cAAc,KAAK,SAAS,EAAE,CAAC;QACrC,OAAO,SAAS,CAAC;IACrB,CAAC;IAED,MAAM,UAAU,GAAG,UAAU,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;IACpD,MAAM,IAAI,GAAe,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC;IACnE,MAAM,OAAO,GAAG,aAAa,CAAC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;IAE/E,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,SAAS,CAAC;IACrB,CAAC;IAED,OAAO,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AAC5C,CAAC,CAAC;AAEF,MAAM,kBAAkB,GAAG,CAAC,OAAsB,EAAE,KAAe,EAA2B,EAAE;IAC5F,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAC3B,OAAO,SAAS,CAAC;IACrB,CAAC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G;QAChD,cAAc,mBAAmB,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG;QAChD,eAAe,MAAM,CAAC,UAAU,CAAC,GAAG;QACpC,eAAe,MAAM,CAAC,UAAU,CAAC,GAAG;QACpC,oBAAoB,cAAc,IAAI;QACtC,qBAAqB,gBAAgB,GAAG;KAC3C,CAAC;IAEF,OAAO,GAAG,GAAG,KAAK,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC;AACxD,CAAC,CAAC;AAEF,OAAO,EAAE,mBAAmB,EAAE,CAAC","sourcesContent":["import { pascalCase, sourceStringLiteral, toCamelIdentifier } from \"@gtkx/utils\";\nimport type { GirCallback } from \"../../gir/callback.js\";\nimport type { GirClass } from \"../../gir/class.js\";\nimport type { GirField } from \"../../gir/field.js\";\nimport type { GirParameter } from \"../../gir/parameter.js\";\nimport type { ModuleContext } from \"../../writer/context.js\";\nimport {\n isInlineCallbackRef,\n isScalarRef,\n renderDescriptor,\n renderParamDescriptor,\n} from \"../../analysis/descriptor-render.js\";\nimport { renderBraced } from \"../../writer/emit.js\";\nimport { computeRecordFieldSlots } from \"./record-layout.js\";\n\ntype VtableKind = \"class\" | \"interface\";\n\ntype RenderVtableSlotDescriptorOptions = {\n key: string;\n structName: string;\n kind: VtableKind;\n field: GirField;\n callback: GirCallback;\n byteOffset: number;\n vtableSize: number;\n};\n\nconst renderVfuncMetadata = (context: ModuleContext, klass: GirClass): string | undefined => {\n if (klass.glibTypeStruct === undefined) {\n return undefined;\n }\n\n const structName = pascalCase(klass.glibTypeStruct);\n const kind: VtableKind = klass.isInterface ? \"interface\" : \"class\";\n const entries = vtableEntries(context, structName, kind, klass.glibTypeStruct);\n\n if (entries.length === 0) {\n return undefined;\n }\n\n return renderBraced(entries.join(\"\\n\"));\n};\n\nconst vtableCallbackType = (context: ModuleContext, field: GirField): GirCallback | undefined => {\n if (field.type === undefined) {\n return undefined;\n }\n\n const type = context.library.typeFor(field.type);\n\n if (type?.kind !== \"callback\" || context.library.nameFor(field.type) !== undefined) {\n return undefined;\n }\n\n return type.value;\n};\n\nconst vtableSlotEntry = (\n context: ModuleContext,\n field: GirField,\n claimedNames: Set<string>,\n): { key: string; callback: GirCallback } | undefined => {\n const callback = vtableCallbackType(context, field);\n\n if (callback === undefined) {\n return undefined;\n }\n\n const key = toCamelIdentifier(field.name);\n\n if (key === \"constructor\" || claimedNames.has(key)) {\n return undefined;\n }\n\n if (!isVtableSlotEligible(context, callback)) {\n return undefined;\n }\n\n return { key, callback };\n};\n\nconst vtableEntries = (context: ModuleContext, structName: string, kind: VtableKind, typeStruct: string): string[] => {\n const resolved = context.library.resolveType(context.namespace.name, typeStruct);\n\n if (resolved?.kind !== \"record\") {\n return [];\n }\n\n const { slots, size } = computeRecordFieldSlots(context, resolved.value.fields, resolved.value.isUnion);\n const entries: string[] = [];\n const claimedNames: Set<string> = new Set();\n\n for (const { field, slot } of slots) {\n const entry = vtableSlotEntry(context, field, claimedNames);\n\n if (entry === undefined) {\n continue;\n }\n\n claimedNames.add(entry.key);\n\n entries.push(\n renderVtableSlotDescriptor(context, {\n key: entry.key,\n structName,\n kind,\n field,\n callback: entry.callback,\n byteOffset: slot.byteOffset,\n vtableSize: size,\n }),\n );\n }\n\n return entries;\n};\n\nconst isUnsupportedOutParam = (context: ModuleContext, param: GirParameter): boolean =>\n (param.direction === \"out\" || param.direction === \"inout\") &&\n !param.callerAllocates &&\n !isScalarRef(context.library, param.type);\n\nconst isEligibleVtableParam = (context: ModuleContext, param: GirParameter): boolean => {\n if (param.isVarargs) {\n return false;\n }\n\n if (isUnsupportedOutParam(context, param)) {\n return false;\n }\n\n return !isInlineCallbackRef(context.library, param.type);\n};\n\nconst isVtableSlotEligible = (context: ModuleContext, callback: GirCallback): boolean => {\n if (!callback.introspectable) {\n return false;\n }\n\n for (const param of callback.parameters) {\n if (!isEligibleVtableParam(context, param)) {\n return false;\n }\n }\n\n return !isInlineCallbackRef(context.library, callback.returnValue.type);\n};\n\nconst renderVtableSlotDescriptor = (context: ModuleContext, options: RenderVtableSlotDescriptorOptions): string => {\n const { key, structName, kind, field, callback, byteOffset, vtableSize } = options;\n\n const argDescriptors = callback.parameters\n .map((param) => renderParamDescriptor(context, param, param.type))\n .join(\", \");\n\n const returnDescriptor = renderDescriptor(\n context,\n callback.returnValue.type,\n callback.returnValue.transferOwnership,\n );\n\n const lines = [\n `kind: ${sourceStringLiteral(kind)} as const,`,\n `className: ${sourceStringLiteral(structName)},`,\n `vfuncName: ${sourceStringLiteral(field.name)},`,\n `byteOffset: ${String(byteOffset)},`,\n `vtableSize: ${String(vtableSize)},`,\n `argDescriptors: [${argDescriptors}],`,\n `returnDescriptor: ${returnDescriptor},`,\n ];\n\n return `${key}: ${renderBraced(lines.join(\"\\n\"))},`;\n};\n\nexport { renderVfuncMetadata };\n"]}
|
|
1
|
+
{"version":3,"file":"vtable.js","sourceRoot":"","sources":["../../../src/store/gi/vtable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAUtF,OAAO,EACH,mBAAmB,EACnB,WAAW,EACX,gBAAgB,EAChB,qBAAqB,GACxB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACH,sBAAsB,EACtB,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,EACvB,uBAAuB,GAC1B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EAAE,aAAa,EAAyB,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAChG,OAAO,EAAE,kBAAkB,EAAoB,MAAM,uBAAuB,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,sB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AAM,cAAc,GAAG,QAAQ,CAAC,UAAU;SACrC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,qBAAqB,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;SACjE,IAAI,CAAC,IAAI,CAAC,CAAC;IAEhB,MAAM,gBAAgB,GAAG,gBAAgB,CACrC,OAAO,EACP,QAAQ,CAAC,WAAW,CAAC,IAAI,EACzB,QAAQ,CAAC,WAAW,CAAC,iBAAiB,CACzC,CAAC;IAEF,MAAM,KAAK,GAAG;QACV,cAAc,mBAAmB,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG;QACvD,cAAc,mBAAmB,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG;QAChD,eAAe,MAAM,CAAC,UAAU,CAAC,GAAG;KACvC,CAAC;IAEF,IAAI,MAAM,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;QAC9B,KAAK,CAAC,IAAI,CAAC,eAAe,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;IAC5D,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,oBAAoB,cAAc,IAAI,EAAE,qBAAqB,gBAAgB,GAAG,CAAC,CAAC;IAE7F,IAAI,QAAQ,CAAC,MAAM,EAAE,CAAC;QAClB,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IAClC,CAAC;IAED,OAAO,GAAG,GAAG,KAAK,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC;AACxD,CAAC,CAAC;AAEF,OAAO,EACH,qBAAqB,EACrB,sBAAsB,EACtB,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,YAAY,EACZ,gBAAgB,GAEnB,CAAC","sourcesContent":["import { pascalCase, sanitizeTypeIdentifier, sourceStringLiteral } from \"@gtkx/utils\";\nimport type { GirClass, GirVirtualMethod } from \"../../gir/class.js\";\nimport type { GirField } from \"../../gir/field.js\";\nimport type { GirFunction } from \"../../gir/function.js\";\nimport type { Library } from \"../../gir/library.js\";\nimport type { GirParameter } from \"../../gir/parameter.js\";\nimport type { GirRecord } from \"../../gir/record.js\";\nimport type { TypeId } from \"../../gir/type-id.js\";\nimport type { ModuleContext } from \"../../writer/context.js\";\nimport type { JsDocSpec } from \"../../writer/doc.js\";\nimport {\n isInlineCallbackRef,\n isScalarRef,\n renderDescriptor,\n renderParamDescriptor,\n} from \"../../analysis/descriptor-render.js\";\nimport {\n foldedLengthParameters,\n handlerParameters,\n parameterIdentifier,\n renamesWithInstance,\n renderHandlerParameters,\n renderHandlerResultType,\n} from \"../../analysis/param-structure.js\";\nimport { renderTsType } from \"../../analysis/ts-type.js\";\nimport { typeKey } from \"../../analysis/type-key.js\";\nimport { ancestorChain, type ResolvedAncestor, resolveInterfaces } from \"../../gir/ancestry.js\";\nimport { callbackAsFunction, type GirCallback } from \"../../gir/callback.js\";\nimport { renderJsDoc } from \"../../writer/doc.js\";\nimport { renderBlock, renderBraced } from \"../../writer/emit.js\";\nimport { handlerSpec, THROWS_TEXT } from \"./doc-spec.js\";\nimport { computeRecordFieldSlots } from \"./record-layout.js\";\n\ntype VtableKind = \"class\" | \"interface\";\ntype VfuncMemberMode = \"implementation\" | \"requirement\" | \"signature\";\n\ntype VtableSlot = {\n key: string;\n field: GirField;\n callback: GirCallback;\n vfunc: GirVirtualMethod | undefined;\n byteOffset: number;\n};\n\ntype VfuncMemberOptions = {\n context: ModuleContext;\n ownerRef: string;\n slot: VtableSlot;\n mode: VfuncMemberMode;\n isProtected: boolean;\n};\n\ntype VfuncMembersOptions = {\n context: ModuleContext;\n klass: GirClass;\n mode: VfuncMemberMode;\n};\n\ntype VfuncSignature = {\n header: string;\n returnType: string;\n};\n\ntype VfuncEntry = {\n name: string;\n signature: string;\n doc: string | undefined;\n};\n\ntype Vtable = {\n structName: string;\n kind: VtableKind;\n vtableSize: number;\n slots: VtableSlot[];\n};\n\nconst PADDING_FIELD_NAME = /^(?:reserved|padding)\\d*$/i;\n\nconst UNCALLABLE_SLOT_KEYS: Set<string> = new Set([\n \"vfuncDispose\",\n \"vfuncFinalize\",\n \"vfuncGetProperty\",\n \"vfuncSetProperty\",\n]);\n\nconst VTABLE_CACHE: WeakMap<GirClass, Vtable> = new WeakMap();\nconst PROTECTED_SLOT_NOTE = \"It is `protected`, so only a subclass chaining up reaches it.\";\nconst PUBLIC_SLOT_NOTE = \"Calling it from anywhere else re-enters the slot on a live instance.\";\n\nconst vfuncMemberName = (fieldName: string): string => `vfunc${pascalCase(fieldName)}`;\n\nconst vfuncOverrideNote = (slot: VtableSlot, isProtected: boolean): string =>\n [\n `Invokes the \\`${slot.field.name}\\` vtable slot. Override it on a class passed to \\`registerClass\\``,\n `and chain up with \\`super.${slot.key}()\\`.`,\n isProtected ? PROTECTED_SLOT_NOTE : PUBLIC_SLOT_NOTE,\n ].join(\"\\n\");\n\nconst vfuncRequirementNote = (slot: VtableSlot, ownerRef: string): string =>\n [\n `Fills the \\`${slot.field.name}\\` vtable slot. Declare it on a class passed to \\`registerClass\\``,\n `with \\`${ownerRef}\\` in \\`implements\\`, which installs it in the interface vtable. Leaving it out`,\n \"keeps whatever the interface installs by default, the way it does for a C implementer.\",\n ].join(\"\\n\");\n\nconst vfuncMemberNote = (options: VfuncMemberOptions): string =>\n options.mode === \"requirement\"\n ? vfuncRequirementNote(options.slot, options.ownerRef)\n : vfuncOverrideNote(options.slot, options.isProtected);\n\nconst isPaddingField = (field: GirField): boolean =>\n field.name.startsWith(\"_\") || PADDING_FIELD_NAME.test(field.name);\n\nconst vtableCallbackType = (context: ModuleContext, field: GirField): GirCallback | undefined => {\n if (field.type === undefined) {\n return undefined;\n }\n\n const type = context.library.typeFor(field.type);\n\n if (type?.kind !== \"callback\" || context.library.nameFor(field.type) !== undefined) {\n return undefined;\n }\n\n return type.value;\n};\n\nconst vtableSlotEntry = (\n context: ModuleContext,\n field: GirField,\n claimedNames: Set<string>,\n): { key: string; callback: GirCallback } | undefined => {\n if (field.name === \"constructor\" || isPaddingField(field)) {\n return undefined;\n }\n\n const callback = vtableCallbackType(context, field);\n\n if (callback === undefined) {\n return undefined;\n }\n\n const key = vfuncMemberName(field.name);\n\n if (claimedNames.has(key)) {\n return undefined;\n }\n\n if (!isVtableSlotEligible(context, callback)) {\n return undefined;\n }\n\n return { key, callback };\n};\n\nconst collectVtableSlots = (\n context: ModuleContext,\n fields: GirField[],\n isUnion: boolean,\n): { slots: VtableSlot[]; vtableSize: number } => {\n const { slots, size } = computeRecordFieldSlots(context, fields, isUnion);\n const entries: VtableSlot[] = [];\n const claimedNames: Set<string> = new Set();\n\n for (const { field, slot } of slots) {\n const entry = vtableSlotEntry(context, field, claimedNames);\n\n if (entry !== undefined) {\n claimedNames.add(entry.key);\n entries.push({ ...entry, field, vfunc: undefined, byteOffset: slot.byteOffset });\n }\n }\n\n return { slots: entries, vtableSize: size };\n};\n\nconst resolveVtableRecord = (\n context: ModuleContext,\n namespaceName: string,\n klass: GirClass,\n): { typeStruct: string; record: GirRecord } | undefined => {\n const typeStruct = klass.glibTypeStruct;\n const resolved = typeStruct === undefined ? undefined : context.library.resolveType(namespaceName, typeStruct);\n\n if (typeStruct === undefined || resolved?.kind !== \"record\" || resolved.value.fields.length === 0) {\n return undefined;\n }\n\n return { typeStruct, record: resolved.value };\n};\n\nconst attachVirtualMethods = (slots: VtableSlot[], klass: GirClass): VtableSlot[] => {\n const byKey: Map<string, GirVirtualMethod> = new Map(\n klass.vfuncs.map((vfunc) => [vfuncMemberName(vfunc.name), vfunc]),\n );\n\n return slots.map((slot) => ({ ...slot, vfunc: byKey.get(slot.key) }));\n};\n\nconst buildVtable = (context: ModuleContext, namespaceName: string, klass: GirClass): Vtable | undefined => {\n const resolved = resolveVtableRecord(context, namespaceName, klass);\n\n if (resolved === undefined) {\n return undefined;\n }\n\n const { slots, vtableSize } = collectVtableSlots(context, resolved.record.fields, resolved.record.isUnion);\n\n if (slots.length === 0) {\n return undefined;\n }\n\n return {\n structName: pascalCase(resolved.typeStruct),\n kind: klass.isInterface ? \"interface\" : \"class\",\n vtableSize,\n slots: disambiguateSlots(context, namespaceName, klass, attachVirtualMethods(slots, klass)),\n };\n};\n\nconst collectVtable = (context: ModuleContext, namespaceName: string, klass: GirClass): Vtable | undefined => {\n const cached = VTABLE_CACHE.get(klass);\n\n if (cached !== undefined) {\n return cached;\n }\n\n const vtable = buildVtable(context, namespaceName, klass);\n\n if (vtable !== undefined) {\n VTABLE_CACHE.set(klass, vtable);\n }\n\n return vtable;\n};\n\nconst shadowedSlotKey = (klass: GirClass, slot: VtableSlot): string =>\n `vfunc${sanitizeTypeIdentifier(klass.name)}${pascalCase(slot.field.name)}`;\n\nconst slotSignatureKey = (library: Library, slot: VtableSlot): string => {\n const [, ...parameters] = slot.callback.parameters;\n\n const parts = parameters.map(\n (parameter) => `${typeKey(library, parameter.type)}/${parameter.direction}/${String(parameter.nullable)}`);\n\n return `${parts.join(\",\")}->${typeKey(library, slot.callback.returnValue.type)}`;\n};\n\nconst isShadowingSlot = (library: Library, slot: VtableSlot, inherited: VtableSlot[]): boolean =>\n inherited.some(\n (other) =>\n other.key === slot.key &&\n slotIdentity(other) !== slotIdentity(slot) &&\n slotSignatureKey(library, other) !== slotSignatureKey(library, slot));\n\nconst disambiguateSlots = (\n context: ModuleContext,\n namespaceName: string,\n klass: GirClass,\n slots: VtableSlot[],\n): VtableSlot[] => {\n const inherited = ancestorSlots(context, namespaceName, klass);\n\n return slots.map((slot) =>\n isShadowingSlot(context.library, slot, inherited) ? { ...slot, key: shadowedSlotKey(klass, slot) } : slot);\n};\n\nconst ancestorSlots = (context: ModuleContext, namespaceName: string, klass: GirClass): VtableSlot[] => {\n const [, ...ancestors] = [...ancestorChain(context.library, klass, namespaceName)];\n\n return ancestors.flatMap((ancestor) => collectVtable(context, ancestor.namespaceName, ancestor.klass)?.slots ?? []);\n};\n\nconst vfuncMemberNames = (context: ModuleContext, namespaceName: string, klass: GirClass): string[] =>\n collectVtable(context, namespaceName, klass)?.slots.map((slot) => slot.key) ?? [];\n\nconst renderVfuncMetadata = (context: ModuleContext, klass: GirClass): string | undefined => {\n const vtable = collectVtable(context, context.namespace.name, klass);\n\n if (vtable === undefined) {\n return undefined;\n }\n\n const entries = vtable.slots.map((slot) => renderVtableSlotDescriptor(context, vtable, slot));\n\n return renderBraced(entries.join(\"\\n\"));\n};\n\nconst slotIdentity = (slot: VtableSlot): string => `${slot.key}:${String(slot.byteOffset)}`;\n\nconst inheritedSlotIdentities = (context: ModuleContext, namespaceName: string, klass: GirClass): Set<string> =>\n new Set(ancestorSlots(context, namespaceName, klass).map((slot) => slotIdentity(slot)));\n\nconst addInterfaceSlotKeys = (\n context: ModuleContext,\n iface: ResolvedAncestor,\n keys: Set<string>,\n seen: Set<string>,\n): void => {\n const identity = `${iface.namespaceName}.${iface.klass.name}`;\n\n if (seen.has(identity)) {\n return;\n }\n\n seen.add(identity);\n\n for (const key of vfuncMemberNames(context, iface.namespaceName, iface.klass)) {\n keys.add(key);\n }\n\n for (const ref of resolveInterfaces(context.library, iface.namespaceName, iface.klass.prerequisites)) {\n addInterfaceSlotKeys(context, ref, keys, seen);\n }\n};\n\nconst implementedSlotKeys = (context: ModuleContext, namespaceName: string, klass: GirClass): Set<string> => {\n const keys: Set<string> = new Set();\n const seen: Set<string> = new Set();\n\n for (const ancestor of ancestorChain(context.library, klass, namespaceName)) {\n for (const ref of resolveInterfaces(context.library, ancestor.namespaceName, ancestor.klass.implements)) {\n addInterfaceSlotKeys(context, ref, keys, seen);\n }\n }\n\n return keys;\n};\n\nconst protectedSlotKeys = (options: VfuncMembersOptions, slots: VtableSlot[]): Set<string> => {\n const { context, klass } = options;\n\n if (klass.isInterface) {\n return new Set();\n }\n\n const shared = implementedSlotKeys(context, context.namespace.name, klass);\n\n return new Set(slots.map((slot) => slot.key).filter((key) => !shared.has(key)));\n};\n\nconst vfuncCallables = (context: ModuleContext, namespaceName: string, klass: GirClass): Map<string, GirFunction> => {\n const members: Map<string, GirFunction> = new Map();\n\n for (const slot of callableVfuncSlots(context, namespaceName, klass)) {\n const [, ...parameters] = slot.callback.parameters;\n members.set(slot.key, { ...callbackAsFunction(slot.callback), parameters });\n }\n\n return members;\n};\n\nconst addProtectedSlotKeys = (context: ModuleContext, ancestor: ResolvedAncestor, keys: Set<string>): void => {\n const shared = implementedSlotKeys(context, ancestor.namespaceName, ancestor.klass);\n\n for (const slot of callableVfuncSlots(context, ancestor.namespaceName, ancestor.klass)) {\n if (!shared.has(slot.key)) {\n keys.add(slot.key);\n }\n }\n};\n\nconst protectedChainSlotKeys = (context: ModuleContext, klass: GirClass): Set<string> => {\n const keys: Set<string> = new Set();\n\n for (const ancestor of ancestorChain(context.library, klass, context.namespace.name)) {\n addProtectedSlotKeys(context, ancestor, keys);\n }\n\n return keys;\n};\n\nconst callableVfuncSlots = (context: ModuleContext, namespaceName: string, klass: GirClass): VtableSlot[] => {\n const vtable = collectVtable(context, namespaceName, klass);\n\n if (vtable === undefined) {\n return [];\n }\n\n const inherited = inheritedSlotIdentities(context, namespaceName, klass);\n\n return vtable.slots.filter((slot) => isCallableSlot(context, slot) && !inherited.has(slotIdentity(slot)));\n};\n\nconst hasCallableVfuncSlots = (context: ModuleContext, namespaceName: string, klass: GirClass): boolean =>\n callableVfuncSlots(context, namespaceName, klass).length > 0;\n\nconst slotDoc = (slot: VtableSlot): string | undefined => slot.vfunc?.doc ?? slot.field.doc ?? slot.callback.doc;\n\nconst slotDocParameters = (slot: VtableSlot): GirParameter[] => {\n const [, ...parameters] = slot.callback.parameters;\n const vfuncParameters = slot.vfunc?.parameters ?? [];\n\n return parameters.map((parameter, index) => ({ ...parameter, doc: vfuncParameters[index]?.doc ?? parameter.doc }));\n};\n\nconst slotDocSpec = (slot: VtableSlot): JsDocSpec => {\n const parameters = slotDocParameters(slot);\n const source = slot.vfunc ?? slot.callback;\n\n return {\n ...handlerSpec(source, parameters, renamesWithInstance(parameters, slot.callback.parameters[0])),\n returns: slot.vfunc?.returnValue.doc ?? slot.callback.returnValue.doc,\n throws: slot.callback.throws ? THROWS_TEXT : undefined,\n };\n};\n\nconst vfuncEntries = (context: ModuleContext, namespaceName: string, klass: GirClass): VfuncEntry[] =>\n callableVfuncSlots(context, namespaceName, klass).map((slot) => ({\n name: slot.key,\n signature: vfuncSlotSignature(context, slot).header,\n doc: slotDoc(slot),\n }));\n\nconst renderVfuncMembers = (options: VfuncMembersOptions): string[] => {\n const { context, klass, mode } = options;\n const ownerRef = sanitizeTypeIdentifier(klass.name);\n const slots = callableVfuncSlots(context, context.namespace.name, klass);\n\n if (slots.length === 0) {\n return [];\n }\n\n if (mode === \"implementation\") {\n context.addRuntimeImport(\"callVfunc\");\n }\n\n const protectedKeys = protectedSlotKeys(options, slots);\n\n return slots.map((slot) =>\n renderVfuncMember({ context, ownerRef, slot, mode, isProtected: protectedKeys.has(slot.key) }));\n};\n\nconst hasUnannotatedPointerParam = (context: ModuleContext, slot: VtableSlot): boolean => {\n const [, ...parameters] = slot.callback.parameters;\n\n return parameters.some(\n (parameter) =>\n parameter.direction === \"in\" &&\n parameter.cType?.endsWith(\"*\") === true &&\n isScalarRef(context.library, parameter.type),\n );\n};\n\nconst isCallableSlot = (context: ModuleContext, slot: VtableSlot): boolean =>\n !UNCALLABLE_SLOT_KEYS.has(slot.key) && !hasUnannotatedPointerParam(context, slot);\n\nconst vfuncSlotSignature = (context: ModuleContext, slot: VtableSlot, isOptional = false): VfuncSignature => {\n const [, ...parameters] = slot.callback.parameters;\n\n const renderType = (ref: TypeId | undefined, isNullable: boolean): string =>\n renderTsType(context, ref, isNullable);\n\n const signature = renderHandlerParameters(parameters, renderType).join(\", \");\n const folded = foldedLengthParameters(context.library, slot.callback);\n\n const returnType = renderHandlerResultType({\n library: context.library,\n signal: { ...slot.callback, parameters },\n renderType,\n shouldIncludeCallerAllocated: true,\n isOptOut: false,\n shouldExcludeOut: (parameter) => folded.has(parameter),\n });\n\n return { header: `${slot.key}${isOptional ? \"?\" : \"\"}(${signature}): ${returnType}`, returnType };\n};\n\nconst renderVfuncMember = (options: VfuncMemberOptions): string => {\n const { context, ownerRef, slot, mode, isProtected } = options;\n const { header, returnType } = vfuncSlotSignature(context, slot, mode === \"requirement\");\n const declaration = `${isProtected ? \"protected \" : \"\"}${header}`;\n const doc = renderJsDoc(slotDoc(slot), vfuncMemberNote(options), slotDocSpec(slot));\n\n if (mode !== \"implementation\") {\n return `${doc}${declaration};`;\n }\n\n const [, ...parameters] = slot.callback.parameters;\n\n const inputs = handlerParameters(parameters).map((parameter, index) =>\n parameterIdentifier(parameter, index));\n\n const call = `callVfunc(${ownerRef}, ${sourceStringLiteral(slot.key)}, this, [${inputs.join(\", \")}])`;\n const body = returnType === \"void\" ? `${call};` : `return ${call} as ${returnType};`;\n\n return `${doc}${renderBlock(declaration, body)}`;\n};\n\nconst isEligibleVtableParam = (context: ModuleContext, param: GirParameter): boolean => {\n if (param.isVarargs) {\n return false;\n }\n\n return !isInlineCallbackRef(context.library, param.type);\n};\n\nconst isVtableSlotEligible = (context: ModuleContext, callback: GirCallback): boolean => {\n if (!callback.introspectable) {\n return false;\n }\n\n for (const param of callback.parameters) {\n if (!isEligibleVtableParam(context, param)) {\n return false;\n }\n }\n\n return !isInlineCallbackRef(context.library, callback.returnValue.type);\n};\n\nconst renderVtableSlotDescriptor = (context: ModuleContext, vtable: Vtable, slot: VtableSlot): string => {\n const { key, field, callback, byteOffset } = slot;\n\n const argDescriptors = callback.parameters\n .map((param) => renderParamDescriptor(context, param, param.type))\n .join(\", \");\n\n const returnDescriptor = renderDescriptor(\n context,\n callback.returnValue.type,\n callback.returnValue.transferOwnership,\n );\n\n const lines = [\n `className: ${sourceStringLiteral(vtable.structName)},`,\n `vfuncName: ${sourceStringLiteral(field.name)},`,\n `byteOffset: ${String(byteOffset)},`,\n ];\n\n if (vtable.kind === \"interface\") {\n lines.push(`vtableSize: ${String(vtable.vtableSize)},`);\n }\n\n lines.push(`argDescriptors: [${argDescriptors}],`, `returnDescriptor: ${returnDescriptor},`);\n\n if (callback.throws) {\n lines.push(\"canThrow: true,\");\n }\n\n return `${key}: ${renderBraced(lines.join(\"\\n\"))},`;\n};\n\nexport {\n hasCallableVfuncSlots,\n protectedChainSlotKeys,\n renderVfuncMembers,\n vfuncCallables,\n renderVfuncMetadata,\n vfuncEntries,\n vfuncMemberNames,\n type VfuncMemberMode,\n};\n"]}
|
package/dist/store/gi-store.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { type StoreOptions } from "./store-fs.js";
|
|
|
3
3
|
type GiNamespaceInput = {
|
|
4
4
|
directory: string;
|
|
5
5
|
rawSource: string;
|
|
6
|
+
girFile: string;
|
|
6
7
|
};
|
|
7
8
|
declare const writeGiStore: (options: StoreOptions, namespaces: GiNamespaceInput[], fingerprint: GiFingerprint) => void;
|
|
8
9
|
export { writeGiStore, type GiNamespaceInput };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gi-store.d.ts","sourceRoot":"","sources":["../../src/store/gi-store.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"gi-store.d.ts","sourceRoot":"","sources":["../../src/store/gi-store.ts"],"names":[],"mappings":"AAIA,OAAO,EAAwB,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC7E,OAAO,EAAkC,KAAK,YAAY,EAA6B,MAAM,eAAe,CAAC;AAE7G,KAAK,gBAAgB,GAAG;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACnB,CAAC;AAoDF,QAAA,MAAM,YAAY,GACd,SAAS,YAAY,EACrB,YAAY,gBAAgB,EAAE,EAC9B,aAAa,aAAa,KAC3B,IAeF,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,KAAK,gBAAgB,EAAE,CAAC"}
|
package/dist/store/gi-store.js
CHANGED
|
@@ -2,40 +2,35 @@ import { existsSync, readdirSync, readFileSync } from "node:fs";
|
|
|
2
2
|
import { dirname, join, resolve } from "node:path";
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
4
|
import { FINGERPRINT_FILENAME } from "../fingerprint.js";
|
|
5
|
-
import { buildManifest, subpathExport, writeStore } from "./store-fs.js";
|
|
5
|
+
import { buildManifest, namespaceBarrel, subpathExport, writeStore } from "./store-fs.js";
|
|
6
6
|
const OVERRIDES_ROOT = resolve(dirname(fileURLToPath(import.meta.url)), "..", "..", "overrides");
|
|
7
7
|
const overrideFiles = (directory) => {
|
|
8
8
|
const dir = join(OVERRIDES_ROOT, directory);
|
|
9
9
|
if (!existsSync(dir)) {
|
|
10
10
|
return [];
|
|
11
11
|
}
|
|
12
|
-
return readdirSync(dir)
|
|
12
|
+
return readdirSync(dir)
|
|
13
|
+
.filter((name) => name.endsWith(".ejs") && name !== "index.ts.ejs")
|
|
14
|
+
.map((name) => overrideModule(`${directory}/overrides/${name.replace(/\.ejs$/, "")}`, join(dir, name)));
|
|
13
15
|
};
|
|
14
|
-
const
|
|
16
|
+
const overrideModule = (fileName, overridePath) => ({
|
|
17
|
+
fileName,
|
|
18
|
+
source: readFileSync(overridePath, "utf8"),
|
|
19
|
+
origin: overridePath,
|
|
20
|
+
});
|
|
21
|
+
const barrelFile = (directory, girFile) => {
|
|
22
|
+
const barrel = namespaceBarrel(directory);
|
|
15
23
|
const overrideIndex = join(OVERRIDES_ROOT, directory, "index.ts.ejs");
|
|
16
24
|
if (!existsSync(overrideIndex)) {
|
|
17
|
-
return
|
|
25
|
+
return { ...barrel, origin: girFile };
|
|
18
26
|
}
|
|
19
|
-
return
|
|
27
|
+
return overrideModule(barrel.fileName, overrideIndex);
|
|
20
28
|
};
|
|
21
29
|
const collectStoreSources = (namespaces) => {
|
|
22
30
|
const exportsMap = {};
|
|
23
31
|
const collected = [];
|
|
24
|
-
for (const { directory, rawSource } of namespaces) {
|
|
25
|
-
collected.push({
|
|
26
|
-
fileName: `${directory}/${directory}.ts`,
|
|
27
|
-
source: rawSource,
|
|
28
|
-
});
|
|
29
|
-
for (const file of overrideFiles(directory)) {
|
|
30
|
-
collected.push({
|
|
31
|
-
fileName: `${directory}/overrides/${file.replace(/\.ejs$/, "")}`,
|
|
32
|
-
source: readFileSync(join(OVERRIDES_ROOT, directory, file), "utf8"),
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
collected.push({
|
|
36
|
-
fileName: `${directory}/index.ts`,
|
|
37
|
-
source: barrelSource(directory),
|
|
38
|
-
});
|
|
32
|
+
for (const { directory, rawSource, girFile } of namespaces) {
|
|
33
|
+
collected.push({ fileName: `${directory}/${directory}.ts`, source: rawSource, origin: girFile }, ...overrideFiles(directory), barrelFile(directory, girFile));
|
|
39
34
|
exportsMap[`./${directory}`] = subpathExport(`${directory}/index`);
|
|
40
35
|
}
|
|
41
36
|
return { collected, exportsMap };
|