1
0
mirror of https://github.com/twiglet/cs2j.git synced 2025-01-18 13:15:17 +01:00

error if we can't find class name in the environment

This commit is contained in:
Kevin Glynn 2011-02-14 11:49:55 +01:00
parent 19ec2e3478
commit 07cfecff4e

View File

@ -1406,15 +1406,20 @@ scope NSContext,SymTab;
$NSContext::namespaces.Add($NSContext::currentNS); $NSContext::namespaces.Add($NSContext::currentNS);
$NSContext::globalNamespaces.Add($NSContext::currentNS); $NSContext::globalNamespaces.Add($NSContext::currentNS);
ClassRepTemplate classTypeRep = (ClassRepTemplate)AppEnv.Search($NSContext::currentNS); ClassRepTemplate classTypeRep = (ClassRepTemplate)AppEnv.Search($NSContext::currentNS);
$SymTab::symtab["this"] = classTypeRep; if (classTypeRep == null) {
ClassRepTemplate baseType = ObjectType; Error($c.line, "Could not find class " + $NSContext::currentNS + " in the type environment");
if (classTypeRep.Inherits != null && classTypeRep.Inherits.Length > 0) { }
// if Inherits[0] is a class then it is parent, else system.object else {
ClassRepTemplate parent = AppEnv.Search(classTypeRep.Uses, classTypeRep.Inherits[0], ObjectType) as ClassRepTemplate; $SymTab::symtab["this"] = classTypeRep;
if (parent != null) ClassRepTemplate baseType = ObjectType;
baseType = parent; if (classTypeRep.Inherits != null && classTypeRep.Inherits.Length > 0) {
} // if Inherits[0] is a class then it is parent, else system.object
$SymTab::symtab["super"] = baseType; ClassRepTemplate parent = AppEnv.Search(classTypeRep.Uses, classTypeRep.Inherits[0], ObjectType) as ClassRepTemplate;
if (parent != null)
baseType = parent;
}
$SymTab::symtab["super"] = baseType;
}
} }
class_body magicAnnotation[$modifiers.tree, $identifier.tree, null, $c.token]) class_body magicAnnotation[$modifiers.tree, $identifier.tree, null, $c.token])
-> {$class_implements.hasExtends && $class_implements.extendDotNetType.IsA(AppEnv.Search("System.Attribute", new UnknownRepTemplate("System.Attribute")), AppEnv)}? magicAnnotation -> {$class_implements.hasExtends && $class_implements.extendDotNetType.IsA(AppEnv.Search("System.Attribute", new UnknownRepTemplate("System.Attribute")), AppEnv)}? magicAnnotation