CFML: `createObject("component", "dotted.path")` creates no `instantiates` edge and gives no type to the chained receiver

已关闭
#2,652 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

已经有一个关联 PR 被合并了。

  • #2841 来自 @colbymchenry —— 已合并

评估

难度
4/5
预计耗时
3-5 天
新手友好度
55/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
领域
devtools

调研方向

Start by locating how new a.b.C() creates instantiation edges and how extends resolves dotted paths; the issue does not name those files or tests. Then trace how chained .init(...) receivers are typed, including the behavior referenced in #1155. Done means a string-literal createObject("component", "a.b.c") creates a resolved instantiation edge and types the chained receiver and assigned variable.

由索引模型根据 Issue 内容生成。

描述

Summary

new foo.bar.Baz() produces an instantiates edge. The equally common createObject form does not, and older code uses it more often than new.

<cfset var oContext = createObject("component", "contenscms.core.queue.batchcontext").init()>

For this line (contens/api/v2/contens/batch/collection.cfc:33) the index has:

  • no instantiates edge to contens/core/queue/batchcontext.cfc
  • init in unresolved_refs

Numbers from our project

Pattern Occurrences instantiates edges
new a.b.C(...) 158 160 (all instantiates edges under contens/)
createObject("component", "<literal>") 417 0

No instantiates edge in the index has a dotted ref name.

Expected

When the second argument is a string literal, treat createObject("component", "a.b.c") like new a.b.c():

  • create an instantiates edge, resolved with the same dotted-path rules as extends
  • type the receiver of a chained .init(...) and the assigned variable as that component, so the receiver inference from #1155 can use it

The one-argument form createObject("a.b.c") (supported by Lucee and ACF) could be handled the same way.

主要语言
C
星标
73.2k
派生
4.7k
平均合并
3 小时 39 分钟
30 天内合并 PR
528

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

colbymchenry/codegraph 的其他 Issue

查看 colbymchenry/codegraph 的全部 Issue

相似的 Issue

更多 C Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。