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

Side by Side Diff: pkg/compiler/lib/src/inferrer/inferrer_visitor.dart

Issue 2528043003: Handle assert with message in type inference (Closed)
Patch Set: Add more testing. Created 4 years 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 | tests/compiler/dart2js/assert_message_throw_test.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 library inferrer_visitor; 5 library inferrer_visitor;
6 6
7 import 'dart:collection' show IterableMixin; 7 import 'dart:collection' show IterableMixin;
8 8
9 import '../common.dart'; 9 import '../common.dart';
10 import '../compiler.dart' show Compiler; 10 import '../compiler.dart' show Compiler;
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 756
757 @override 757 @override
758 T apply(Node node, _) => visit(node); 758 T apply(Node node, _) => visit(node);
759 759
760 T handleSendSet(SendSet node); 760 T handleSendSet(SendSet node);
761 761
762 T handleDynamicInvoke(Send node); 762 T handleDynamicInvoke(Send node);
763 763
764 T visitAssert(Assert node) { 764 T visitAssert(Assert node) {
765 // Avoid pollution from assert statement unless enabled. 765 // Avoid pollution from assert statement unless enabled.
766 if (compiler.options.enableUserAssertions) { 766 if (!compiler.options.enableUserAssertions) {
767 super.visitAssert(node); 767 return null;
768 } 768 }
769 List<Send> tests = <Send>[];
770 bool simpleCondition = handleCondition(node.condition, tests);
771 LocalsHandler<T> saved = locals;
772 locals = new LocalsHandler<T>.from(locals, node);
773 updateIsChecks(tests, usePositive: true);
774
775 LocalsHandler<T> thenLocals = locals;
776 locals = new LocalsHandler<T>.from(saved, node);
777 if (simpleCondition) updateIsChecks(tests, usePositive: false);
778 visit(node.message);
779 locals.seenReturnOrThrow = true;
780 saved.mergeDiamondFlow(thenLocals, locals);
781 locals = saved;
769 return null; 782 return null;
770 } 783 }
771 784
772 T visitAsyncForIn(AsyncForIn node); 785 T visitAsyncForIn(AsyncForIn node);
773 786
774 T visitSyncForIn(SyncForIn node); 787 T visitSyncForIn(SyncForIn node);
775 788
776 T visitReturn(Return node); 789 T visitReturn(Return node);
777 790
778 T visitFunctionExpression(FunctionExpression node); 791 T visitFunctionExpression(FunctionExpression node);
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after
1477 return type; 1490 return type;
1478 } 1491 }
1479 1492
1480 T visitCascade(Cascade node) { 1493 T visitCascade(Cascade node) {
1481 // Ignore the result of the cascade send and return the type of the cascade 1494 // Ignore the result of the cascade send and return the type of the cascade
1482 // receiver. 1495 // receiver.
1483 visit(node.expression); 1496 visit(node.expression);
1484 return cascadeReceiverStack.removeLast(); 1497 return cascadeReceiverStack.removeLast();
1485 } 1498 }
1486 } 1499 }
OLDNEW
« no previous file with comments | « no previous file | tests/compiler/dart2js/assert_message_throw_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698