OLD | NEW |
(Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 library builtin_operator; |
| 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. |
| 7 |
| 8 /// An operator supported natively in the CPS and Tree IRs using the |
| 9 /// `ApplyBuiltinOperator` instructions. |
| 10 /// |
| 11 /// These operators are pure in the sense that they cannot throw, diverge, |
| 12 /// have observable side-effects, return new objects, nor depend on any |
| 13 /// mutable state. |
| 14 /// |
| 15 /// Most operators place restrictions on the values that may be given as |
| 16 /// argument; their behaviour is unspecified if those requirements are violated. |
| 17 /// |
| 18 /// In all cases, the word "null" refers to the Dart null object, corresponding |
| 19 /// to both JS null and JS undefined. |
| 20 enum BuiltinOperator { |
| 21 /// The numeric binary operators must take two numbers as argument. |
| 22 /// The bitwise operators coerce the result to an unsigned integer, but |
| 23 /// otherwise these all behave like the corresponding JS operator. |
| 24 NumAdd, |
| 25 NumSubtract, |
| 26 NumMultiply, |
| 27 NumAnd, |
| 28 NumOr, |
| 29 NumXor, |
| 30 NumLt, |
| 31 NumLe, |
| 32 NumGt, |
| 33 NumGe, |
| 34 |
| 35 /// Returns true if the two arguments are the same value, and that value is |
| 36 /// not NaN, or if one argument is +0 and the other is -0. |
| 37 /// |
| 38 /// At most one of the arguments may be null. |
| 39 StrictEq, |
| 40 |
| 41 /// Negated version of [StrictEq]. Introduced by [LogicalRewriter] in Tree IR. |
| 42 StrictNeq, |
| 43 |
| 44 /// Returns true if the two arguments are both null or are the same string, |
| 45 /// boolean, or number, and that number is not NaN, or one argument is +0 |
| 46 /// and the other is -0. |
| 47 /// |
| 48 /// One of the following must hold: |
| 49 /// - At least one argument is null. |
| 50 /// - Arguments are both strings, or both booleans, or both numbers. |
| 51 LooseEq, |
| 52 |
| 53 /// Negated version of [LooseEq]. Introduced by [LogicalRewriter] in Tree IR. |
| 54 LooseNeq, |
| 55 |
| 56 /// Returns true if the argument is false, +0. -0, NaN, the empty string, |
| 57 /// or null. |
| 58 IsFalsy |
| 59 } |
OLD | NEW |