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 reexport this file. | |
sra1
2015/06/10 21:07:37
re-export
asgerf
2015/06/11 11:16:40
Done.
| |
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. | |
sra1
2015/06/10 21:07:37
Many of these operators implement Dart operators.
asgerf
2015/06/11 11:16:40
If you are referring to the bitwise operators usin
| |
17 enum BuiltinOperator { | |
18 NumPlus, NumMinus, NumMultiply, NumAnd, NumOr, NumXor, | |
sra1
2015/06/10 21:07:37
"NumPlus" and "NumMultiply" are inconsistent.
One
asgerf
2015/06/11 11:16:40
Done.
| |
19 NumLt, NumLe, NumGt, NumGe, | |
sra1
2015/06/10 21:07:37
Generally format the enum elements all on one line
asgerf
2015/06/11 11:16:40
Done.
| |
20 | |
21 /// Returns true if the two arguments are the same value (with some | |
22 /// caveats regarding NaN and +/-0). | |
sra1
2015/06/10 21:07:37
Either explain the caveats or reference where they
asgerf
2015/06/11 11:16:40
Done.
| |
23 /// | |
24 /// At most one of the arguments may be null. | |
25 StrictEq, | |
26 | |
27 /// Negated version of [StrictEq]. Introduced by [LogicalRewriter] in Tree IR. | |
28 StrictNeq, | |
29 | |
30 /// Returns true if the two arguments are both null or are the same string, | |
31 /// boolean, or number (with some caveats regarding NaN and +/- zero). | |
32 /// | |
33 /// One of the following must hold: | |
34 /// - At least one argument is null. | |
sra1
2015/06/10 21:07:37
is null, or may be null?
asgerf
2015/06/11 11:16:40
Is null.
| |
35 /// - Arguments are both strings, or both booleans, or both numbers. | |
sra1
2015/06/10 21:07:37
If this holds, you would use StrictEq, no?
Perhap
asgerf
2015/06/11 11:16:40
The two bullet points are disjunctive; only one ne
| |
36 LooseEq, | |
37 | |
38 /// Negated version of [LooseEq]. Introduced by [LogicalRewriter] in Tree IR. | |
39 LooseNeq, | |
sra1
2015/06/10 21:07:37
We prefer words.
'eq' is not a word, so I would us
asgerf
2015/06/11 11:16:40
Readability will degrade tremendously if we do thi
| |
40 | |
41 /// Returns true if the argument is false, +0. -0, NaN, the empty string, | |
42 /// or null. | |
sra1
2015/06/10 21:07:37
'Falsy' is a JavaScript concept, so also 'undefine
asgerf
2015/06/11 11:16:40
It don't think it matters where the word "falsy" c
| |
43 IsFalsy | |
44 } | |
OLD | NEW |