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

treat failures to resolve as unknowntypes (and then they become eligible to be treated as system.Object)

This commit is contained in:
Kevin Glynn 2011-01-28 18:22:36 +01:00
parent fb578b8dc2
commit d5bad8bc11

View File

@ -366,6 +366,7 @@ scope {
^(INDEX ie=expression expression_list?) ^(INDEX ie=expression expression_list?)
{ {
if ($ie.dotNetType != null) { if ($ie.dotNetType != null) {
$dotNetType = new UnknownRepTemplate($ie.dotNetType.TypeName+".INDEXER");
ResolveResult indexerResult = $ie.dotNetType.ResolveIndexer($expression_list.expTypes ?? new List<TypeRepTemplate>(), AppEnv); ResolveResult indexerResult = $ie.dotNetType.ResolveIndexer($expression_list.expTypes ?? new List<TypeRepTemplate>(), AppEnv);
if (indexerResult != null) { if (indexerResult != null) {
IndexerRepTemplate indexerRep = indexerResult.Result as IndexerRepTemplate; IndexerRepTemplate indexerRep = indexerResult.Result as IndexerRepTemplate;
@ -390,6 +391,7 @@ scope {
^(APPLY (^('.' e2=expression {expType = $e2.dotNetType; implicitThis = false;} i2=identifier)|i2=identifier) argument_list?) ^(APPLY (^('.' e2=expression {expType = $e2.dotNetType; implicitThis = false;} i2=identifier)|i2=identifier) argument_list?)
{ {
if (expType != null) { if (expType != null) {
$dotNetType = new UnknownRepTemplate(expType.TypeName+".APPLY");
ResolveResult methodResult = expType.Resolve($i2.thetext, $argument_list.argTypes ?? new List<TypeRepTemplate>(), AppEnv); ResolveResult methodResult = expType.Resolve($i2.thetext, $argument_list.argTypes ?? new List<TypeRepTemplate>(), AppEnv);
if (methodResult != null) { if (methodResult != null) {
Debug($i2.tree.Token.Line + ": Found '" + $i2.thetext + "'"); Debug($i2.tree.Token.Line + ": Found '" + $i2.thetext + "'");
@ -428,6 +430,8 @@ scope {
Debug($d1.token.Line + ": '" + $i1.thetext + "' might be a property"); Debug($d1.token.Line + ": '" + $i1.thetext + "' might be a property");
$dotNetType = new UnknownRepTemplate(expType.TypeName+".DOTACCESS");
ResolveResult fieldResult = expType.Resolve($i1.thetext, AppEnv); ResolveResult fieldResult = expType.Resolve($i1.thetext, AppEnv);
if (fieldResult != null) { if (fieldResult != null) {
Debug($d1.token.Line + ": Found '" + $i1.thetext + "'"); Debug($d1.token.Line + ": Found '" + $i1.thetext + "'");
@ -510,6 +514,7 @@ scope {
| ^(n=NEW type argument_list? object_or_collection_initializer?) | ^(n=NEW type argument_list? object_or_collection_initializer?)
{ {
ClassRepTemplate conType = $type.dotNetType as ClassRepTemplate; ClassRepTemplate conType = $type.dotNetType as ClassRepTemplate;
$dotNetType = $type.dotNetType;
ResolveResult conResult = conType.Resolve($argument_list.argTypes, AppEnv); ResolveResult conResult = conType.Resolve($argument_list.argTypes, AppEnv);
if (conResult != null) { if (conResult != null) {
ConstructorRepTemplate conRep = conResult.Result as ConstructorRepTemplate; ConstructorRepTemplate conRep = conResult.Result as ConstructorRepTemplate;