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

Side by Side Diff: pkg/compiler/lib/src/native/js.dart

Issue 1075283002: Add unary arithmetic (+#, -#) to ThrowBehaviorVisitor (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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/js_throw_behavior_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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 native; 5 part of native;
6 6
7 class SideEffectsVisitor extends js.BaseVisitor { 7 class SideEffectsVisitor extends js.BaseVisitor {
8 final SideEffects sideEffects; 8 final SideEffects sideEffects;
9 SideEffectsVisitor(this.sideEffects); 9 SideEffectsVisitor(this.sideEffects);
10 10
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 216
217 NativeThrowBehavior visitThrow(js.Throw node) { 217 NativeThrowBehavior visitThrow(js.Throw node) {
218 return NativeThrowBehavior.MUST; 218 return NativeThrowBehavior.MUST;
219 } 219 }
220 220
221 NativeThrowBehavior visitPrefix(js.Prefix node) { 221 NativeThrowBehavior visitPrefix(js.Prefix node) {
222 if (node.op == 'typeof' && node.argument is js.VariableUse) 222 if (node.op == 'typeof' && node.argument is js.VariableUse)
223 return NativeThrowBehavior.NEVER; 223 return NativeThrowBehavior.NEVER;
224 NativeThrowBehavior result = visit(node.argument); 224 NativeThrowBehavior result = visit(node.argument);
225 switch (node.op) { 225 switch (node.op) {
226 case '+':
227 case '-':
226 case '!': 228 case '!':
227 case '~': 229 case '~':
228 case 'void': 230 case 'void':
229 case 'typeof': 231 case 'typeof':
230 return result; 232 return result;
231 default: 233 default:
232 return NativeThrowBehavior.MAY; 234 return NativeThrowBehavior.MAY;
233 } 235 }
234 } 236 }
235 237
(...skipping 22 matching lines...) Expand all
258 receiver.isPositional && 260 receiver.isPositional &&
259 receiver.nameOrPosition == 0) { 261 receiver.nameOrPosition == 0) {
260 first = NativeThrowBehavior.MAY_THROW_ONLY_ON_FIRST_ARGUMENT_ACCESS; 262 first = NativeThrowBehavior.MAY_THROW_ONLY_ON_FIRST_ARGUMENT_ACCESS;
261 } else { 263 } else {
262 first = NativeThrowBehavior.MAY; 264 first = NativeThrowBehavior.MAY;
263 } 265 }
264 266
265 return sequence(first, second); 267 return sequence(first, second);
266 } 268 }
267 } 269 }
OLDNEW
« no previous file with comments | « no previous file | tests/compiler/dart2js/js_throw_behavior_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698