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

Side by Side Diff: pkg/compiler/lib/src/js_backend/no_such_method_registry.dart

Issue 1005873009: Fix check for throwing NSM implementations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/compiler/dart2js/no_such_method_enabled_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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 part of js_backend; 5 part of js_backend;
6 6
7 /** 7 /**
8 * Categorizes `noSuchMethod` implementations. 8 * Categorizes `noSuchMethod` implementations.
9 * 9 *
10 * If user code includes `noSuchMethod` implementations, type inference is 10 * If user code includes `noSuchMethod` implementations, type inference is
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 164
165 bool _hasThrowingSyntax(FunctionElement element) { 165 bool _hasThrowingSyntax(FunctionElement element) {
166 Statement body = element.node.body; 166 Statement body = element.node.body;
167 if (body is Return && body.isArrowBody) { 167 if (body is Return && body.isArrowBody) {
168 if (body.expression is Throw) { 168 if (body.expression is Throw) {
169 return true; 169 return true;
170 } 170 }
171 } else if (body is Block && 171 } else if (body is Block &&
172 !body.statements.isEmpty && 172 !body.statements.isEmpty &&
173 body.statements.nodes.tail.isEmpty) { 173 body.statements.nodes.tail.isEmpty) {
174 if (body.statements.nodes.head is Throw) { 174 if (body.statements.nodes.head is ExpressionStatement) {
175 return true; 175 ExpressionStatement stmt = body.statements.nodes.head;
176 return stmt.expression is Throw;
176 } 177 }
177 } 178 }
178 return false; 179 return false;
179 } 180 }
180 } 181 }
181 182
182 enum NsmCategory { DEFAULT, THROWING, OTHER } 183 enum NsmCategory { DEFAULT, THROWING, OTHER }
OLDNEW
« no previous file with comments | « no previous file | tests/compiler/dart2js/no_such_method_enabled_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698