digitalmars.D - Any AST experts n da house?
- Andrei Alexandrescu (20/20) Nov 17 2016 Lucia is working on https://issues.dlang.org/show_bug.cgi?id=16683 which...
- Stefan Koch (3/26) Nov 17 2016 I am looking into it.
- Stefan Koch (4/10) Nov 17 2016 DSymbol is an abstract class.
- Jacob Carlborg (7/25) Nov 17 2016 Not related to the actual question. Instead of explicitly creating a new...
Lucia is working on https://issues.dlang.org/show_bug.cgi?id=16683 which shows good promise in cleaning the cobwebs around Typeinfo. She looked into matters and figured she needs to have TypeidExp.semantic() return the lowered expression. In the code below getFuncTemplateDecl(tidSymbol); // returns nil and the compiler crashes when it hits this line. // extern (C++) final class TypeidExp : Expression dmd-> expression.d override Expression semantic(Scope* sc) { auto tidIdentifierExp = new IdentifierExp(loc, new Identifier("__typeidImplT")); auto tidSymbol = new Dsymbol(new Identifier("__typeidImplT")); auto tidDeclaration = getFuncTemplateDecl(tidSymbol); auto tidExp = new TemplateExp(loc, tidDeclaration); auto callExp = new CallExp(loc, tidExp); return callExp; } Any help would be appreciated. Thanks, Andrei
Nov 17 2016
On Thursday, 17 November 2016 at 14:10:01 UTC, Andrei Alexandrescu wrote:Lucia is working on https://issues.dlang.org/show_bug.cgi?id=16683 which shows good promise in cleaning the cobwebs around Typeinfo. She looked into matters and figured she needs to have TypeidExp.semantic() return the lowered expression. In the code below getFuncTemplateDecl(tidSymbol); // returns nil and the compiler crashes when it hits this line. // extern (C++) final class TypeidExp : Expression dmd-> expression.d override Expression semantic(Scope* sc) { auto tidIdentifierExp = new IdentifierExp(loc, new Identifier("__typeidImplT")); auto tidSymbol = new Dsymbol(new Identifier("__typeidImplT")); auto tidDeclaration = getFuncTemplateDecl(tidSymbol); auto tidExp = new TemplateExp(loc, tidDeclaration); auto callExp = new CallExp(loc, tidExp); return callExp; } Any help would be appreciated. Thanks, AndreiI am looking into it.
Nov 17 2016
On Thursday, 17 November 2016 at 14:11:50 UTC, Stefan Koch wrote:On Thursday, 17 November 2016 at 14:10:01 UTC, Andrei Alexandrescu wrote:auto tidSymbol = new Dsymbol(newDSymbol is an abstract class. It is not meant to be used.Identifier("__typeidImplT")); AndreiI am looking into it.
Nov 17 2016
On 2016-11-17 15:10, Andrei Alexandrescu wrote:Lucia is working on https://issues.dlang.org/show_bug.cgi?id=16683 which shows good promise in cleaning the cobwebs around Typeinfo. She looked into matters and figured she needs to have TypeidExp.semantic() return the lowered expression. In the code below getFuncTemplateDecl(tidSymbol); // returns nil and the compiler crashes when it hits this line. // extern (C++) final class TypeidExp : Expression dmd-> expression.d override Expression semantic(Scope* sc) { auto tidIdentifierExp = new IdentifierExp(loc, new Identifier("__typeidImplT")); auto tidSymbol = new Dsymbol(new Identifier("__typeidImplT")); auto tidDeclaration = getFuncTemplateDecl(tidSymbol); auto tidExp = new TemplateExp(loc, tidDeclaration); auto callExp = new CallExp(loc, tidExp); return callExp; } Any help would be appreciated.Not related to the actual question. Instead of explicitly creating a new identifier, use Identifier.idPool [1], which will reuse any existing identifier or create a new one if necessary. [1] https://github.com/dlang/dmd/blob/master/src/identifier.d#L141 -- /Jacob Carlborg
Nov 17 2016