OLD | NEW |
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 library dart2js.operators; | 5 library dart2js.operators; |
6 | 6 |
7 import '../elements/elements.dart'; | 7 import '../elements/elements.dart'; |
8 import '../universe/call_structure.dart' show CallStructure; | 8 import '../universe/call_structure.dart' show CallStructure; |
9 import '../universe/selector.dart' show Selector, SelectorKind; | 9 import '../universe/selector.dart' show Selector, SelectorKind; |
10 | 10 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 return NOT; | 46 return NOT; |
47 case '-': | 47 case '-': |
48 return NEGATE; | 48 return NEGATE; |
49 case '~': | 49 case '~': |
50 return COMPLEMENT; | 50 return COMPLEMENT; |
51 default: | 51 default: |
52 return null; | 52 return null; |
53 } | 53 } |
54 } | 54 } |
55 | 55 |
| 56 // ignore: MISSING_RETURN |
56 static UnaryOperator fromKind(UnaryOperatorKind kind) { | 57 static UnaryOperator fromKind(UnaryOperatorKind kind) { |
57 switch (kind) { | 58 switch (kind) { |
58 case UnaryOperatorKind.NOT: | 59 case UnaryOperatorKind.NOT: |
59 return NOT; | 60 return NOT; |
60 case UnaryOperatorKind.NEGATE: | 61 case UnaryOperatorKind.NEGATE: |
61 return NEGATE; | 62 return NEGATE; |
62 case UnaryOperatorKind.COMPLEMENT: | 63 case UnaryOperatorKind.COMPLEMENT: |
63 return COMPLEMENT; | 64 return COMPLEMENT; |
64 } | 65 } |
65 } | 66 } |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 return LOGICAL_AND; | 229 return LOGICAL_AND; |
229 case '||': | 230 case '||': |
230 return LOGICAL_OR; | 231 return LOGICAL_OR; |
231 case '??': | 232 case '??': |
232 return IF_NULL; | 233 return IF_NULL; |
233 default: | 234 default: |
234 return null; | 235 return null; |
235 } | 236 } |
236 } | 237 } |
237 | 238 |
| 239 // ignore: MISSING_RETURN |
238 static BinaryOperator fromKind(BinaryOperatorKind kind) { | 240 static BinaryOperator fromKind(BinaryOperatorKind kind) { |
239 switch (kind) { | 241 switch (kind) { |
240 case BinaryOperatorKind.EQ: | 242 case BinaryOperatorKind.EQ: |
241 return EQ; | 243 return EQ; |
242 case BinaryOperatorKind.NOT_EQ: | 244 case BinaryOperatorKind.NOT_EQ: |
243 return NOT_EQ; | 245 return NOT_EQ; |
244 case BinaryOperatorKind.INDEX: | 246 case BinaryOperatorKind.INDEX: |
245 return INDEX; | 247 return INDEX; |
246 case BinaryOperatorKind.MUL: | 248 case BinaryOperatorKind.MUL: |
247 return MUL; | 249 return MUL; |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 return AND; | 427 return AND; |
426 case '^=': | 428 case '^=': |
427 return XOR; | 429 return XOR; |
428 case '|=': | 430 case '|=': |
429 return OR; | 431 return OR; |
430 default: | 432 default: |
431 return null; | 433 return null; |
432 } | 434 } |
433 } | 435 } |
434 | 436 |
| 437 // ignore: MISSING_RETURN |
435 static AssignmentOperator fromKind(AssignmentOperatorKind kind) { | 438 static AssignmentOperator fromKind(AssignmentOperatorKind kind) { |
436 switch (kind) { | 439 switch (kind) { |
437 case AssignmentOperatorKind.ASSIGN: | 440 case AssignmentOperatorKind.ASSIGN: |
438 return ASSIGN; | 441 return ASSIGN; |
439 case AssignmentOperatorKind.IF_NULL: | 442 case AssignmentOperatorKind.IF_NULL: |
440 return IF_NULL; | 443 return IF_NULL; |
441 case AssignmentOperatorKind.ADD: | 444 case AssignmentOperatorKind.ADD: |
442 return ADD; | 445 return ADD; |
443 case AssignmentOperatorKind.SUB: | 446 case AssignmentOperatorKind.SUB: |
444 return SUB; | 447 return SUB; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 switch (value) { | 492 switch (value) { |
490 case '++': | 493 case '++': |
491 return INC; | 494 return INC; |
492 case '--': | 495 case '--': |
493 return DEC; | 496 return DEC; |
494 default: | 497 default: |
495 return null; | 498 return null; |
496 } | 499 } |
497 } | 500 } |
498 | 501 |
| 502 // ignore: MISSING_RETURN |
499 static IncDecOperator fromKind(IncDecOperatorKind kind) { | 503 static IncDecOperator fromKind(IncDecOperatorKind kind) { |
500 switch (kind) { | 504 switch (kind) { |
501 case IncDecOperatorKind.INC: | 505 case IncDecOperatorKind.INC: |
502 return INC; | 506 return INC; |
503 case IncDecOperatorKind.DEC: | 507 case IncDecOperatorKind.DEC: |
504 return DEC; | 508 return DEC; |
505 } | 509 } |
506 } | 510 } |
507 } | 511 } |
OLD | NEW |