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

Unified Diff: sdk/lib/_internal/compiler/implementation/typechecker.dart

Issue 14756007: Fix issue 10487 by adapting the type checker so it uses the dynamic type for throw expressions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 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 | « no previous file | tests/language/throw_expr_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/implementation/typechecker.dart
diff --git a/sdk/lib/_internal/compiler/implementation/typechecker.dart b/sdk/lib/_internal/compiler/implementation/typechecker.dart
index 62de10d4b444f959f6094345acd169e48e049a4c..9272289b5ecd6ec8924f815cb2d8d0b46ddbd58c 100644
--- a/sdk/lib/_internal/compiler/implementation/typechecker.dart
+++ b/sdk/lib/_internal/compiler/implementation/typechecker.dart
@@ -240,8 +240,11 @@ class TypeCheckerVisitor implements Visitor<DartType> {
}
DartType visitExpressionStatement(ExpressionStatement node) {
- analyze(node.expression);
- return StatementType.NOT_RETURNING;
+ Expression expression = node.expression;
+ analyze(expression);
+ return (expression.asThrow() != null)
+ ? StatementType.RETURNING
+ : StatementType.NOT_RETURNING;
}
/** Dart Programming Language Specification: 11.5.1 For Loop */
@@ -630,7 +633,7 @@ class TypeCheckerVisitor implements Visitor<DartType> {
DartType visitThrow(Throw node) {
analyze(node.expression);
- return StatementType.RETURNING;
+ return types.dynamicType;
}
DartType computeType(Element element) {
« no previous file with comments | « no previous file | tests/language/throw_expr_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698