Index: pkg/compiler/lib/src/cps_ir/builtin_operator.dart |
diff --git a/pkg/compiler/lib/src/cps_ir/builtin_operator.dart b/pkg/compiler/lib/src/cps_ir/builtin_operator.dart |
new file mode 100644 |
index 0000000000000000000000000000000000000000..cffca99bad68714bf1b73ff15b7b1ff318ae2129 |
--- /dev/null |
+++ b/pkg/compiler/lib/src/cps_ir/builtin_operator.dart |
@@ -0,0 +1,44 @@ |
+// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
+// for details. All rights reserved. Use of this source code is governed by a |
+// BSD-style license that can be found in the LICENSE file. |
+library builtin_operator; |
+// This is shared by the CPS and Tree IRs. |
+// 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.
|
+ |
+/// An operator supported natively in the CPS and Tree IRs using the |
+/// `ApplyBuiltinOperator` instructions. |
+/// |
+/// These operators are pure in the sense that they cannot throw, diverge, |
+/// have observable side-effects, return new objects, nor depend on any |
+/// mutable state. |
+/// |
+/// Most operators place restrictions on the values that may be given as |
+/// 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
|
+enum BuiltinOperator { |
+ 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.
|
+ 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.
|
+ |
+ /// Returns true if the two arguments are the same value (with some |
+ /// 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.
|
+ /// |
+ /// At most one of the arguments may be null. |
+ StrictEq, |
+ |
+ /// Negated version of [StrictEq]. Introduced by [LogicalRewriter] in Tree IR. |
+ StrictNeq, |
+ |
+ /// Returns true if the two arguments are both null or are the same string, |
+ /// boolean, or number (with some caveats regarding NaN and +/- zero). |
+ /// |
+ /// One of the following must hold: |
+ /// - 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.
|
+ /// - 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
|
+ LooseEq, |
+ |
+ /// Negated version of [LooseEq]. Introduced by [LogicalRewriter] in Tree IR. |
+ 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
|
+ |
+ /// Returns true if the argument is false, +0. -0, NaN, the empty string, |
+ /// 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
|
+ IsFalsy |
+} |