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

support proprties in static types like System.Console.Out

This commit is contained in:
Kevin Glynn 2011-01-13 15:22:12 +01:00
parent 882110a8ef
commit 769b37bb67

@ -217,13 +217,14 @@ scope {
| ^(d1='.' e1=expression i1=identifier generic_argument_list?)
{
InterfaceRepTemplate expType = $e1.dotNetType as InterfaceRepTemplate;
// Is it a property read? Ensure we are not being applied to arguments or about to be assigned
if (expType != null &&
($primary_expression.Count == 1 || !((primary_expression_scope)($primary_expression.ToArray()[1])).parentIsApply) &&
($assignment.Count == 0 || !$assignment::parentIsSetter)) {
Debug($d1.token.Line + ": '" + $i1.thetext + "' might be a property");
ResolveResult fieldResult = expType.Resolve($i1.thetext, AppEnv);
if (fieldResult != null) {
Debug($d1.token.Line + ": Found '" + $i1.thetext + "'");
@ -232,6 +233,16 @@ scope {
ret = mkJavaWrapper(fieldResult.Result.Java, myMap, $i1.tree.Token);
$dotNetType = fieldResult.ResultType;
}
else if ($e1.dotNetType is UnknownRepTemplate) {
string staticType = $e1.dotNetType + "." + $i1.thetext;
TypeRepTemplate type = findType(staticType);
if (type != null) {
$dotNetType = type;
}
else {
$dotNetType = new UnknownRepTemplate(staticType);
}
}
}
}
| ^('->' expression identifier generic_argument_list?)
@ -273,6 +284,10 @@ scope {
found = true;
}
}
if (!found) {
// Not a variable, not a property read, not a type, is it part of a type name?
$dotNetType = new UnknownRepTemplate($identifier.thetext);
}
}
| primary_expression_start
// ('this' brackets) => 'this' brackets primary_expression_part*