From 4758f75bc9605e5f3b1455831b0a04d0ede1ad1c Mon Sep 17 00:00:00 2001 From: Alexander Markov Date: Tue, 16 Mar 2021 12:06:38 -0700 Subject: [PATCH] Fix const_finder to visit children of ConstructorInvocation (flutter/engine#25020) --- .../tools/const_finder/lib/const_finder.dart | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/engine/src/flutter/tools/const_finder/lib/const_finder.dart b/engine/src/flutter/tools/const_finder/lib/const_finder.dart index 8898905930..4c4443f9b7 100644 --- a/engine/src/flutter/tools/const_finder/lib/const_finder.dart +++ b/engine/src/flutter/tools/const_finder/lib/const_finder.dart @@ -65,15 +65,14 @@ class _ConstVisitor extends RecursiveVisitor { @override void visitConstructorInvocation(ConstructorInvocation node) { final Class parentClass = node.target.parent as Class; - if (!_matches(parentClass)) { - super.visitConstructorInvocation(node); - return; + if (_matches(parentClass)) { + nonConstantLocations.add({ + 'file': node.location.file.toString(), + 'line': node.location.line, + 'column': node.location.column, + }); } - nonConstantLocations.add({ - 'file': node.location.file.toString(), - 'line': node.location.line, - 'column': node.location.column, - }); + super.visitConstructorInvocation(node); } @override