mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[groovy] don't parse argument list twice
Possible fix for IDEA-249600. GitOrigin-RevId: 6335e0bb525ee46df9d6bd9e8407248b9335134d
This commit is contained in:
committed by
intellij-monorepo-bot
parent
2adf0f4c66
commit
4e4e91e7d0
+1
-23
@@ -7764,7 +7764,7 @@ public class GroovyGeneratedParser implements PsiParser, LightPsiParser {
|
||||
r = true;
|
||||
exit_section_(b, l, m, PROPERTY_EXPRESSION, r, true, null);
|
||||
}
|
||||
else if (g < 17 && method_call_expression_0(b, l + 1)) {
|
||||
else if (g < 17 && callTail(b, l + 1, GroovyGeneratedParser::call_tail_with_nl_before_closure, GroovyGeneratedParser::call_tail)) {
|
||||
r = true;
|
||||
exit_section_(b, l, m, METHOD_CALL_EXPRESSION, r, true, null);
|
||||
}
|
||||
@@ -8429,28 +8429,6 @@ public class GroovyGeneratedParser implements PsiParser, LightPsiParser {
|
||||
return true;
|
||||
}
|
||||
|
||||
// <<isParseNlBeforeClosure>> call_tail_with_nl_before_closure | call_tail
|
||||
private static boolean method_call_expression_0(PsiBuilder b, int l) {
|
||||
if (!recursion_guard_(b, l, "method_call_expression_0")) return false;
|
||||
boolean r;
|
||||
Marker m = enter_section_(b);
|
||||
r = method_call_expression_0_0(b, l + 1);
|
||||
if (!r) r = call_tail(b, l + 1);
|
||||
exit_section_(b, m, null, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
// <<isParseNlBeforeClosure>> call_tail_with_nl_before_closure
|
||||
private static boolean method_call_expression_0_0(PsiBuilder b, int l) {
|
||||
if (!recursion_guard_(b, l, "method_call_expression_0_0")) return false;
|
||||
boolean r;
|
||||
Marker m = enter_section_(b);
|
||||
r = isParseNlBeforeClosure(b, l + 1);
|
||||
r = r && call_tail_with_nl_before_closure(b, l + 1);
|
||||
exit_section_(b, m, null, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
// <<parseBlockLazy closure 'CLOSURE'>>
|
||||
public static boolean lazy_closure(PsiBuilder b, int l) {
|
||||
if (!recursion_guard_(b, l, "lazy_closure")) return false;
|
||||
|
||||
@@ -962,7 +962,7 @@ private optional_expression ::= non_empty_annotation_list? '[' expression? ']' {
|
||||
|
||||
private priority1_2 ::= method_call_expression | lazy_closure | lambda_expression | single_parameter_lambda_expression | list_or_map
|
||||
constructor_call_expression ::= &('this' | 'super') unqualified_reference_expression call_tail
|
||||
method_call_expression ::= expression (<<isParseNlBeforeClosure>> call_tail_with_nl_before_closure | call_tail)
|
||||
method_call_expression ::= expression <<callTail call_tail_with_nl_before_closure call_tail>>
|
||||
private call_tail ::= call_argument_list lazy_closure* | empty_argument_list lazy_closure+
|
||||
private call_tail_with_nl_before_closure ::= call_argument_list (mb_nl lazy_closure)* | empty_argument_list (mb_nl lazy_closure)+
|
||||
|
||||
|
||||
+8
-3
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
@file:JvmName("GroovyParserUtils")
|
||||
@file:Suppress("UNUSED_PARAMETER", "LiftReturnOrAssignment")
|
||||
|
||||
@@ -207,8 +207,13 @@ fun disableNlBeforeClosure(builder: PsiBuilder, level: Int): Boolean {
|
||||
return true
|
||||
}
|
||||
|
||||
fun isParseNlBeforeClosure(builder: PsiBuilder, level: Int): Boolean {
|
||||
return builder.latestDoneMarker?.tokenType == NEW_EXPRESSION || builder[parseNlBeforeClosureArgument]
|
||||
fun callTail(builder: PsiBuilder, level: Int, withNl: Parser, withoutNl: Parser): Boolean {
|
||||
if (builder.latestDoneMarker?.tokenType == NEW_EXPRESSION || builder[parseNlBeforeClosureArgument]) {
|
||||
return withNl.parse(builder, level)
|
||||
}
|
||||
else {
|
||||
return withoutNl.parse(builder, level)
|
||||
}
|
||||
}
|
||||
|
||||
fun parseArgument(builder: PsiBuilder, level: Int, argumentParser: Parser): Boolean {
|
||||
|
||||
Reference in New Issue
Block a user