Skip to content
Snippets Groups Projects
Commit 97d93ed3 authored by Roberto Raggi's avatar Roberto Raggi
Browse files

Enabled the template instantiation.

parent f446363d
No related branches found
No related tags found
No related merge requests found
......@@ -399,18 +399,16 @@ FullySpecifiedType DeprecatedGenTemplateInstance::gen(Symbol *symbol)
FullySpecifiedType DeprecatedGenTemplateInstance::instantiate(const Name *className, Symbol *candidate,
QSharedPointer<Control> control)
{
#warning robe: enable template instantiation
#if 0
if (className) {
if (const TemplateNameId *templId = className->asTemplateNameId()) {
if (Class *klass = candidate->scope()->asClass()) {
if (Template *templ = candidate->enclosingTemplate()) {
DeprecatedGenTemplateInstance::Substitution subst;
for (unsigned i = 0; i < templId->templateArgumentCount(); ++i) {
FullySpecifiedType templArgTy = templId->templateArgumentAt(i);
if (i < klass->templateParameterCount()) {
const Name *templArgName = klass->templateParameterAt(i)->name();
if (i < templ->templateParameterCount()) {
const Name *templArgName = templ->templateParameterAt(i)->name();
if (templArgName && templArgName->identifier()) {
const Identifier *templArgId = templArgName->identifier();
......@@ -424,6 +422,5 @@ FullySpecifiedType DeprecatedGenTemplateInstance::instantiate(const Name *classN
}
}
}
#endif
return candidate->type();
}
......@@ -251,6 +251,15 @@ Namespace *Symbol::enclosingNamespace() const
return 0;
}
Template *Symbol::enclosingTemplate() const
{
for (Scope *s = _scope; s; s = s->scope()) {
if (Template *templ = s->asTemplate())
return templ;
}
return 0;
}
Class *Symbol::enclosingClass() const
{
for (Scope *s = _scope; s; s = s->scope()) {
......
......@@ -292,6 +292,9 @@ public:
/// Returns the eclosing namespace scope.
Namespace *enclosingNamespace() const;
/// Returns the eclosing template scope.
Template *enclosingTemplate() const;
/// Returns the enclosing class scope.
Class *enclosingClass() const;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment