Permalink
Browse files

Fixed potential cause of CSharpAstResolver.Resolve returning null.

  • Loading branch information...
1 parent e80f142 commit df380b6055511fd9aeb16647bad3b5d13f4e53ce @dgrunwald dgrunwald committed Mar 15, 2012
Showing with 4 additions and 16 deletions.
  1. +4 −16 ICSharpCode.NRefactory.CSharp/Resolver/ResolveVisitor.cs
@@ -425,31 +425,19 @@ public ResolveResult GetResolveResult(AstNode node)
if (resolveResultCache.TryGetValue(node, out result))
return result;
- bool needResolveParent = (node.NodeType == NodeType.Token || IsVar(node));
-
- AstNode nodeToResolve = node;
- if (needResolveParent) {
- nodeToResolve = node.Parent;
- if (resolveResultCache.ContainsKey(nodeToResolve))
- return null;
- }
-
AstNode parent;
- CSharpResolver storedResolver = GetPreviouslyScannedContext(nodeToResolve, out parent);
+ CSharpResolver storedResolver = GetPreviouslyScannedContext(node, out parent);
ResetContext(
storedResolver,
delegate {
- navigator = new NodeListResolveVisitorNavigator(node, nodeToResolve);
+ navigator = new NodeListResolveVisitorNavigator(node);
Debug.Assert(!resolverEnabled);
Scan(parent);
navigator = skipAllNavigator;
});
MergeUndecidedLambdas();
- if (resolveResultCache.TryGetValue(node, out result))
- return result;
- else
- return null;
+ return resolveResultCache[node];
}
CSharpResolver GetPreviouslyScannedContext(AstNode node, out AstNode parent)
@@ -517,7 +505,7 @@ public ConversionWithTargetType GetConversionWithTargetType(Expression expr)
return result;
} else {
ResolveResult rr = GetResolveResult(expr);
- return new ConversionWithTargetType(Conversion.IdentityConversion, rr != null ? rr.Type : SpecialType.UnknownType);
+ return new ConversionWithTargetType(Conversion.IdentityConversion, rr.Type);
}
}
#endregion

0 comments on commit df380b6

Please sign in to comment.