Skip to content

Commit

Permalink
Merge pull request #703 from crwilcox/688
Browse files Browse the repository at this point in the history
Fixes #688 by Handling null _vars
  • Loading branch information
crwilcox committed Aug 21, 2015
2 parents baac242 + 4843e8f commit a9d1120
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 4 additions & 3 deletions Python/Product/Analysis/MemberResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public struct MemberResult {

internal MemberResult(string name, IEnumerable<AnalysisValue> vars) {
_name = _completion = name;
_vars = () => vars;
_vars = () => vars ?? Empty;
_type = null;
_type = GetMemberType;
}
Expand All @@ -42,7 +42,7 @@ public struct MemberResult {

internal MemberResult(string name, string completion, IEnumerable<AnalysisValue> vars, PythonMemberType? type) {
_name = name;
_vars = () => vars;
_vars = () => vars ?? Empty;
_completion = completion;
if (type != null) {
_type = () => type.Value;
Expand All @@ -54,7 +54,8 @@ public struct MemberResult {

internal MemberResult(string name, Func<IEnumerable<AnalysisValue>> vars, Func<PythonMemberType> type) {
_name = _completion = name;
_vars = vars;
Func<IEnumerable<AnalysisValue>> empty = () => Empty;
_vars = vars ?? empty;
_type = type;
}

Expand Down
3 changes: 2 additions & 1 deletion Python/Product/Analysis/ModuleAnalysis.cs
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,8 @@ private class ErrorWalker : PythonWalker {
.ToList();
} catch (Exception) {
// TODO: log exception
return new[] { new MemberResult("Unknown", null) };
Debug.Fail("Failed to find scope. Bad state in analysis");
return new[] { new MemberResult("Unknown", new AnalysisValue[] { }) };
}
}

Expand Down

0 comments on commit a9d1120

Please sign in to comment.