From 5980a017e95898dbed19ae77ebbcf711ef2972dc 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 Oct 2019 17:58:30 +0100 Subject: [PATCH] intellisense: support of slice expressions --- CodeCompletion/ExpressionVisitor.cs | 9 +++++++++ CodeCompletion/Testing.cs | 5 +++++ TestSuite/intellisense_tests/sliceexpr1.pas | 7 +++++++ 3 files changed, 21 insertions(+) create mode 100644 TestSuite/intellisense_tests/sliceexpr1.pas diff --git a/CodeCompletion/ExpressionVisitor.cs b/CodeCompletion/ExpressionVisitor.cs index f2d1f470b..135b1767f 100644 --- a/CodeCompletion/ExpressionVisitor.cs +++ b/CodeCompletion/ExpressionVisitor.cs @@ -1952,6 +1952,15 @@ namespace CodeCompletion { } + public override void visit(slice_expr _slice_expr) + { + _slice_expr.v.visit(this); + } + + public override void visit(slice_expr_question _slice_expr_question) + { + _slice_expr_question.v.visit(this); + } public override void visit(tuple_node _tuple_node) { method_call mc = new method_call(); diff --git a/CodeCompletion/Testing.cs b/CodeCompletion/Testing.cs index 69b69128a..8e8adb270 100644 --- a/CodeCompletion/Testing.cs +++ b/CodeCompletion/Testing.cs @@ -399,6 +399,11 @@ namespace CodeCompletion off = test_str.Length; s = parser.LanguageInformation.FindExpression(off, test_str, line, col, out keyw); assert(s.Trim('\n', ' ', '\t') == test_str); + + test_str = "a[2:]"; + off = test_str.Length; + s = parser.LanguageInformation.FindExpression(off, test_str, line, col, out keyw); + assert(s.Trim('\n', ' ', '\t') == test_str); int num_param = 0; //testirovanie nazhatija skobki diff --git a/TestSuite/intellisense_tests/sliceexpr1.pas b/TestSuite/intellisense_tests/sliceexpr1.pas new file mode 100644 index 000000000..60a5cfcf3 --- /dev/null +++ b/TestSuite/intellisense_tests/sliceexpr1.pas @@ -0,0 +1,7 @@ +begin + var a: array of integer; + writeln(a[1:].Length{@property Array.Length: integer; readonly;@}); + writeln(a[:1].Length{@property Array.Length: integer; readonly;@}); + writeln(a[:].Length{@property Array.Length: integer; readonly;@}); + writeln(a[1:2:4].Length{@property Array.Length: integer; readonly;@}); +end. \ No newline at end of file