Skip to content

Commit 6c4acd1

Browse files
packaging system change
1 parent 985c162 commit 6c4acd1

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

ReCT/CodeAnalysis/Binding/Binder.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2144,10 +2144,18 @@ public static TypeSymbol LookupType(string name)
21442144
default:
21452145
if (TypeSymbol.Class == null) TypeSymbol.Class = new Dictionary<ClassSymbol, TypeSymbol>();
21462146
var type = TypeSymbol.Class.Values.FirstOrDefault(x => x.Name == name);
2147+
if (type != null) return type;
2148+
2149+
foreach(var package in Binder._packageNamespaces)
2150+
{
2151+
type = TypeSymbol.Class[package.scope.GetDeclaredClasses().FirstOrDefault(x => x.Name == name)];
2152+
if (type != null)
2153+
return type;
2154+
}
21472155

21482156
//if (type == null) throw new Exception($"Couldnt find type '{name}'!");
21492157

2150-
return type;
2158+
return null;
21512159
}
21522160
}
21532161
private TypeSymbol TypeToArray(TypeSymbol type)

ReCT/CodeAnalysis/Packager/Packager.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,13 @@ static string netTypeLookup(string netversion, string[] inThisPackage)
202202
if (inThisPackage.FirstOrDefault(x => x.ToLower() == netversion) != null)
203203
return inThisPackage.FirstOrDefault(x => x.ToLower() == netversion);
204204

205+
foreach(var package in Binder._packageNamespaces)
206+
{
207+
var type = package.scope.GetDeclaredClasses().FirstOrDefault(x => x.Name.ToLower() == netversion.ToLower());
208+
if (type != null)
209+
return type.Name;
210+
}
211+
205212
throw new Exception($"Couldnt find .Net type '{netversion}'");
206213
}
207214
}

0 commit comments

Comments
 (0)