mirror of
https://github.com/dart-lang/sdk
synced 2024-10-03 13:22:01 +00:00
Handle folding for function expression invocations
Change-Id: Id93004c1ea218b1768d649a2a806ce58a9d7f0a5 Reviewed-on: https://dart-review.googlesource.com/59061 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Danny Tuppeny <dantup@google.com>
This commit is contained in:
parent
5616ec9d6d
commit
111b621828
|
@ -157,6 +157,13 @@ class _DartUnitFoldingComputerVisitor extends RecursiveAstVisitor<Object> {
|
|||
return super.visitFunctionDeclaration(node);
|
||||
}
|
||||
|
||||
@override
|
||||
Object visitFunctionExpressionInvocation(FunctionExpressionInvocation node) {
|
||||
_computer._addRegion(node.argumentList.leftParenthesis.end,
|
||||
node.argumentList.rightParenthesis.offset, FoldingKind.INVOCATION);
|
||||
return super.visitFunctionExpressionInvocation(node);
|
||||
}
|
||||
|
||||
@override
|
||||
visitImportDirective(ImportDirective node) {
|
||||
_computer._recordDirective(node);
|
||||
|
|
|
@ -116,6 +116,28 @@ main() {/*1:INC*/
|
|||
/*2:INC:INVOCATION*/);
|
||||
/*1:INC:FUNCTION_BODY*/}
|
||||
|
||||
// Content after
|
||||
""";
|
||||
|
||||
final regions = await _computeRegions(content);
|
||||
_compareRegions(regions, content);
|
||||
}
|
||||
|
||||
test_function_expression_invocation() async {
|
||||
String content = """
|
||||
// Content before
|
||||
|
||||
getFunc() => (String a, String b) {/*1:INC*/
|
||||
print(a);
|
||||
/*1:INC:FUNCTION_BODY*/};
|
||||
|
||||
main2() {/*2:INC*/
|
||||
getFunc()(/*3:INC*/
|
||||
"one",
|
||||
"two"
|
||||
/*3:INC:INVOCATION*/);
|
||||
/*2:INC:FUNCTION_BODY*/}
|
||||
|
||||
// Content after
|
||||
""";
|
||||
|
||||
|
|
Loading…
Reference in a new issue