File tree Expand file tree Collapse file tree 2 files changed +41
-1
lines changed
main/java/com/github/_1c_syntax/bsl/languageserver/context/computer
test/resources/references Expand file tree Collapse file tree 2 files changed +41
-1
lines changed Original file line number Diff line number Diff line change 37
37
import org .antlr .v4 .runtime .tree .ParseTree ;
38
38
import org .antlr .v4 .runtime .tree .TerminalNode ;
39
39
import org .eclipse .lsp4j .Range ;
40
+ import org .eclipse .lsp4j .SymbolKind ;
40
41
41
42
import java .util .ArrayList ;
42
43
import java .util .Collections ;
@@ -129,6 +130,11 @@ public ParseTree visitParam(BSLParser.ParamContext ctx) {
129
130
return ctx ;
130
131
}
131
132
133
+ // При ошибках в разборе может получиться, что два параметра с одним именем в модуле
134
+ if (currentMethod .getSymbolKind () == SymbolKind .Module && moduleVariables .containsKey (ctx .IDENTIFIER ().getText ())) {
135
+ return ctx ;
136
+ }
137
+
132
138
var variable = VariableSymbol .builder ()
133
139
.name (ctx .IDENTIFIER ().getText ().intern ())
134
140
.scope (currentMethod )
@@ -141,7 +147,11 @@ public ParseTree visitParam(BSLParser.ParamContext ctx) {
141
147
.build ();
142
148
variables .add (variable );
143
149
144
- currentMethodVariables .put (ctx .IDENTIFIER ().getText (), ctx .IDENTIFIER ().getText ());
150
+ if (currentMethod .getSymbolKind () == SymbolKind .Module ) {
151
+ moduleVariables .put (ctx .IDENTIFIER ().getText (), ctx .IDENTIFIER ().getText ());
152
+ } else {
153
+ currentMethodVariables .put (ctx .IDENTIFIER ().getText (), ctx .IDENTIFIER ().getText ());
154
+ }
145
155
return ctx ;
146
156
}
147
157
Original file line number Diff line number Diff line change 48
48
49
49
КонецФункции
50
50
51
+ #Если Клиент Тогда
52
+
53
+ Процедура Выполнить (Значение0 )
54
+
55
+ Значение0 = 1 ;
56
+
57
+ Если Истина Тогда
58
+
59
+ Возврат 10 ;
60
+
61
+ КонецЕсли ;
62
+
63
+ КонецПроцедуры
64
+
65
+ #Иначе
66
+
67
+ Функция Выполнить (Значение0 )
68
+
69
+ Значение0 = 1 ;
70
+
71
+ Если Истина Тогда
72
+
73
+ Возврат 10 ;
74
+
75
+ КонецЕсли ;
76
+
77
+ КонецФункции
78
+
79
+ #КонецЕсли
80
+
51
81
Метод(Модуль, Модуль2);
You can’t perform that action at this time.
0 commit comments