logic: template argument handling

* now Coati will also parse the body of an instantiated template function and follow calls to other template functions there.
* Coati will parse template arguments at the point of implicit or explicit template instantiation and explicit template specialization.
* refactored template handling in storage.
This commit is contained in:
malte_langkabel
2015-12-08 10:29:21 +01:00
parent faa79e44f1
commit ed4b6546f0
10 changed files with 565 additions and 281 deletions
+7 -7
View File
@@ -531,16 +531,16 @@ Id Storage::onTypeUsageParsed(const ParseTypeUsage& typeUsage, const ParseVariab
}
Id Storage::onTemplateArgumentTypeOfTemplateRecordParsed(
const ParseLocation& location, const NameHierarchy& argumentNameHierarchy,
const NameHierarchy& templateNameHierarchy)
const ParseLocation& location, const NameHierarchy& argumentTypeNameHierarchy,
const NameHierarchy& templateNameHierarchy)
{
log(
"template argument type",
argumentNameHierarchy.getFullName() + " -> " + templateNameHierarchy.getFullName(),
argumentTypeNameHierarchy.getFullName() + " -> " + templateNameHierarchy.getFullName(),
location
);
Id argumentNodeId = addNodeHierarchy(Node::NODE_TYPE, argumentNameHierarchy, false);
Id argumentNodeId = addNodeHierarchy(Node::NODE_TYPE, argumentTypeNameHierarchy, false);
// does not need a source location because this type that is already defined (and therefore has a location).
Id templateNodeId = addNodeHierarchy(Node::NODE_TYPE, templateNameHierarchy, false);
@@ -551,16 +551,16 @@ Id Storage::onTemplateArgumentTypeOfTemplateRecordParsed(
}
Id Storage::onTemplateArgumentTypeOfTemplateFunctionParsed(
const ParseLocation& location, const NameHierarchy& argumentNameHierarchy,
const ParseLocation& location, const NameHierarchy& argumentTypeNameHierarchy,
const ParseFunction& templateFunction)
{
log(
"template argument type",
argumentNameHierarchy.getFullName() + " -> " + templateFunction.getFullName(),
argumentTypeNameHierarchy.getFullName() + " -> " + templateFunction.getFullName(),
location
);
Id argumentNodeId = addNodeHierarchy(Node::NODE_TYPE, argumentNameHierarchy, false);
Id argumentNodeId = addNodeHierarchy(Node::NODE_TYPE, argumentTypeNameHierarchy, false);
// does not need a source location because this type that is already defined (and therefore has a location).
Id templateNodeId = addNodeHierarchyWithDistinctSignature(Node::NODE_FUNCTION, templateFunction, false);