Browse Source

cppparser: fix finding types in explicitly specialized template class

rdb 6 years ago
parent
commit
0e4597fb2e
1 changed files with 15 additions and 11 deletions
  1. 15 11
      dtool/src/cppparser/cppIdentifier.cxx

+ 15 - 11
dtool/src/cppparser/cppIdentifier.cxx

@@ -254,19 +254,23 @@ get_scope(CPPScope *current_scope, CPPScope *global_scope,
   }
   }
 
 
   while (i + 1 < (int)_names.size() && scope != nullptr) {
   while (i + 1 < (int)_names.size() && scope != nullptr) {
-    CPPScope *next_scope = scope->find_scope(_names[i].get_name(), global_scope);
+    // Check for an explicitly specialized scope first.
+    CPPScope *next_scope = scope->find_scope(_names[i].get_name_with_templ(), global_scope);
     if (next_scope == nullptr) {
     if (next_scope == nullptr) {
-      if (error_sink != nullptr) {
-        error_sink->error("Symbol " + _names[i].get_name() +
-                          " is not a known scope in " +
-                          scope->get_fully_scoped_name(),
-                          _loc);
+      next_scope = scope->find_scope(_names[i].get_name(), global_scope);
+      if (next_scope == nullptr) {
+        if (error_sink != nullptr) {
+          error_sink->error("Symbol " + _names[i].get_name() +
+                            " is not a known scope in " +
+                            scope->get_fully_scoped_name(),
+                            _loc);
+        }
+        return nullptr;
+      }
+      if (_names[i].has_templ()) {
+        next_scope = next_scope->instantiate(_names[i].get_templ(),
+                                             current_scope, global_scope);
       }
       }
-      return nullptr;
-    }
-    if (_names[i].has_templ()) {
-      next_scope = next_scope->instantiate(_names[i].get_templ(),
-                                           current_scope, global_scope);
     }
     }
     scope = next_scope;
     scope = next_scope;
     i++;
     i++;