Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1659)

Unified Diff: pkg/compiler/lib/src/kernel/fall_through_visitor.dart

Issue 2392863002: Roll kernel to latest (Closed)
Patch Set: Reinsert code Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/compiler/lib/src/js_backend/kernel_task.dart ('k') | pkg/compiler/lib/src/kernel/kernel.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/kernel/fall_through_visitor.dart
diff --git a/pkg/compiler/lib/src/kernel/fall_through_visitor.dart b/pkg/compiler/lib/src/kernel/fall_through_visitor.dart
deleted file mode 100644
index cd747082b08d94c2a578e9fd32a74f3330c36208..0000000000000000000000000000000000000000
--- a/pkg/compiler/lib/src/kernel/fall_through_visitor.dart
+++ /dev/null
@@ -1,99 +0,0 @@
-// Copyright (c) 2016, 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.md file.
-
-import 'package:kernel/ast.dart'
- show
- AssertStatement,
- Block,
- BreakStatement,
- Catch,
- ContinueSwitchStatement,
- DoStatement,
- EmptyStatement,
- ExpressionStatement,
- ForInStatement,
- ForStatement,
- FunctionDeclaration,
- IfStatement,
- InvalidStatement,
- LabeledStatement,
- ReturnStatement,
- Statement,
- StatementVisitor,
- SwitchStatement,
- Throw,
- TryCatch,
- TryFinally,
- VariableDeclaration,
- WhileStatement,
- YieldStatement;
-
-/// Returns true if [node] would let execution reach the next node (aka
-/// fall-through in switch cases).
-bool fallsThrough(Statement node) => node.accept(const FallThroughVisitor());
-
-/// Visitor implementing [computeFallThrough].
-class FallThroughVisitor implements StatementVisitor<bool> {
- const FallThroughVisitor();
-
- bool defaultStatement(Statement node) => throw "Not implemented.";
-
- bool visitInvalidStatement(InvalidStatement node) => false;
-
- bool visitExpressionStatement(ExpressionStatement node) {
- return node.expression is! Throw;
- }
-
- bool visitBlock(Block node) {
- for (Statement statement in node.statements) {
- if (!statement.accept(this)) return false;
- }
- return true;
- }
-
- bool visitEmptyStatement(EmptyStatement node) => true;
-
- bool visitAssertStatement(AssertStatement node) => true;
-
- bool visitLabeledStatement(LabeledStatement node) => true;
-
- bool visitBreakStatement(BreakStatement node) => false;
-
- bool visitWhileStatement(WhileStatement node) => true;
-
- bool visitDoStatement(DoStatement node) => node.body.accept(this);
-
- bool visitForStatement(ForStatement node) => true;
-
- bool visitForInStatement(ForInStatement node) => true;
-
- bool visitSwitchStatement(SwitchStatement node) => true;
-
- bool visitContinueSwitchStatement(ContinueSwitchStatement node) => false;
-
- bool visitIfStatement(IfStatement node) {
- if (node.then == null || node.otherwise == null) return true;
- return node.then.accept(this) || node.otherwise.accept(this);
- }
-
- bool visitReturnStatement(ReturnStatement node) => false;
-
- bool visitTryCatch(TryCatch node) {
- if (node.body.accept(this)) return true;
- for (Catch catchNode in node.catches) {
- if (catchNode.body.accept(this)) return true;
- }
- return false;
- }
-
- bool visitTryFinally(TryFinally node) {
- return node.body.accept(this) && node.finalizer.accept(this);
- }
-
- bool visitYieldStatement(YieldStatement node) => true;
-
- bool visitVariableDeclaration(VariableDeclaration node) => true;
-
- bool visitFunctionDeclaration(FunctionDeclaration node) => true;
-}
« no previous file with comments | « pkg/compiler/lib/src/js_backend/kernel_task.dart ('k') | pkg/compiler/lib/src/kernel/kernel.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698