mirror of
https://github.com/twiglet/cs2j.git
synced 2025-01-18 13:15:17 +01:00
identify typevars in findType. TypeVarRepTemplate derives from ClassRepTemplate so that we don't try to initialise variables of type T
This commit is contained in:
parent
94fa86d57e
commit
b6d57d4bd2
@ -3222,10 +3222,10 @@ namespace Twiglet.CS2J.Translator.TypeRep
|
|||||||
}
|
}
|
||||||
|
|
||||||
[XmlType("TypeVariable")]
|
[XmlType("TypeVariable")]
|
||||||
// Represents Type Variables. We inherit from StructRepTemplate to that
|
// Represents Type Variables. We inherit from ClassRepTemplate to that
|
||||||
// Type Variables have the same interface as types, but we can override as
|
// Type Variables have the same interface as types, but we can override as
|
||||||
// neccessary
|
// neccessary
|
||||||
public class TypeVarRepTemplate : StructRepTemplate, IEquatable<TypeVarRepTemplate>
|
public class TypeVarRepTemplate : ClassRepTemplate, IEquatable<TypeVarRepTemplate>
|
||||||
{
|
{
|
||||||
|
|
||||||
public TypeVarRepTemplate ()
|
public TypeVarRepTemplate ()
|
||||||
|
@ -96,10 +96,16 @@ scope SymTab {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected TypeRepTemplate findType(string name) {
|
protected TypeRepTemplate findType(string name) {
|
||||||
|
if ($NSContext::globalTypeVariables.Contains(name)) {
|
||||||
|
return new TypeVarRepTemplate(name);
|
||||||
|
}
|
||||||
return AppEnv.Search($NSContext::globalNamespaces, name, new UnknownRepTemplate(name));
|
return AppEnv.Search($NSContext::globalNamespaces, name, new UnknownRepTemplate(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected TypeRepTemplate findType(string name, ICollection<TypeRepTemplate> args) {
|
protected TypeRepTemplate findType(string name, ICollection<TypeRepTemplate> args) {
|
||||||
|
if (args == null || args.Count == 0) {
|
||||||
|
return findType(name);
|
||||||
|
}
|
||||||
StringBuilder argNames = new StringBuilder();
|
StringBuilder argNames = new StringBuilder();
|
||||||
bool first = true;
|
bool first = true;
|
||||||
if (args != null && args.Count > 0) {
|
if (args != null && args.Count > 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user