From 67344feb91619c6aee71d157c8c4b36d3ad2b892 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D0=BE=D0=BD=D0=B4=D0=B0=D1=80=D0=B5=D0=B2=20=D0=98?= =?UTF-8?q?=D0=B2=D0=B0=D0=BD?= Date: Sun, 27 May 2018 14:35:53 +0200 Subject: [PATCH] fix #863 --- CodeCompletion/DomSyntaxTreeVisitor.cs | 19 +++++++++++++++---- CodeCompletion/SymTable.cs | 2 +- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/CodeCompletion/DomSyntaxTreeVisitor.cs b/CodeCompletion/DomSyntaxTreeVisitor.cs index d2d220e62..8dc393660 100644 --- a/CodeCompletion/DomSyntaxTreeVisitor.cs +++ b/CodeCompletion/DomSyntaxTreeVisitor.cs @@ -578,7 +578,18 @@ namespace CodeCompletion } public document doc; - + + public location get_location(SourceContext sc) + { + if (sc == null) + { + return null; + } + return new location(sc.begin_position.line_num, sc.begin_position.column_num, + sc.end_position.line_num, sc.end_position.column_num, doc); + } + + public location get_location(syntax_tree_node tn) { if (tn.source_context==null) @@ -2021,7 +2032,7 @@ namespace CodeCompletion SymScope tmp = cur_scope; SymScope stmt_scope = new BlockScope(cur_scope); cur_scope.AddName("$block_scope",stmt_scope); - stmt_scope.loc = get_location(_unit_module.initialization_part); + stmt_scope.loc = get_location(_unit_module.initialization_part.left_logical_bracket.source_context.Merge(_unit_module.initialization_part.right_logical_bracket.source_context)); cur_scope = stmt_scope; _unit_module.initialization_part.visit(this); cur_scope = tmp; @@ -2031,8 +2042,8 @@ namespace CodeCompletion SymScope tmp = cur_scope; SymScope stmt_scope = new BlockScope(cur_scope); cur_scope.AddName("$block_scope",stmt_scope); - stmt_scope.loc = get_location(_unit_module.finalization_part); - cur_scope = stmt_scope; + stmt_scope.loc = get_location(_unit_module.finalization_part.left_logical_bracket.source_context.Merge(_unit_module.finalization_part.right_logical_bracket.source_context)); + cur_scope = stmt_scope; _unit_module.finalization_part.visit(this); cur_scope = tmp; } diff --git a/CodeCompletion/SymTable.cs b/CodeCompletion/SymTable.cs index 193d7a4d7..56dd0e648 100644 --- a/CodeCompletion/SymTable.cs +++ b/CodeCompletion/SymTable.cs @@ -478,7 +478,7 @@ namespace CodeCompletion public void AddUsedUnit(SymScope unit) { - if (this.si.name != "PABCSystem") + if (this.si.name != "PABCSystem" || unit is NamespaceScope) used_units.Add(unit); }