From f4d1323d623ed962d7c86743e8a729ffb3ca263f 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, 19 Nov 2017 20:04:04 +0100 Subject: [PATCH] bug fix #551 --- CodeCompletion/DomSyntaxTreeVisitor.cs | 12 ++++++------ SyntaxTree/tree/TreeHelper.cs | 2 +- TestSuite/intellisense_tests/const1.pas | 5 ++++- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/CodeCompletion/DomSyntaxTreeVisitor.cs b/CodeCompletion/DomSyntaxTreeVisitor.cs index c925e8440..878a56512 100644 --- a/CodeCompletion/DomSyntaxTreeVisitor.cs +++ b/CodeCompletion/DomSyntaxTreeVisitor.cs @@ -1789,7 +1789,7 @@ namespace CodeCompletion } if (returned_scope != null /*&& cnst_val.prim_val != null*/) { - ElementScope es = new ElementScope(new SymInfo(_simple_const_definition.const_name.name, SymbolKind.Constant, _simple_const_definition.const_name.name), returned_scope, cnst_val.prim_val, cur_scope); + ElementScope es = new ElementScope(new SymInfo(_simple_const_definition.const_name.name, SymbolKind.Constant, _simple_const_definition.const_name.name), returned_scope, cnst_val.prim_val != null? cnst_val.prim_val:_simple_const_definition.const_value.ToString(), cur_scope); es.is_static = true; cur_scope.AddName(_simple_const_definition.const_name.name, es); es.loc = get_location(_simple_const_definition.const_name); @@ -1810,19 +1810,19 @@ namespace CodeCompletion SymScope cnst_type = returned_scope; try { - _typed_const_definition.const_value.visit(this); + _typed_const_definition.const_value.visit(this); } - catch(Exception e) + catch (Exception e) { - + } - ElementScope es = new ElementScope(new SymInfo(_typed_const_definition.const_name.name, SymbolKind.Constant,_typed_const_definition.const_name.name),cnst_type,cnst_val.prim_val,cur_scope); + ElementScope es = new ElementScope(new SymInfo(_typed_const_definition.const_name.name, SymbolKind.Constant, _typed_const_definition.const_name.name), cnst_type, cnst_val.prim_val != null?cnst_val.prim_val: _typed_const_definition.const_value.ToString(), cur_scope); cur_scope.AddName(_typed_const_definition.const_name.name, es); es.loc = get_location(_typed_const_definition); es.is_static = true; es.declaringUnit = entry_scope; if (add_doc_from_text && this.converter.controller.docs != null && this.converter.controller.docs.ContainsKey(_typed_const_definition)) - es.AddDocumentation(this.converter.controller.docs[_typed_const_definition]); + es.AddDocumentation(this.converter.controller.docs[_typed_const_definition]); cnst_val.prim_val = null; } diff --git a/SyntaxTree/tree/TreeHelper.cs b/SyntaxTree/tree/TreeHelper.cs index 7bd293f35..688c51bee 100644 --- a/SyntaxTree/tree/TreeHelper.cs +++ b/SyntaxTree/tree/TreeHelper.cs @@ -389,7 +389,7 @@ namespace PascalABCCompiler.SyntaxTree { public override string ToString() { - return val.ToString(); + return val.ToString(System.Globalization.CultureInfo.InvariantCulture); } } diff --git a/TestSuite/intellisense_tests/const1.pas b/TestSuite/intellisense_tests/const1.pas index 1f645ab51..a30883495 100644 --- a/TestSuite/intellisense_tests/const1.pas +++ b/TestSuite/intellisense_tests/const1.pas @@ -1,6 +1,9 @@ const - h = Round{@function Round(x: real): integer;@}(1.3); + h {@const h: integer = Round(1.3);@}= + Round{@function Round(x: real): integer;@}(1.3); l{@const l: integer = 1;@} = 1; l2 = l{@const l: integer = 1;@}+1; + r{@const r: real = sin(2);@} = sin(2); + begin end. \ No newline at end of file