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

Side by Side Diff: lib/ast.dart

Issue 2460373002: Remove BlockExpression from the Kernel language. (Closed)
Patch Set: Incorporate review comments, format continuation.dart. Created 4 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « no previous file | lib/binary/ast_from_binary.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /// ----------------------------------------------------------------------- 5 /// -----------------------------------------------------------------------
6 /// ERROR HANDLING 6 /// ERROR HANDLING
7 /// ----------------------------------------------------------------------- 7 /// -----------------------------------------------------------------------
8 /// 8 ///
9 /// As a rule of thumb, errors that can be detected statically are handled by 9 /// As a rule of thumb, errors that can be detected statically are handled by
10 /// the frontend, typically by translating the erroneous code into a 'throw' or 10 /// the frontend, typically by translating the erroneous code into a 'throw' or
(...skipping 2393 matching lines...) Expand 10 before | Expand all | Expand 10 after
2404 variable = variable.accept(v); 2404 variable = variable.accept(v);
2405 variable?.parent = this; 2405 variable?.parent = this;
2406 } 2406 }
2407 if (body != null) { 2407 if (body != null) {
2408 body = body.accept(v); 2408 body = body.accept(v);
2409 body?.parent = this; 2409 body?.parent = this;
2410 } 2410 }
2411 } 2411 }
2412 } 2412 }
2413 2413
2414 class BlockExpression extends Expression {
2415 Block body;
2416 Expression value;
2417
2418 BlockExpression(this.body, this.value) {
2419 body?.parent = this;
2420 value?.parent = this;
2421 }
2422
2423 DartType getStaticType(TypeEnvironment types) => value.getStaticType(types);
2424
2425 accept(ExpressionVisitor v) => v.visitBlockExpression(this);
2426
2427 visitChildren(Visitor v) {
2428 body?.accept(v);
2429 value?.accept(v);
2430 }
2431
2432 transformChildren(Transformer v) {
2433 if (body != null) {
2434 body = body.accept(v);
2435 body?.parent = this;
2436 }
2437 if (value != null) {
2438 value = value.accept(v);
2439 value?.parent = this;
2440 }
2441 }
2442 }
2443
2444 // ------------------------------------------------------------------------ 2414 // ------------------------------------------------------------------------
2445 // STATEMENTS 2415 // STATEMENTS
2446 // ------------------------------------------------------------------------ 2416 // ------------------------------------------------------------------------
2447 2417
2448 abstract class Statement extends TreeNode { 2418 abstract class Statement extends TreeNode {
2449 accept(StatementVisitor v); 2419 accept(StatementVisitor v);
2450 } 2420 }
2451 2421
2452 /// A statement with a compile-time error. 2422 /// A statement with a compile-time error.
2453 /// 2423 ///
(...skipping 1188 matching lines...) Expand 10 before | Expand all | Expand 10 after
3642 3612
3643 @override 3613 @override
3644 defaultTreeNode(TreeNode node) { 3614 defaultTreeNode(TreeNode node) {
3645 if (node == child) { 3615 if (node == child) {
3646 return replacement; 3616 return replacement;
3647 } else { 3617 } else {
3648 return node; 3618 return node;
3649 } 3619 }
3650 } 3620 }
3651 } 3621 }
OLDNEW
« no previous file with comments | « no previous file | lib/binary/ast_from_binary.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698