Re: Cast to subclass in the dmd compiler

2017-07-26 Thread unDEFER via Digitalmars-d-learn
On Wednesday, 26 July 2017 at 06:50:21 UTC, Jacob Carlborg wrote: For Expression, there's a field called "op" that indicates what kind of expression it is, which can used in combination with a cast. Thank you for hint!

Re: Cast to subclass in the dmd compiler

2017-07-26 Thread Jacob Carlborg via Digitalmars-d-learn
On 2017-07-25 23:06, unDEFER wrote: I have found the answer in the code. Right code is: Import imp = m.isImport(); if (imp !is null) Thank you. That's the correct solution. For Expression, there's a field called "op" that indicates what kind of expression it is, which can used in

Re: Cast to subclass in the dmd compiler

2017-07-25 Thread Nicholas Wilson via Digitalmars-d-learn
On Tuesday, 25 July 2017 at 21:06:25 UTC, unDEFER wrote: I have found the answer in the code. Right code is: Import imp = m.isImport(); if (imp !is null) Thank you. grep for kluge in code, you'll find all the places it does its own RTTI.

Re: Cast to subclass in the dmd compiler

2017-07-25 Thread unDEFER via Digitalmars-d-learn
I have found the answer in the code. Right code is: Import imp = m.isImport(); if (imp !is null) Thank you.

Re: Cast to subclass in the dmd compiler

2017-07-25 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/25/17 4:36 PM, unDEFER wrote: Hello! I'm hacking dmd compiler and trying to look on members array just after parse module. for(uint i = 0; i < members.dim; i++) { Dsymbol m = (*members)[i]; // It is good, but further: Import imp = cast(Import) m; if (imp !is null)

Cast to subclass in the dmd compiler

2017-07-25 Thread unDEFER via Digitalmars-d-learn
Hello! I'm hacking dmd compiler and trying to look on members array just after parse module. for(uint i = 0; i < members.dim; i++) { Dsymbol m = (*members)[i]; // It is good, but further: Import imp = cast(Import) m; if (imp !is null) { printf(" import %s.%s\n",