Comments are attached to wrong nodes as inner position
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- javascript, typescript
- 领域
- compilers
调研方向
使用提供的 JavaScript 和“Attach comments”选项,在 Esprima 演示解析页面中重现该问题。从该入口点跟踪注释附加过程,并验证注释没有重复,也没有附加到错误的节点,同时保留 Comment 3 作为其块的内部注释。
由索引模型根据 Issue 内容生成。
描述
Steps to reproduce:
- Use Esprima demo page: https://esprima.org/demo/parse.html
- Copy paste this code inside the editor
function a() {
var b = 5;
/* Comment1 */
}
/* Comment2 */
{
/* Comment 3 */
}
- Check option (checkbox) "Attach comments"
Expected output:
All comments are trailing or leading with exception of the inner comment for "Comment 3"
Actual output:
{
"type": "Program",
"body": [
{
"type": "FunctionDeclaration",
"id": {
"type": "Identifier",
"name": "a"
},
"params": [],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "VariableDeclaration",
"declarations": [
{
"type": "VariableDeclarator",
"id": {
"type": "Identifier",
"name": "b"
},
"init": {
"type": "Literal",
"value": 5,
"raw": "5"
}
}
],
"kind": "var",
"trailingComments": [
{
"type": "Block",
"value": " Comment1 ",
"range": [
32,
46
]
}
]
}
]
},
"generator": false,
"expression": false,
"async": false,
"trailingComments": [
{
"type": "Block",
"value": " Comment2 ",
"range": [
49,
63
]
}
]
},
{
"type": "BlockStatement",
"body": [],
"innerComments": [
{
"type": "Block",
"value": " Comment1 ",
"range": [
32,
46
]
},
{
"type": "Block",
"value": " Comment2 ",
"range": [
49,
63
]
},
{
"type": "Block",
"value": " Comment 3 ",
"range": [
69,
84
]
}
]
}
],
"sourceType": "script"
}
- 主要语言
- TypeScript
- 星标
- 7.1k
- 派生
- 772
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
jquery/esprima 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 35/100
-
难度 4/5 3-5 天 新手友好度 52/100
-
难度 3/5 1-2 天 新手友好度 35/100
-
难度 4/5 3-5 天 新手友好度 35/100
-
难度 4/5 3-5 天 新手友好度 35/100
相似的 Issue
-
🐛 The Rulekeeper - An index run that gives up on the lock ends Succeeded可能已有人在做 @github-actions 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
SSWConsulting/SSW.Rules#2809 · 1 条评论 ·
维护者通常 1 天内回复
-
automated-triage type/bug type/ci
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
📦 expo-router Android contributor: external needs review sdk-58 severity: medium
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
documentation good first issue
难度 2/5 1-3 小时 新手友好度 84/100
asasemahmed/openboard#68 ·
维护者通常 1 天内回复