Bug 15404 – [internal] DotIdExp(TOKdot) and DotExp(TOKdotexp)
Status
RESOLVED
Resolution
FIXED
Severity
trivial
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-12-04T01:13:00Z
Last change time
2017-08-02T08:07:05Z
Keywords
ice, pull
Assigned to
nobody
Creator
k.hara.pg
Comments
Comment #0 by k.hara.pg — 2015-12-04T01:13:17Z
In expression.d:
extern (C++) final class DotIdExp : UnaExp
{
public:
Identifier ident;
extern (D) this(Loc loc, Expression e, Identifier ident)
{
super(loc, TOKdot, __traits(classInstanceSize, DotIdExp), e);
this.ident = ident;
}
and:
extern (C++) final class DotExp : BinExp
{
public:
extern (D) this(Loc loc, Expression e1, Expression e2)
{
super(loc, TOKdotexp, __traits(classInstanceSize, DotExp), e1, e2);
}
Few years ago when I started to read dmd code, I had confused about that TOKdot is not associated with DotExp.
And also I couldn't understand why there isn't TOKdotid token for DotIdExp, because, in contrast, DotTemplateExp and DotTemplateInstanceExp are using TOKdottd and TOKdotti.
The two classes DotIdExp and DotExp have similar names, so the inconsistency of AST class names and token names would be unfriendly for beginner contributors.
I'd propose to fix them as:
1. Introduce a new token TOKdotid and use it for DotIdExp.
2. Use TOKdot for DotExp, then remove TOKdotexp.