2a98f98098
Change-Id: Ief30fb79b2afcbb3f50d9127eb622fac362b07b1 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/340141 Commit-Queue: Devon Carew <devoncarew@google.com> Auto-Submit: Parker Lougheed <parlough@gmail.com> Reviewed-by: Devon Carew <devoncarew@google.com> Reviewed-by: Bob Nystrom <rnystrom@google.com>
26 lines
692 B
Dart
26 lines
692 B
Dart
// Copyright (c) 2020, 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.
|
|
|
|
import 'package:analyzer/dart/ast/ast.dart';
|
|
import 'package:scrape/scrape.dart';
|
|
|
|
void main(List<String> arguments) {
|
|
Scrape()
|
|
..addHistogram('If')
|
|
..addVisitor(IfVisitor.new)
|
|
..runCommandLine(arguments);
|
|
}
|
|
|
|
class IfVisitor extends ScrapeVisitor {
|
|
@override
|
|
void visitIfStatement(IfStatement node) {
|
|
if (node.elseStatement != null) {
|
|
record('If', 'else');
|
|
} else {
|
|
record('If', 'no else');
|
|
}
|
|
super.visitIfStatement(node);
|
|
}
|
|
}
|