www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15404] New: [internal] DotIdExp(TOKdot) and DotExp(TOKdotexp)


          Issue ID: 15404
           Summary: [internal] DotIdExp(TOKdot) and DotExp(TOKdotexp)
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: ice
          Severity: trivial
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: k.hara.pg gmail.com

In expression.d:

extern (C++) final class DotIdExp : UnaExp
    Identifier ident;

    extern (D) this(Loc loc, Expression e, Identifier ident)
        super(loc, TOKdot, __traits(classInstanceSize, DotIdExp), e);
        this.ident = ident;


extern (C++) final class DotExp : BinExp
    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.

Dec 03 2015