microsoft / microsoft/TypeScript
Gracefully handle template literal properties in the parser
未关闭
还没有人认领这个 Issue。
Domain: Error Messages
Effort: Moderate
Experience Enhancement
Help Wanted
- 主要语言
- Go
- 星标
- 111k
- 派生
- 14.3k
- 平均合并
- 2 天 4 小时
- 30 天内合并 PR
- 132
描述
var x = {
a: "Hello"
`b`: 123
}
Right now, the parser encounters the template string, decides it should bail out of object literal parsing, and we more or less recover thinking we have something like the following:
var x = ({ a: "Hello" } `b`) : 123 }
So we'll report an error on what we think is:
{ a: "Hello" } `b`
- On the syntactic layer under ES5 mode, we'll say tagged templates are not supported unless in ES6.
- On the semantic layer, we'll say
{ a: "Hello" }is not invokable.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 parser 的对象字面量处理开始,在 ES5 和 ES6 模式下重现所示的模板字面量属性案例。跟踪 parser 如何在模板字符串处进行恢复,并比较由此产生的语法诊断和语义诊断。完成的标准是:这个格式错误或不受支持的构造能够获得适当的诊断,而不会被误读为带标签调用。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- typescript
- 领域
- compilers
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100