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 library builtin_operator; | 4 library builtin_operator; |
5 // This is shared by the CPS and Tree IRs. | 5 // This is shared by the CPS and Tree IRs. |
6 // Both cps_ir_nodes and tree_ir_nodes import and re-export this file. | 6 // Both cps_ir_nodes and tree_ir_nodes import and re-export this file. |
7 | 7 |
8 /// An operator supported natively in the CPS and Tree IRs using the | 8 /// An operator supported natively in the CPS and Tree IRs using the |
9 /// `ApplyBuiltinOperator` instructions. | 9 /// `ApplyBuiltinOperator` instructions. |
10 /// | 10 /// |
(...skipping 29 matching lines...) Expand all Loading... |
40 /// Concatenates any number of strings. | 40 /// Concatenates any number of strings. |
41 /// | 41 /// |
42 /// Takes any number of arguments, and each argument must be a string. | 42 /// Takes any number of arguments, and each argument must be a string. |
43 /// | 43 /// |
44 /// Returns the empty string if no arguments are given. | 44 /// Returns the empty string if no arguments are given. |
45 StringConcatenate, | 45 StringConcatenate, |
46 | 46 |
47 /// Returns true if the two arguments are the same value, and that value is | 47 /// Returns true if the two arguments are the same value, and that value is |
48 /// not NaN, or if one argument is +0 and the other is -0. | 48 /// not NaN, or if one argument is +0 and the other is -0. |
49 /// | 49 /// |
50 /// At most one of the arguments may be null. | 50 /// Compiled as a static method call. |
| 51 Identical, |
| 52 |
| 53 /// Like [Identical], except at most one argument may be null. |
| 54 /// |
| 55 /// Compiles to `===`. |
51 StrictEq, | 56 StrictEq, |
52 | 57 |
53 /// Negated version of [StrictEq]. Introduced by [LogicalRewriter] in Tree IR. | 58 /// Negated version of [StrictEq]. Introduced by [LogicalRewriter] in Tree IR. |
54 StrictNeq, | 59 StrictNeq, |
55 | 60 |
56 /// Returns true if the two arguments are both null or are the same string, | 61 /// Returns true if the two arguments are both null or are the same string, |
57 /// boolean, or number, and that number is not NaN, or one argument is +0 | 62 /// boolean, or number, and that number is not NaN, or one argument is +0 |
58 /// and the other is -0. | 63 /// and the other is -0. |
59 /// | 64 /// |
60 /// One of the following must hold: | 65 /// One of the following must hold: |
61 /// - At least one argument is null. | 66 /// - At least one argument is null. |
62 /// - Arguments are both strings, or both booleans, or both numbers. | 67 /// - Arguments are both strings, or both booleans, or both numbers. |
| 68 /// |
| 69 /// Compiles to `==`. |
63 LooseEq, | 70 LooseEq, |
64 | 71 |
65 /// Negated version of [LooseEq]. Introduced by [LogicalRewriter] in Tree IR. | 72 /// Negated version of [LooseEq]. Introduced by [LogicalRewriter] in Tree IR. |
66 LooseNeq, | 73 LooseNeq, |
67 | 74 |
68 /// Returns true if the argument is false, +0. -0, NaN, the empty string, | 75 /// Returns true if the argument is false, +0. -0, NaN, the empty string, |
69 /// or null. | 76 /// or null. |
| 77 /// |
| 78 /// Compiles to `!`. |
70 IsFalsy, | 79 IsFalsy, |
71 | 80 |
72 /// Returns true if the argument is a number. | 81 /// Returns true if the argument is a number. |
73 /// | 82 /// |
74 /// Compiles to `typeof x === 'number'` | 83 /// Compiles to `typeof x === 'number'` |
75 IsNumber, | 84 IsNumber, |
76 | 85 |
77 /// Returns true if the argument is not a number. | 86 /// Returns true if the argument is not a number. |
78 /// | 87 /// |
79 /// Compiles to `typeof x !== 'number'`. | 88 /// Compiles to `typeof x !== 'number'`. |
80 IsNotNumber, | 89 IsNotNumber, |
81 | 90 |
82 /// Returns true if the argument is an integer, false if it is a double or | 91 /// Returns true if the argument is an integer, false if it is a double or |
83 /// null, and unspecified if it is anything else. | 92 /// null, and unspecified if it is anything else. |
84 /// | 93 /// |
85 /// The argument must be repeated 2 times. | 94 /// The argument must be repeated 2 times. |
86 /// | 95 /// |
87 /// Compiles to `Math.floor(x) === x` | 96 /// Compiles to `Math.floor(x) === x` |
88 IsFloor, | 97 IsFloor, |
89 | 98 |
90 /// Returns true if the argument is an integer. | 99 /// Returns true if the argument is an integer. |
91 /// | 100 /// |
92 /// The argument must be repeated 3 times. | 101 /// The argument must be repeated 3 times. |
93 /// | 102 /// |
94 /// Compiles to `typeof x === 'number' && Math.floor(x) === x` | 103 /// Compiles to `typeof x === 'number' && Math.floor(x) === x` |
95 IsNumberAndFloor, | 104 IsNumberAndFloor, |
96 } | 105 } |
OLD | NEW |