Need clarification on dmd symbol generation

Dicebot m.strashun at gmail.com
Wed Apr 10 03:21:12 PDT 2013


On Wednesday, 10 April 2013 at 09:37:44 UTC, kenji hara wrote:
> OK. I don't understand the issue enough, but I'd like to help 
> you.
>
> - TemplateInstance::tinst may represent the enclosing template 
> instance
> that 'this' instance is instantiated. It is set in
> TemplateInstance::semantic(|2|3) for its member's semantic 
> process.
>
> - TemplateInstance::enclosing may represent the parent of 
> nested template
> instance. If a template is instantiated in function scope with 
> implicit
> context, it points the function. It is set in
> TemplateInstance::hasNestedArgs.
>
> - Module::importedFrom may represents the "root module" of 
> import chain. it
> points one of the module that listed in command line.
>
> Good luck.
>
> Kenji Hara

I see no TemplateInstance::enclosing, only Scope::enclosing and 
TemplateInstance is not Scope descendant. Essentially I need to 
emit symbols not for "importedFrom" module but for module of 
top-most tinst in chain. I supposed that iterating tinst can do 
the trick, but it is not. For example, when map is used, it call 
templated range functions somewhere down the line and iterating 
up from those don't get you initial map call scope. (Same issue 
in printInstantiationTrace as it uses this method).

Is this a problem with setting correct tinst initialization in 
other code, my misunderstanding or, probably, this info may be 
relied upon only in semantic3, not semantic1?


More information about the Digitalmars-d mailing list