-
Notifications
You must be signed in to change notification settings - Fork 744
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve call-stmt
recovery for partially written method-call-expr
#34180
Improve call-stmt
recovery for partially written method-call-expr
#34180
Conversation
Codecov Report
@@ Coverage Diff @@
## master #34180 +/- ##
=========================================
Coverage 74.07% 74.08%
- Complexity 45908 45909 +1
=========================================
Files 3165 3165
Lines 179039 179045 +6
Branches 23065 23066 +1
=========================================
+ Hits 132622 132640 +18
+ Misses 38625 38613 -12
Partials 7792 7792
Continue to review full report at Codecov.
|
if (expr.kind == SyntaxKind.FIELD_ACCESS) { | ||
STFieldAccessExpressionNode fieldAccessExpr = (STFieldAccessExpressionNode) expr; | ||
funcOrMethodCall = STNodeFactory.createMethodCallExpressionNode(fieldAccessExpr.expression, | ||
fieldAccessExpr.dotToken, fieldAccessExpr.fieldName, openParenToken, arguments, closeParenToken); | ||
funcOrMethodCall = SyntaxErrors.addDiagnostic(funcOrMethodCall, | ||
DiagnosticErrorCode.ERROR_INVALID_EXPRESSION_EXPECTED_CALL_EXPRESSION); | ||
} else if (expr.kind == SyntaxKind.SIMPLE_NAME_REFERENCE || expr.kind == SyntaxKind.QUALIFIED_NAME_REFERENCE) { | ||
STNode funcName = SyntaxErrors.addDiagnostic(expr, | ||
DiagnosticErrorCode.ERROR_INVALID_EXPRESSION_EXPECTED_CALL_EXPRESSION); | ||
funcOrMethodCall = STNodeFactory.createFunctionCallExpressionNode(funcName, openParenToken, arguments, | ||
closeParenToken); | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There can be other cases that we have to special case like this if we r following this method. Instead of this can we create INVALID_EXPRESSION_STATEMENT
for invalid call statements which are valid check expressions so that it will also provide Create variable assignment
code action?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC, the reason we limited call-stmt
to function-call
and method-call
was to avoid complications at compiler phases. (Introduced with #29282) So the tree has to have either a function-call or method-call node. Looping @chiranSachintha
On the other hand if we consider a()
, a:b()
, b.c()
only simple-name-ref, qualified-name-ref and field-access can be in the partially written state.
For the create variable code action with check-expr
in other expr
scenarios we may have to consider this diagnostics separately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed offline, created this issue #34200
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
call-stmt
recovery for partially written method-call-expr
call-stmt
recovery for partially written method-call-expr
call-stmt
recovery for partially written method-call-expr
call-stmt
recovery for partially written method-call-expr
Purpose
$subject.
Fixes #34104
Approach
N/A
Samples
N/A
Remarks
N/A
Check List