[vm/aot/tfa] Visit ConstantExpression.type in TFA tree shaker

Fixes https://github.com/dart-lang/sdk/issues/37149

Change-Id: I21fb05a7d3698832f94957853b28c4639180eb8f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106384
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
This commit is contained in:
Alexander Markov 2019-06-17 21:21:31 +00:00 committed by commit-bot@chromium.org
parent c533967a4c
commit 7effb7e776
2 changed files with 27 additions and 2 deletions

View file

@ -739,8 +739,8 @@ class _TreeShakerPass1 extends Transformer {
}
@override
TreeNode visitConstantExpression(ConstantExpression node) {
shaker.constantVisitor.analyzeConstant(node.constant);
Constant visitConstant(Constant node) {
shaker.constantVisitor.analyzeConstant(node);
return node;
}

View file

@ -0,0 +1,25 @@
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// This test verifies that typedef types used in constants are correctly
// visited in the tree shaker.
// Regression test for https://github.com/dart-lang/sdk/issues/37149.
import 'dart:async' show FutureOr;
typedef ComputeCallback<Q, R> = FutureOr<R> Function(Q message);
typedef _ComputeImpl = Future<R> Function<Q, R>(
ComputeCallback<Q, R> callback, Q message,
{String debugLabel});
Future<R> isolatesCompute<Q, R>(ComputeCallback<Q, R> callback, Q message,
{String debugLabel}) async {
return null;
}
const _ComputeImpl compute = isolatesCompute;
main() {
compute.call(null, null);
}