metagen: processDerivedClassRefs converts ancestor methods to properties using subclass selectors (phantom accessors in emitted metadata)
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 42/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- cpp, objective-c
- 领域
- tooling
调研方向
Start in metadata-generator/src/IR/Class.cpp with processDerivedClassRefs, which calls convertMethodToPropertyIfNeeded in the wrong direction, and trace how ClassDecl::postProcessMembers invokes it. Confirm that an ancestor method record can be rewritten with a descendant's getter and setter selectors. Done means the ancestor keeps its own method record, such as NSView.autoscroll not gaining isAutoscroll, while superclass-to-subclass property propagation still works.
由索引模型根据 Issue 内容生成。
描述
Summary
processDerivedClassRefs in metadata-generator/src/IR/Class.cpp calls convertMethodToPropertyIfNeeded in the wrong direction: it rewrites an ancestor class's method record into a property using the derived class's getter/setter selectors. Generated metadata then declares members on classes that never implement those selectors.
ClassDecl::postProcessMembers iterates members of a class, then runs processDerivedClassRefs(member, derivedClassRefs), which invokes convertMethodToPropertyIfNeeded(member /* ancestor member */, cls->getMemberNamed(member.name) /* derived member */, false). Inside, when memberInSuperclass->kind == kMemberProperty — i.e. the derived class declared a property — the ancestor's method is converted to a property that copies memberInSuperclass->getterSelector/setterSelector, selectors that belong to the subclass and that the ancestor does not implement.
Observed in metadata.macos.arm64.nsmd (generated for the macosx SDK): a census found 213 phantom getters and 212 phantom setters. Example: NSView.autoscroll/NSClipView.autoscroll carry NSMatrix's isAutoscroll/setAutoscroll: — messaging a stock NSView with isAutoscroll raises -[NSView isAutoscroll]: unrecognized selector sent to instance.
Expected
A derived class's member declarations should not mutate the ancestor's member record; the property conversion should only flow superclass → subclass (which the postProcessMembers superclass walk already handles). Either drop the processDerivedClassRefs conversion or scope it so an ancestor never borrows a descendant's selectors.
Environment
NativeScript/runtimesmain(verified identical at5b697b39)metadata-generatorsource + generatedmetadata.macos.*.nsmd- Impact is multiplied by the napi backend's unguarded selector dispatch — reading any phantom member aborts the process instead of raising a JS error (filed separately).
- 主要语言
- C++
- 星标
- 27
- 派生
- 4
- 平均合并
- 5 天 11 小时
- 30 天内合并 PR
- 12
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
NativeScript/runtimes 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 30/100
NativeScript/runtimes#111 ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 22/100
NativeScript/runtimes#110 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 32/100
NativeScript/runtimes#109 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 18/100
NativeScript/runtimes#108 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 40/100
NativeScript/runtimes#107 ·
维护者通常 1 天内回复
查看 NativeScript/runtimes 的全部 Issue
相似的 Issue
-
documentation
难度 2/5 1-3 小时 新手友好度 70/100
EchoTools/nevr-runtime#2042 ·
维护者通常 1 天内回复
-
Download size and speed show scientific notation between 1000 and 1023 units可能已有人在做 @RaphaelFakhri 今天认领。 未关闭
难度 2/5 1 小时以内 新手友好度 88/100
kiwix/kiwix-desktop#1570 ·
维护者通常 1 天内回复
-
Device Request
难度 2/5 半天 新手友好度 62/100
dresden-elektronik/deconz-rest-plugin#8686 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
aminya/project_options#303 ·