@@ -54,7 +54,7 @@ internal NamespaceTracker GetOrMakeChildPackage(string childName, Assembly assem
54
54
55
55
if ( _dict . TryGetValue ( childName , out MemberTracker ret ) ) {
56
56
// If we have a module, then we add the assembly to the InnerModule
57
- // If it's not a module, we'll wipe it out below, eg "def System(): pass" then
57
+ // If it's not a module, we'll wipe it out below, eg "def System(): pass" then
58
58
// "import System" will result in the namespace being visible.
59
59
if ( ret is NamespaceTracker package ) {
60
60
if ( ! package . _packageAssemblies . Contains ( assem ) ) {
@@ -102,10 +102,11 @@ internal void AddTypeName(string typeName, Assembly assem) {
102
102
Assert . NotNull ( typeName , assem ) ;
103
103
Debug . Assert ( typeName . IndexOf ( '.' ) == - 1 ) ; // This is the simple name, not the full name
104
104
105
- if ( ! _typeNames . ContainsKey ( assem ) ) {
106
- _typeNames [ assem ] = new TypeNames ( assem , _fullName ) ;
105
+ if ( ! _typeNames . TryGetValue ( assem , out TypeNames typeNames ) ) {
106
+ typeNames = new TypeNames ( assem , _fullName ) ;
107
+ _typeNames [ assem ] = typeNames ;
107
108
}
108
- _typeNames [ assem ] . AddTypeName ( typeName ) ;
109
+ typeNames . AddTypeName ( typeName ) ;
109
110
110
111
string normalizedTypeName = ReflectionUtils . GetNormalizedTypeName ( typeName ) ;
111
112
if ( _dict . ContainsKey ( normalizedTypeName ) ) {
@@ -194,9 +195,9 @@ private NamespaceTracker GetOrMakePackageHierarchy(Assembly assem, string fullNa
194
195
}
195
196
/// <summary>
196
197
/// As a fallback, so if the type does exist in any assembly. This would happen if a new type was added
197
- /// that was not in the hardcoded list of types.
198
+ /// that was not in the hardcoded list of types.
198
199
/// This code is not accurate because:
199
- /// 1. We dont deal with generic types (TypeCollision).
200
+ /// 1. We dont deal with generic types (TypeCollision).
200
201
/// 2. Previous calls to GetCustomMemberNames (eg. "from foo import *" in Python) would not have included this type.
201
202
/// 3. This does not deal with new namespaces added to the assembly
202
203
/// </summary>
@@ -215,7 +216,7 @@ private MemberTracker CheckForUnlistedType(string nameString) {
215
216
continue ;
216
217
}
217
218
218
- // We dont use TypeCollision.UpdateTypeEntity here because we do not handle generic type names
219
+ // We dont use TypeCollision.UpdateTypeEntity here because we do not handle generic type names
219
220
return TypeTracker . GetTypeTracker ( type ) ;
220
221
}
221
222
@@ -309,7 +310,7 @@ private IList AddKeys(IList res) {
309
310
}
310
311
}
311
312
}
312
-
313
+
313
314
return res ;
314
315
}
315
316
@@ -405,10 +406,7 @@ internal void AddTypeName(string typeName) {
405
406
if ( normalizedName == typeName ) {
406
407
_simpleTypeNames . Add ( typeName ) ;
407
408
} else {
408
- List < string > actualNames ;
409
- if ( _genericTypeNames . ContainsKey ( normalizedName ) ) {
410
- actualNames = _genericTypeNames [ normalizedName ] ;
411
- } else {
409
+ if ( ! _genericTypeNames . TryGetValue ( normalizedName , out List < string > actualNames ) ) {
412
410
actualNames = new List < string > ( ) ;
413
411
_genericTypeNames [ normalizedName ] = actualNames ;
414
412
}
0 commit comments