[rust] Use hermes parser for Forget fixture tests
Replaces the use of SWC parser in the Forget fixture tests with Hermes Parser. This includes aligning on a single type to represent JS Values and numbers (combining semi-duplicated code from forget_hir and forget_estree) and adding support for lowering babel-style NumericLiteral/BooleanLiteral/StringLiteral/NullLiteral node types (since Hermes Parser produces a mix of estree/babel node types)
Joe Savona committed
Aug 10, 2023 at 10:59 UTC
7feaabfe68c94ad8d9817c06b8a792cf3fc47859
150 files changed
+598
-588
compiler/forget/Cargo.lock
+1
-1
@@ -515,7 +515,7 @@ version = "0.1.0"
515
dependencies = [
516
"forget_build_hir",
517
"forget_estree",
518
- "forget_estree_swc",
518
+ "forget_hermes_parser",
519
"forget_hir",
520
"forget_optimization",
521
"forget_semantic_analysis",
compiler/forget/crates/forget_build_hir/src/build.rs
+17
-20
@@ -4,13 +4,13 @@ use forget_diagnostics::Diagnostic;
4
use forget_estree::{
5
AssignmentTarget, BinaryExpression, BlockStatement, Expression, ExpressionOrSpread,
6
ExpressionOrSuper, ForInit, ForStatement, Function, FunctionExpression, IfStatement,
7
- IntoFunction, JsValue, Literal, Pattern, Statement, VariableDeclaration,
7
+ IntoFunction, JsValue, Literal, Number, Pattern, Statement, VariableDeclaration,
8
VariableDeclarationKind,
9
};
10
use forget_hir::{
11
BlockKind, BranchTerminal, Environment, ForTerminal, GotoKind, IdentifierOperand, InstrIx,
12
InstructionKind, InstructionValue, JSXAttribute, JSXElement, LValue, LoadGlobal, LoadLocal,
13
- Operand, PlaceOrSpread, PrimitiveValue, TerminalValue,
13
+ Operand, PlaceOrSpread, TerminalValue,
14
};
15
16
use crate::builder::{Binding, Builder, LoopScope};
@@ -66,7 +66,7 @@ pub fn build(env: &Environment, fun: &Function) -> Result<Box<forget_hir::Functi
66
// block with an explicit `return undefined`. If the function *did* return,
67
// this will be unreachable and get pruned later.
68
let implicit_return_value = builder.push(InstructionValue::Primitive(forget_hir::Primitive {
69
- value: PrimitiveValue::Undefined,
69
+ value: JsValue::Undefined,
70
}));
71
builder.terminate(
72
TerminalValue::Return(forget_hir::ReturnTerminal {
@@ -137,7 +137,7 @@ fn lower_statement(
137
let ix = match &stmt.argument {
138
Some(argument) => lower_expression(env, builder, argument)?,
139
None => builder.push(InstructionValue::Primitive(forget_hir::Primitive {
140
- value: PrimitiveValue::Undefined,
140
+ value: JsValue::Undefined,
141
})),
142
};
143
builder.terminate(
@@ -351,7 +351,19 @@ fn lower_expression(
351
}
352
}
353
Expression::Literal(expr) => InstructionValue::Primitive(forget_hir::Primitive {
354
- value: lower_primitive(env, builder, expr),
354
+ value: expr.value.clone(),
355
+ }),
356
+ Expression::NumericLiteral(expr) => InstructionValue::Primitive(forget_hir::Primitive {
357
+ value: JsValue::Number(expr.value),
358
+ }),
359
+ Expression::BooleanLiteral(expr) => InstructionValue::Primitive(forget_hir::Primitive {
360
+ value: JsValue::Boolean(expr.value),
361
+ }),
362
+ Expression::StringLiteral(expr) => InstructionValue::Primitive(forget_hir::Primitive {
363
+ value: JsValue::String(expr.value.clone()),
364
+ }),
365
+ Expression::NullLiteral(_expr) => InstructionValue::Primitive(forget_hir::Primitive {
366
+ value: JsValue::Null,
367
}),
368
Expression::ArrayExpression(expr) => {
369
let mut elements = Vec::with_capacity(expr.elements.len());
@@ -621,18 +633,3 @@ fn lower_identifier_for_assignment(
633
}
634
}
635
}
624
-
625
-/// Converts an ESTree literal into a HIR primitive
626
-fn lower_primitive(
627
- _env: &Environment,
628
- _builder: &mut Builder,
629
- literal: &Literal,
630
-) -> PrimitiveValue {
631
- match &literal.value {
632
- JsValue::Bool(bool) => PrimitiveValue::Boolean(*bool),
633
- JsValue::Null => PrimitiveValue::Null,
634
- JsValue::Number(value) => PrimitiveValue::Number(f64::from(*value).into()),
635
- JsValue::String(s) => PrimitiveValue::String(s.clone()),
636
- _ => todo!("Lower literal {literal:#?}"),
637
- }
638
-}
compiler/forget/crates/forget_estree/src/js_value.rs
+202
-34
@@ -1,50 +1,82 @@
1
use serde::de::Visitor;
2
use serde::{Deserialize, Serialize};
3
4
-#[derive(Serialize, Clone, Debug, PartialEq, PartialOrd, Hash)]
4
+#[derive(Debug, Clone, PartialEq, Eq)]
5
pub enum JsValue {
6
- Undefined,
6
+ Boolean(bool),
7
Null,
8
- Bool(bool),
8
Number(Number),
9
String(String),
10
+ Undefined,
11
}
12
13
-#[derive(
14
- Clone,
15
- Copy,
16
- PartialEq,
17
- Eq,
18
- PartialOrd,
19
- Ord,
20
- Hash,
21
- Serialize,
22
- Deserialize,
23
- Debug
24
-)]
25
-pub struct Number(u64);
13
+impl JsValue {
14
+ pub fn is_truthy(&self) -> bool {
15
+ match &self {
16
+ JsValue::Boolean(value) => *value,
17
+ JsValue::Number(value) => value.is_truthy(),
18
+ JsValue::String(value) => value.len() != 0,
19
+ JsValue::Null => false,
20
+ JsValue::Undefined => false,
21
+ }
22
+ }
23
27
-impl From<u32> for Number {
28
- fn from(value: u32) -> Self {
29
- Number(value.into())
24
+ // Partial implementation of loose equality for javascript, returns Some for supported
25
+ // cases w the equality result, and None for unsupported cases
26
+ pub fn loosely_equals(&self, other: &Self) -> Option<bool> {
27
+ // https://tc39.es/ecma262/multipage/abstract-operations.html#sec-islooselyequal
28
+ match (&self, &other) {
29
+ // 1. If Type(x) is Type(y), then
30
+ // a. Return IsStrictlyEqual(x, y).
31
+ (JsValue::Number(left), JsValue::Number(right)) => Some(left.equals(*right)),
32
+ (JsValue::Null, JsValue::Null) => Some(true),
33
+ (JsValue::Undefined, JsValue::Undefined) => Some(true),
34
+ (JsValue::Boolean(left), JsValue::Boolean(right)) => Some(left == right),
35
+ (JsValue::String(left), JsValue::String(right)) => Some(left == right),
36
+
37
+ // 2. If x is null and y is undefined, return true.
38
+ (JsValue::Null, JsValue::Undefined) => Some(true),
39
+
40
+ // 3. If x is undefined and y is null, return true.
41
+ (JsValue::Undefined, JsValue::Null) => Some(true),
42
+ _ => None,
43
+ }
44
}
31
-}
45
33
-impl From<u64> for Number {
34
- fn from(value: u64) -> Self {
35
- Number(value)
46
+ pub fn not_loosely_equals(&self, other: &Self) -> Option<bool> {
47
+ self.loosely_equals(other).map(|value| !value)
48
}
37
-}
49
39
-impl From<f64> for Number {
40
- fn from(value: f64) -> Self {
41
- Number(value.to_bits())
50
+ // Complete implementation of strict equality for javascript
51
+ pub fn strictly_equals(&self, other: &Self) -> bool {
52
+ // https://tc39.es/ecma262/multipage/abstract-operations.html#sec-isstrictlyequal
53
+ match (&self, &other) {
54
+ (JsValue::Number(left), JsValue::Number(right)) => left.equals(*right),
55
+ (JsValue::Null, JsValue::Null) => true,
56
+ (JsValue::Undefined, JsValue::Undefined) => true,
57
+ (JsValue::Boolean(left), JsValue::Boolean(right)) => left == right,
58
+ (JsValue::String(left), JsValue::String(right)) => left == right,
59
+ _ => false,
60
+ }
61
+ }
62
+
63
+ pub fn not_strictly_equals(&self, other: &Self) -> bool {
64
+ !self.strictly_equals(other)
65
}
66
}
67
45
-impl From<Number> for f64 {
46
- fn from(value: Number) -> Self {
47
- f64::from_bits(value.0)
68
+impl Serialize for JsValue {
69
+ fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
70
+ where
71
+ S: serde::Serializer,
72
+ {
73
+ match self {
74
+ Self::Boolean(b) => serializer.serialize_bool(*b),
75
+ Self::Null => serializer.serialize_none(),
76
+ Self::Number(n) => serializer.serialize_f64(n.into()),
77
+ Self::String(s) => serializer.serialize_str(s),
78
+ Self::Undefined => serializer.serialize_unit(),
79
+ }
80
}
81
}
82
@@ -65,13 +97,13 @@ impl<'de> Deserialize<'de> for JsValue {
97
98
#[inline]
99
fn visit_bool<E>(self, value: bool) -> Result<JsValue, E> {
68
- Ok(JsValue::Bool(value))
100
+ Ok(JsValue::Boolean(value))
101
}
102
103
#[inline]
104
fn visit_i64<E>(self, value: i64) -> Result<JsValue, E> {
73
- if value < u32::MAX as i64 {
74
- Ok(JsValue::Number((value as u32).into()))
105
+ if value >= MIN_SAFE_INT && value <= MAX_SAFE_INT {
106
+ Ok(JsValue::Number((value as f64).into()))
107
} else {
108
panic!("Invalid number")
109
}
@@ -79,7 +111,11 @@ impl<'de> Deserialize<'de> for JsValue {
111
112
#[inline]
113
fn visit_u64<E>(self, value: u64) -> Result<JsValue, E> {
82
- Ok(JsValue::Number(value.into()))
114
+ if value as i64 <= MAX_SAFE_INT {
115
+ Ok(JsValue::Number((value as f64).into()))
116
+ } else {
117
+ panic!("Invalid number")
118
+ }
119
}
120
121
#[inline]
@@ -122,3 +158,135 @@ impl<'de> Deserialize<'de> for JsValue {
158
deserializer.deserialize_any(ValueVisitor)
159
}
160
}
161
+
162
+/// Represents a JavaScript Number as its binary representation so that
163
+/// -1 == -1, NaN == Nan etc.
164
+/// Note: NaN is *always* represented as the f64::NAN constant to allow
165
+/// comparison of NaNs.
166
+#[derive(Clone, Copy, Eq, PartialEq, PartialOrd, Ord, Debug, Hash)]
167
+pub struct Number(u64);
168
+
169
+pub const MAX_SAFE_INT: i64 = 9007199254740991;
170
+pub const MIN_SAFE_INT: i64 = -9007199254740991;
171
+
172
+impl From<f64> for Number {
173
+ fn from(value: f64) -> Self {
174
+ if value.is_nan() {
175
+ Self(f64::NAN.to_bits())
176
+ } else {
177
+ Self(value.to_bits())
178
+ }
179
+ }
180
+}
181
+
182
+impl From<u32> for Number {
183
+ fn from(value: u32) -> Self {
184
+ f64::from(value).into()
185
+ }
186
+}
187
+
188
+impl From<Number> for f64 {
189
+ fn from(number: Number) -> Self {
190
+ let value = f64::from_bits(number.0);
191
+ assert!(!f64::is_nan(value) || number.0 == f64::NAN.to_bits());
192
+ value
193
+ }
194
+}
195
+
196
+impl From<&Number> for f64 {
197
+ fn from(number: &Number) -> Self {
198
+ let value = f64::from_bits(number.0);
199
+ assert!(!f64::is_nan(value) || number.0 == f64::NAN.to_bits());
200
+ value
201
+ }
202
+}
203
+
204
+impl Number {
205
+ pub fn equals(self, other: Self) -> bool {
206
+ f64::from(self) == f64::from(other)
207
+ }
208
+
209
+ pub fn not_equals(self, other: Self) -> bool {
210
+ !self.equals(other)
211
+ }
212
+
213
+ pub fn is_truthy(self) -> bool {
214
+ let value = f64::from(self);
215
+ if self.0 == f64::NAN.to_bits() || value == 0.0 || value == -0.0 {
216
+ false
217
+ } else {
218
+ true
219
+ }
220
+ }
221
+}
222
+
223
+impl std::ops::Add for Number {
224
+ type Output = Number;
225
+
226
+ fn add(self, rhs: Self) -> Self::Output {
227
+ let result = f64::from(self) + f64::from(rhs);
228
+ Self::from(result)
229
+ }
230
+}
231
+
232
+impl std::ops::Sub for Number {
233
+ type Output = Number;
234
+
235
+ fn sub(self, rhs: Self) -> Self::Output {
236
+ let result = f64::from(self) - f64::from(rhs);
237
+ Self::from(result)
238
+ }
239
+}
240
+
241
+impl std::ops::Mul for Number {
242
+ type Output = Number;
243
+
244
+ fn mul(self, rhs: Self) -> Self::Output {
245
+ let result = f64::from(self) * f64::from(rhs);
246
+ Self::from(result)
247
+ }
248
+}
249
+
250
+impl std::ops::Div for Number {
251
+ type Output = Number;
252
+
253
+ fn div(self, rhs: Self) -> Self::Output {
254
+ let result = f64::from(self) / f64::from(rhs);
255
+ Self::from(result)
256
+ }
257
+}
258
+
259
+impl Serialize for Number {
260
+ fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
261
+ where
262
+ S: serde::Serializer,
263
+ {
264
+ serializer.serialize_f64(self.into())
265
+ }
266
+}
267
+
268
+impl<'de> Deserialize<'de> for Number {
269
+ fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
270
+ where
271
+ D: serde::Deserializer<'de>,
272
+ {
273
+ struct ValueVisitor;
274
+
275
+ impl<'de> Visitor<'de> for ValueVisitor {
276
+ type Value = Number;
277
+
278
+ fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
279
+ formatter.write_str("value JavaScript number value")
280
+ }
281
+
282
+ fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
283
+ where
284
+ E: serde::de::Error,
285
+ {
286
+ Ok(v.into())
287
+ }
288
+ }
289
+
290
+ deserializer.deserialize_any(ValueVisitor)
291
+ }
292
+}
compiler/forget/crates/forget_estree/src/snapshots/forget_estree__tests__fixtures@for-statement.json.snap
+3
-9
@@ -612,9 +612,7 @@ Output:
612
},
613
"init": {
614
"type": "Literal",
615
- "value": {
616
- "Number": 0
617
- },
615
+ "value": 0.0,
616
"raw": "0",
617
"regex": null,
618
"bigint": null,
@@ -697,9 +695,7 @@ Output:
695
},
696
"init": {
697
"type": "Literal",
700
- "value": {
701
- "Number": 0
702
- },
698
+ "value": 0.0,
699
"raw": "0",
700
"regex": null,
701
"bigint": null,
@@ -777,9 +773,7 @@ Output:
773
"operator": "<",
774
"right": {
775
"type": "Literal",
780
- "value": {
781
- "Number": 10
782
- },
776
+ "value": 10.0,
777
"raw": "10",
778
"regex": null,
779
"bigint": null,
compiler/forget/crates/forget_estree/src/snapshots/forget_estree__tests__fixtures@import.json.snap
+1
-3
@@ -157,9 +157,7 @@ Output:
157
],
158
"source": {
159
"type": "Literal",
160
- "value": {
161
- "String": "react"
162
- },
160
+ "value": "react",
161
"raw": "'react'",
162
"regex": null,
163
"bigint": null,
compiler/forget/crates/forget_estree/src/snapshots/forget_estree__tests__fixtures@test.json.snap
+1
-3
@@ -474,9 +474,7 @@ Output:
474
"type": "JSXExpressionContainer",
475
"expression": {
476
"type": "Literal",
477
- "value": {
478
- "Number": 10
479
- },
477
+ "value": 10.0,
478
"raw": "10",
479
"regex": null,
480
"bigint": null,
compiler/forget/crates/forget_estree_swc/src/lib.rs
+1
-1
@@ -676,7 +676,7 @@ fn convert_jsx_attribute(cx: &Context, attr: &JSXAttr) -> forget_estree::JSXAttr
676
fn convert_literal(_cx: &Context, expr: &Lit) -> forget_estree::Literal {
677
let (value, range, regex, bigint) = match expr {
678
Lit::Bool(expr) => (
679
- forget_estree::JsValue::Bool(expr.value),
679
+ forget_estree::JsValue::Boolean(expr.value),
680
convert_span(&expr.span),
681
None,
682
None,
compiler/forget/crates/forget_fixtures/Cargo.toml
+1
-1
@@ -15,7 +15,7 @@ repository.workspace = true
15
[dev-dependencies]
16
insta = { workspace = true }
17
forget_estree = { workspace = true }
18
-forget_estree_swc = { workspace = true }
18
+forget_hermes_parser = { workspace = true }
19
forget_hir = { workspace = true }
20
forget_optimization = { workspace = true }
21
forget_semantic_analysis = { workspace = true }
compiler/forget/crates/forget_fixtures/tests/fixtures_test.rs
+1
-1
@@ -3,7 +3,7 @@ use std::fmt::Write;
3
4
use forget_build_hir::build;
5
use forget_estree::{ModuleItem, Statement};
6
-use forget_estree_swc::parse;
6
+use forget_hermes_parser::parse;
7
use forget_hir::{inline_use_memo, Environment, Features, Print, Registry};
8
use forget_optimization::constant_propagation;
9
use forget_semantic_analysis::analyze;
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@allocating-primitive-as-dep-nested-scope.js.snap
+1
-1
@@ -208,7 +208,7 @@ Output:
208
"operator": "+",
209
"right": {
210
"type": "NumericLiteral",
211
- "value": 4607182418800017408,
211
+ "value": 1.0,
212
"loc": null,
213
"range": {
214
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@allocating-primitive-as-dep.js.snap
+1
-1
@@ -128,7 +128,7 @@ Output:
128
"operator": "+",
129
"right": {
130
"type": "NumericLiteral",
131
- "value": 4607182418800017408,
131
+ "value": 1.0,
132
"loc": null,
133
"range": {
134
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@array-access-assignment.js.snap
+5
-5
@@ -267,7 +267,7 @@ Output:
267
},
268
"property": {
269
"type": "NumericLiteral",
270
- "value": 0,
270
+ "value": 0.0,
271
"loc": null,
272
"range": {
273
"start": 0,
@@ -295,7 +295,7 @@ Output:
295
},
296
"property": {
297
"type": "NumericLiteral",
298
- "value": 4607182418800017408,
298
+ "value": 1.0,
299
"loc": null,
300
"range": {
301
"start": 0,
@@ -343,7 +343,7 @@ Output:
343
},
344
"property": {
345
"type": "NumericLiteral",
346
- "value": 0,
346
+ "value": 0.0,
347
"loc": null,
348
"range": {
349
"start": 0,
@@ -359,7 +359,7 @@ Output:
359
},
360
"property": {
361
"type": "NumericLiteral",
362
- "value": 0,
362
+ "value": 0.0,
363
"loc": null,
364
"range": {
365
"start": 0,
@@ -387,7 +387,7 @@ Output:
387
},
388
"property": {
389
"type": "NumericLiteral",
390
- "value": 0,
390
+ "value": 0.0,
391
"loc": null,
392
"range": {
393
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@array-at-mutate-after-capture.js.snap
+1
-1
@@ -68,7 +68,7 @@ Output:
68
"elements": [
69
{
70
"type": "NumericLiteral",
71
- "value": 4631107791820423168,
71
+ "value": 42.0,
72
"loc": null,
73
"range": {
74
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@array-expression-spread.js.snap
+1
-1
@@ -62,7 +62,7 @@ Output:
62
"elements": [
63
{
64
"type": "NumericLiteral",
65
- "value": 0,
65
+ "value": 0.0,
66
"loc": null,
67
"range": {
68
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@array-property-call.js.snap
+1
-1
@@ -200,7 +200,7 @@ Output:
200
"arguments": [
201
{
202
"type": "NumericLiteral",
203
- "value": 4631107791820423168,
203
+ "value": 42.0,
204
"loc": null,
205
"range": {
206
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@assignment-expression-computed.js.snap
+3
-3
@@ -130,7 +130,7 @@ Output:
130
},
131
"init": {
132
"type": "NumericLiteral",
133
- "value": 0,
133
+ "value": 0.0,
134
"loc": null,
135
"range": {
136
"start": 0,
@@ -186,7 +186,7 @@ Output:
186
},
187
"right": {
188
"type": "NumericLiteral",
189
- "value": 4611686018427387904,
189
+ "value": 2.0,
190
"loc": null,
191
"range": {
192
"start": 0,
@@ -241,7 +241,7 @@ Output:
241
},
242
"right": {
243
"type": "NumericLiteral",
244
- "value": 4613937818241073152,
244
+ "value": 3.0,
245
"loc": null,
246
"range": {
247
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@assignment-expression-nested-path.js.snap
+2
-2
@@ -271,7 +271,7 @@ Output:
271
"operator": "+",
272
"right": {
273
"type": "NumericLiteral",
274
- "value": 4607182418800017408,
274
+ "value": 1.0,
275
"loc": null,
276
"range": {
277
"start": 0,
@@ -352,7 +352,7 @@ Output:
352
},
353
"right": {
354
"type": "NumericLiteral",
355
- "value": 4611686018427387904,
355
+ "value": 2.0,
356
"loc": null,
357
"range": {
358
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@assignment-variations-complex-lvalue-array.js.snap
+4
-4
@@ -56,7 +56,7 @@ Output:
56
"elements": [
57
{
58
"type": "NumericLiteral",
59
- "value": 4607182418800017408,
59
+ "value": 1.0,
60
"loc": null,
61
"range": {
62
"start": 0,
@@ -140,7 +140,7 @@ Output:
140
"arguments": [
141
{
142
"type": "NumericLiteral",
143
- "value": 0,
143
+ "value": 0.0,
144
"loc": null,
145
"range": {
146
"start": 0,
@@ -203,7 +203,7 @@ Output:
203
"arguments": [
204
{
205
"type": "NumericLiteral",
206
- "value": 0,
206
+ "value": 0.0,
207
"loc": null,
208
"range": {
209
"start": 0,
@@ -212,7 +212,7 @@ Output:
212
},
213
{
214
"type": "NumericLiteral",
215
- "value": 4611686018427387904,
215
+ "value": 2.0,
216
"loc": null,
217
"range": {
218
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@assignment-variations-complex-lvalue.js.snap
+3
-3
@@ -80,7 +80,7 @@ Output:
80
},
81
"value": {
82
"type": "NumericLiteral",
83
- "value": 4607182418800017408,
83
+ "value": 1.0,
84
"loc": null,
85
"range": {
86
"start": 0,
@@ -240,7 +240,7 @@ Output:
240
"operator": "+",
241
"right": {
242
"type": "NumericLiteral",
243
- "value": 4607182418800017408,
243
+ "value": 1.0,
244
"loc": null,
245
"range": {
246
"start": 0,
@@ -321,7 +321,7 @@ Output:
321
},
322
"right": {
323
"type": "NumericLiteral",
324
- "value": 4611686018427387904,
324
+ "value": 2.0,
325
"loc": null,
326
"range": {
327
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@assignment-variations.js.snap
+4
-4
@@ -51,7 +51,7 @@ Output:
51
},
52
"init": {
53
"type": "NumericLiteral",
54
- "value": 4607182418800017408,
54
+ "value": 1.0,
55
"loc": null,
56
"range": {
57
"start": 0,
@@ -101,7 +101,7 @@ Output:
101
"operator": "+",
102
"right": {
103
"type": "NumericLiteral",
104
- "value": 4607182418800017408,
104
+ "value": 1.0,
105
"loc": null,
106
"range": {
107
"start": 0,
@@ -144,7 +144,7 @@ Output:
144
},
145
"right": {
146
"type": "NumericLiteral",
147
- "value": 4607182418800017408,
147
+ "value": 1.0,
148
"loc": null,
149
"range": {
150
"start": 0,
@@ -181,7 +181,7 @@ Output:
181
},
182
"right": {
183
"type": "NumericLiteral",
184
- "value": 4607182418800017408,
184
+ "value": 1.0,
185
"loc": null,
186
"range": {
187
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@babel-existing-react-import.js.snap
+2
-2
@@ -168,7 +168,7 @@ Output:
168
"arguments": [
169
{
170
"type": "NumericLiteral",
171
- "value": 0,
171
+ "value": 0.0,
172
"loc": null,
173
"range": {
174
"start": 0,
@@ -472,7 +472,7 @@ Output:
472
"arguments": [
473
{
474
"type": "NumericLiteral",
475
- "value": 0,
475
+ "value": 0.0,
476
"loc": null,
477
"range": {
478
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@babel-existing-react-kitchensink-import.js.snap
+2
-2
@@ -206,7 +206,7 @@ Output:
206
"arguments": [
207
{
208
"type": "NumericLiteral",
209
- "value": 0,
209
+ "value": 0.0,
210
"loc": null,
211
"range": {
212
"start": 0,
@@ -510,7 +510,7 @@ Output:
510
"arguments": [
511
{
512
"type": "NumericLiteral",
513
- "value": 0,
513
+ "value": 0.0,
514
"loc": null,
515
"range": {
516
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@capture-indirect-mutate-alias.js.snap
+1
-1
@@ -216,7 +216,7 @@ Output:
216
},
217
"right": {
218
"type": "NumericLiteral",
219
- "value": 4607182418800017408,
219
+ "value": 1.0,
220
"loc": null,
221
"range": {
222
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@capture-param-mutate.js.snap
+7
-7
@@ -152,7 +152,7 @@ Output:
152
"operator": "===",
153
"right": {
154
"type": "NumericLiteral",
155
- "value": 4607182418800017408,
155
+ "value": 1.0,
156
"loc": null,
157
"range": {
158
"start": 0,
@@ -185,7 +185,7 @@ Output:
185
},
186
"property": {
187
"type": "NumericLiteral",
188
- "value": 0,
188
+ "value": 0.0,
189
"loc": null,
190
"range": {
191
"start": 0,
@@ -259,7 +259,7 @@ Output:
259
},
260
"property": {
261
"type": "NumericLiteral",
262
- "value": 0,
262
+ "value": 0.0,
263
"loc": null,
264
"range": {
265
"start": 0,
@@ -455,7 +455,7 @@ Output:
455
},
456
"value": {
457
"type": "NumericLiteral",
458
- "value": 4621819117588971520,
458
+ "value": 10.0,
459
"loc": null,
460
"range": {
461
"start": 0,
@@ -609,7 +609,7 @@ Output:
609
},
610
"property": {
611
"type": "NumericLiteral",
612
- "value": 0,
612
+ "value": 0.0,
613
"loc": null,
614
"range": {
615
"start": 0,
@@ -757,7 +757,7 @@ Output:
757
"arguments": [
758
{
759
"type": "NumericLiteral",
760
- "value": 0,
760
+ "value": 0.0,
761
"loc": null,
762
"range": {
763
"start": 0,
@@ -766,7 +766,7 @@ Output:
766
},
767
{
768
"type": "NumericLiteral",
769
- "value": 4621256167635550208,
769
+ "value": 9.0,
770
"loc": null,
771
"range": {
772
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@capture_mutate-across-fns.js.snap
+1
-1
@@ -175,7 +175,7 @@ Output:
175
},
176
"right": {
177
"type": "NumericLiteral",
178
- "value": 4607182418800017408,
178
+ "value": 1.0,
179
"loc": null,
180
"range": {
181
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@capturing-func-mutate-2.js.snap
+1
-1
@@ -258,7 +258,7 @@ Output:
258
},
259
"right": {
260
"type": "NumericLiteral",
261
- "value": 4611686018427387904,
261
+ "value": 2.0,
262
"loc": null,
263
"range": {
264
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@capturing-func-mutate-3.js.snap
+1
-1
@@ -257,7 +257,7 @@ Output:
257
},
258
"right": {
259
"type": "NumericLiteral",
260
- "value": 4611686018427387904,
260
+ "value": 2.0,
261
"loc": null,
262
"range": {
263
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@capturing-func-mutate-nested.js.snap
+1
-1
@@ -226,7 +226,7 @@ Output:
226
},
227
"right": {
228
"type": "NumericLiteral",
229
- "value": 4611686018427387904,
229
+ "value": 2.0,
230
"loc": null,
231
"range": {
232
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@capturing-func-mutate.js.snap
+1
-1
@@ -258,7 +258,7 @@ Output:
258
},
259
"right": {
260
"type": "NumericLiteral",
261
- "value": 4611686018427387904,
261
+ "value": 2.0,
262
"loc": null,
263
"range": {
264
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@capturing-function-alias-computed-load-2.js.snap
+2
-2
@@ -175,7 +175,7 @@ Output:
175
},
176
"property": {
177
"type": "NumericLiteral",
178
- "value": 0,
178
+ "value": 0.0,
179
"loc": null,
180
"range": {
181
"start": 0,
@@ -191,7 +191,7 @@ Output:
191
},
192
"property": {
193
"type": "NumericLiteral",
194
- "value": 4607182418800017408,
194
+ "value": 1.0,
195
"loc": null,
196
"range": {
197
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@capturing-function-alias-computed-load-3.js.snap
+4
-4
@@ -235,7 +235,7 @@ Output:
235
},
236
"property": {
237
"type": "NumericLiteral",
238
- "value": 0,
238
+ "value": 0.0,
239
"loc": null,
240
"range": {
241
"start": 0,
@@ -251,7 +251,7 @@ Output:
251
},
252
"property": {
253
"type": "NumericLiteral",
254
- "value": 4607182418800017408,
254
+ "value": 1.0,
255
"loc": null,
256
"range": {
257
"start": 0,
@@ -309,7 +309,7 @@ Output:
309
},
310
"property": {
311
"type": "NumericLiteral",
312
- "value": 4607182418800017408,
312
+ "value": 1.0,
313
"loc": null,
314
"range": {
315
"start": 0,
@@ -325,7 +325,7 @@ Output:
325
},
326
"property": {
327
"type": "NumericLiteral",
328
- "value": 0,
328
+ "value": 0.0,
329
"loc": null,
330
"range": {
331
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@capturing-function-alias-computed-load-4.js.snap
+2
-2
@@ -177,7 +177,7 @@ Output:
177
},
178
"property": {
179
"type": "NumericLiteral",
180
- "value": 0,
180
+ "value": 0.0,
181
"loc": null,
182
"range": {
183
"start": 0,
@@ -210,7 +210,7 @@ Output:
210
},
211
"property": {
212
"type": "NumericLiteral",
213
- "value": 4607182418800017408,
213
+ "value": 1.0,
214
"loc": null,
215
"range": {
216
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@capturing-function-alias-computed-load.js.snap
+1
-1
@@ -173,7 +173,7 @@ Output:
173
},
174
"property": {
175
"type": "NumericLiteral",
176
- "value": 0,
176
+ "value": 0.0,
177
"loc": null,
178
"range": {
179
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@capturing-reference-changes-type.js.snap
+1
-1
@@ -135,7 +135,7 @@ Output:
135
},
136
"init": {
137
"type": "NumericLiteral",
138
- "value": 4607182418800017408,
138
+ "value": 1.0,
139
"loc": null,
140
"range": {
141
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@chained-assignment-expressions.js.snap
+5
-5
@@ -67,7 +67,7 @@ Output:
67
},
68
"value": {
69
"type": "NumericLiteral",
70
- "value": 0,
70
+ "value": 0.0,
71
"loc": null,
72
"range": {
73
"start": 0,
@@ -137,7 +137,7 @@ Output:
137
},
138
"value": {
139
"type": "NumericLiteral",
140
- "value": 0,
140
+ "value": 0.0,
141
"loc": null,
142
"range": {
143
"start": 0,
@@ -207,7 +207,7 @@ Output:
207
},
208
"value": {
209
"type": "NumericLiteral",
210
- "value": 0,
210
+ "value": 0.0,
211
"loc": null,
212
"range": {
213
"start": 0,
@@ -312,7 +312,7 @@ Output:
312
},
313
"right": {
314
"type": "NumericLiteral",
315
- "value": 4607182418800017408,
315
+ "value": 1.0,
316
"loc": null,
317
"range": {
318
"start": 0,
@@ -438,7 +438,7 @@ Output:
438
},
439
"right": {
440
"type": "NumericLiteral",
441
- "value": 4613937818241073152,
441
+ "value": 3.0,
442
"loc": null,
443
"range": {
444
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@component.js.snap
+3
-3
@@ -315,7 +315,7 @@ Output:
315
"arguments": [
316
{
317
"type": "NumericLiteral",
318
- "value": 0,
318
+ "value": 0.0,
319
"loc": null,
320
"range": {
321
"start": 0,
@@ -372,7 +372,7 @@ Output:
372
},
373
"init": {
374
"type": "NumericLiteral",
375
- "value": 0,
375
+ "value": 0.0,
376
"loc": null,
377
"range": {
378
"start": 0,
@@ -455,7 +455,7 @@ Output:
455
},
456
"right": {
457
"type": "NumericLiteral",
458
- "value": 4607182418800017408,
458
+ "value": 1.0,
459
"loc": null,
460
"range": {
461
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@computed-call-evaluation-order.js.snap
+1
-1
@@ -580,7 +580,7 @@ Output:
580
},
581
{
582
"type": "NumericLiteral",
583
- "value": 4607182418800017408,
583
+ "value": 1.0,
584
"loc": null,
585
"range": {
586
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@computed-load-primitive-as-dependency.js.snap
+1
-1
@@ -249,7 +249,7 @@ Output:
249
"operator": "+",
250
"right": {
251
"type": "NumericLiteral",
252
- "value": 4607182418800017408,
252
+ "value": 1.0,
253
"loc": null,
254
"range": {
255
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@concise-arrow-expr.js.snap
+1
-1
@@ -82,7 +82,7 @@ Output:
82
"arguments": [
83
{
84
"type": "NumericLiteral",
85
- "value": 0,
85
+ "value": 0.0,
86
"loc": null,
87
"range": {
88
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@conditional-set-state-in-render.js.snap
+3
-3
@@ -102,7 +102,7 @@ Output:
102
"arguments": [
103
{
104
"type": "NumericLiteral",
105
- "value": 0,
105
+ "value": 0.0,
106
"loc": null,
107
"range": {
108
"start": 0,
@@ -169,7 +169,7 @@ Output:
169
"arguments": [
170
{
171
"type": "NumericLiteral",
172
- "value": 4607182418800017408,
172
+ "value": 1.0,
173
"loc": null,
174
"range": {
175
"start": 0,
@@ -275,7 +275,7 @@ Output:
275
"arguments": [
276
{
277
"type": "NumericLiteral",
278
- "value": 4611686018427387904,
278
+ "value": 2.0,
279
"loc": null,
280
"range": {
281
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@const-propagation-into-function-expression-primitive.js.snap
+1
-1
@@ -52,7 +52,7 @@ Output:
52
},
53
"init": {
54
"type": "NumericLiteral",
55
- "value": 4631107791820423168,
55
+ "value": 42.0,
56
"loc": null,
57
"range": {
58
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@constant-propagation-for.js.snap
+4
-4
@@ -51,7 +51,7 @@ Output:
51
},
52
"init": {
53
"type": "NumericLiteral",
54
- "value": 0,
54
+ "value": 0.0,
55
"loc": null,
56
"range": {
57
"start": 0,
@@ -91,7 +91,7 @@ Output:
91
},
92
"init": {
93
"type": "NumericLiteral",
94
- "value": 4636737291354636288,
94
+ "value": 100.0,
95
"loc": null,
96
"range": {
97
"start": 0,
@@ -126,7 +126,7 @@ Output:
126
"operator": "<",
127
"right": {
128
"type": "NumericLiteral",
129
- "value": 4621819117588971520,
129
+ "value": 10.0,
130
"loc": null,
131
"range": {
132
"start": 0,
@@ -182,7 +182,7 @@ Output:
182
"operator": "+",
183
"right": {
184
"type": "NumericLiteral",
185
- "value": 4607182418800017408,
185
+ "value": 1.0,
186
"loc": null,
187
"range": {
188
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@constant-propagation-into-function-expressions.js.snap
+1
-1
@@ -62,7 +62,7 @@ Output:
62
},
63
"init": {
64
"type": "NumericLiteral",
65
- "value": 4631107791820423168,
65
+ "value": 42.0,
66
"loc": null,
67
"range": {
68
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@constant-propagation-phi.js.snap
+5
-5
@@ -134,7 +134,7 @@ Output:
134
"type": "BinaryExpression",
135
"left": {
136
"type": "NumericLiteral",
137
- "value": 4611686018427387904,
137
+ "value": 2.0,
138
"loc": null,
139
"range": {
140
"start": 0,
@@ -144,7 +144,7 @@ Output:
144
"operator": "-",
145
"right": {
146
"type": "NumericLiteral",
147
- "value": 4607182418800017408,
147
+ "value": 1.0,
148
"loc": null,
149
"range": {
150
"start": 0,
@@ -199,7 +199,7 @@ Output:
199
"type": "BinaryExpression",
200
"left": {
201
"type": "NumericLiteral",
202
- "value": 0,
202
+ "value": 0.0,
203
"loc": null,
204
"range": {
205
"start": 0,
@@ -209,7 +209,7 @@ Output:
209
"operator": "+",
210
"right": {
211
"type": "NumericLiteral",
212
- "value": 4607182418800017408,
212
+ "value": 1.0,
213
"loc": null,
214
"range": {
215
"start": 0,
@@ -265,7 +265,7 @@ Output:
265
"operator": "===",
266
"right": {
267
"type": "NumericLiteral",
268
- "value": 4607182418800017408,
268
+ "value": 1.0,
269
"loc": null,
270
"range": {
271
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@constant-propagation-while.js.snap
+4
-4
@@ -52,7 +52,7 @@ Output:
52
},
53
"init": {
54
"type": "NumericLiteral",
55
- "value": 4636737291354636288,
55
+ "value": 100.0,
56
"loc": null,
57
"range": {
58
"start": 0,
@@ -90,7 +90,7 @@ Output:
90
},
91
"init": {
92
"type": "NumericLiteral",
93
- "value": 0,
93
+ "value": 0.0,
94
"loc": null,
95
"range": {
96
"start": 0,
@@ -127,7 +127,7 @@ Output:
127
"operator": "<",
128
"right": {
129
"type": "NumericLiteral",
130
- "value": 4621819117588971520,
130
+ "value": 10.0,
131
"loc": null,
132
"range": {
133
"start": 0,
@@ -160,7 +160,7 @@ Output:
160
},
161
"right": {
162
"type": "NumericLiteral",
163
- "value": 4607182418800017408,
163
+ "value": 1.0,
164
"loc": null,
165
"range": {
166
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@constant-propagation.js.snap
+3
-3
@@ -62,7 +62,7 @@ Output:
62
},
63
"init": {
64
"type": "NumericLiteral",
65
- "value": 4607182418800017408,
65
+ "value": 1.0,
66
"loc": null,
67
"range": {
68
"start": 0,
@@ -100,7 +100,7 @@ Output:
100
},
101
"init": {
102
"type": "NumericLiteral",
103
- "value": 4611686018427387904,
103
+ "value": 2.0,
104
"loc": null,
105
"range": {
106
"start": 0,
@@ -138,7 +138,7 @@ Output:
138
},
139
"init": {
140
"type": "NumericLiteral",
141
- "value": 4613937818241073152,
141
+ "value": 3.0,
142
"loc": null,
143
"range": {
144
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@controlled-input.js.snap
+1
-1
@@ -82,7 +82,7 @@ Output:
82
"arguments": [
83
{
84
"type": "NumericLiteral",
85
- "value": 0,
85
+ "value": 0.0,
86
"loc": null,
87
"range": {
88
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@dce-loop.js.snap
+2
-2
@@ -64,7 +64,7 @@ Output:
64
},
65
"init": {
66
"type": "NumericLiteral",
67
- "value": 0,
67
+ "value": 0.0,
68
"loc": null,
69
"range": {
70
"start": 0,
@@ -102,7 +102,7 @@ Output:
102
},
103
"init": {
104
"type": "NumericLiteral",
105
- "value": 0,
105
+ "value": 0.0,
106
"loc": null,
107
"range": {
108
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@declare-reassign-variable-in-function-declaration.js.snap
+1
-1
@@ -104,7 +104,7 @@ Output:
104
},
105
"right": {
106
"type": "NumericLiteral",
107
- "value": 4621256167635550208,
107
+ "value": 9.0,
108
"loc": null,
109
"range": {
110
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@destructuring-array-param-default.js.snap
+1
-1
@@ -43,7 +43,7 @@ Output:
43
},
44
"right": {
45
"type": "NumericLiteral",
46
- "value": 4611686018427387904,
46
+ "value": 2.0,
47
"loc": null,
48
"range": {
49
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@destructuring-object-param-default.js.snap
+1
-1
@@ -55,7 +55,7 @@ Output:
55
},
56
"right": {
57
"type": "NumericLiteral",
58
- "value": 4611686018427387904,
58
+ "value": 2.0,
59
"loc": null,
60
"range": {
61
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@do-while-compound-test.js.snap
+4
-4
@@ -67,7 +67,7 @@ Output:
67
"elements": [
68
{
69
"type": "NumericLiteral",
70
- "value": 4607182418800017408,
70
+ "value": 1.0,
71
"loc": null,
72
"range": {
73
"start": 0,
@@ -76,7 +76,7 @@ Output:
76
},
77
{
78
"type": "NumericLiteral",
79
- "value": 4611686018427387904,
79
+ "value": 2.0,
80
"loc": null,
81
"range": {
82
"start": 0,
@@ -85,7 +85,7 @@ Output:
85
},
86
{
87
"type": "NumericLiteral",
88
- "value": 4613937818241073152,
88
+ "value": 3.0,
89
"loc": null,
90
"range": {
91
"start": 0,
@@ -271,7 +271,7 @@ Output:
271
"operator": "*",
272
"right": {
273
"type": "NumericLiteral",
274
- "value": 4611686018427387904,
274
+ "value": 2.0,
275
"loc": null,
276
"range": {
277
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@do-while-conditional-break.js.snap
+5
-5
@@ -68,7 +68,7 @@ Output:
68
"elements": [
69
{
70
"type": "NumericLiteral",
71
- "value": 0,
71
+ "value": 0.0,
72
"loc": null,
73
"range": {
74
"start": 0,
@@ -77,7 +77,7 @@ Output:
77
},
78
{
79
"type": "NumericLiteral",
80
- "value": 4607182418800017408,
80
+ "value": 1.0,
81
"loc": null,
82
"range": {
83
"start": 0,
@@ -86,7 +86,7 @@ Output:
86
},
87
{
88
"type": "NumericLiteral",
89
- "value": 4611686018427387904,
89
+ "value": 2.0,
90
"loc": null,
91
"range": {
92
"start": 0,
@@ -95,7 +95,7 @@ Output:
95
},
96
{
97
"type": "NumericLiteral",
98
- "value": 4613937818241073152,
98
+ "value": 3.0,
99
"loc": null,
100
"range": {
101
"start": 0,
@@ -144,7 +144,7 @@ Output:
144
"operator": "===",
145
"right": {
146
"type": "NumericLiteral",
147
- "value": 0,
147
+ "value": 0.0,
148
"loc": null,
149
"range": {
150
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@do-while-continue.js.snap
+6
-6
@@ -60,7 +60,7 @@ Output:
60
"elements": [
61
{
62
"type": "NumericLiteral",
63
- "value": 0,
63
+ "value": 0.0,
64
"loc": null,
65
"range": {
66
"start": 0,
@@ -69,7 +69,7 @@ Output:
69
},
70
{
71
"type": "NumericLiteral",
72
- "value": 4607182418800017408,
72
+ "value": 1.0,
73
"loc": null,
74
"range": {
75
"start": 0,
@@ -78,7 +78,7 @@ Output:
78
},
79
{
80
"type": "NumericLiteral",
81
- "value": 4611686018427387904,
81
+ "value": 2.0,
82
"loc": null,
83
"range": {
84
"start": 0,
@@ -87,7 +87,7 @@ Output:
87
},
88
{
89
"type": "NumericLiteral",
90
- "value": 4613937818241073152,
90
+ "value": 3.0,
91
"loc": null,
92
"range": {
93
"start": 0,
@@ -241,7 +241,7 @@ Output:
241
"operator": "===",
242
"right": {
243
"type": "NumericLiteral",
244
- "value": 0,
244
+ "value": 0.0,
245
"loc": null,
246
"range": {
247
"start": 0,
@@ -329,7 +329,7 @@ Output:
329
"operator": "/",
330
"right": {
331
"type": "NumericLiteral",
332
- "value": 4611686018427387904,
332
+ "value": 2.0,
333
"loc": null,
334
"range": {
335
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@do-while-early-unconditional-break.js.snap
+3
-3
@@ -66,7 +66,7 @@ Output:
66
"elements": [
67
{
68
"type": "NumericLiteral",
69
- "value": 4607182418800017408,
69
+ "value": 1.0,
70
"loc": null,
71
"range": {
72
"start": 0,
@@ -75,7 +75,7 @@ Output:
75
},
76
{
77
"type": "NumericLiteral",
78
- "value": 4611686018427387904,
78
+ "value": 2.0,
79
"loc": null,
80
"range": {
81
"start": 0,
@@ -84,7 +84,7 @@ Output:
84
},
85
{
86
"type": "NumericLiteral",
87
- "value": 4613937818241073152,
87
+ "value": 3.0,
88
"loc": null,
89
"range": {
90
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@do-while-simple.js.snap
+4
-4
@@ -56,7 +56,7 @@ Output:
56
"elements": [
57
{
58
"type": "NumericLiteral",
59
- "value": 4607182418800017408,
59
+ "value": 1.0,
60
"loc": null,
61
"range": {
62
"start": 0,
@@ -65,7 +65,7 @@ Output:
65
},
66
{
67
"type": "NumericLiteral",
68
- "value": 4611686018427387904,
68
+ "value": 2.0,
69
"loc": null,
70
"range": {
71
"start": 0,
@@ -74,7 +74,7 @@ Output:
74
},
75
{
76
"type": "NumericLiteral",
77
- "value": 4613937818241073152,
77
+ "value": 3.0,
78
"loc": null,
79
"range": {
80
"start": 0,
@@ -260,7 +260,7 @@ Output:
260
"operator": "*",
261
"right": {
262
"type": "NumericLiteral",
263
- "value": 4611686018427387904,
263
+ "value": 2.0,
264
"loc": null,
265
"range": {
266
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@dominator.js.snap
+7
-7
@@ -88,7 +88,7 @@ Output:
88
},
89
"init": {
90
"type": "NumericLiteral",
91
- "value": 0,
91
+ "value": 0.0,
92
"loc": null,
93
"range": {
94
"start": 0,
@@ -171,7 +171,7 @@ Output:
171
},
172
"right": {
173
"type": "NumericLiteral",
174
- "value": 4607182418800017408,
174
+ "value": 1.0,
175
"loc": null,
176
"range": {
177
"start": 0,
@@ -252,7 +252,7 @@ Output:
252
},
253
"right": {
254
"type": "NumericLiteral",
255
- "value": 4611686018427387904,
255
+ "value": 2.0,
256
"loc": null,
257
"range": {
258
"start": 0,
@@ -330,7 +330,7 @@ Output:
330
},
331
"right": {
332
"type": "NumericLiteral",
333
- "value": 4613937818241073152,
333
+ "value": 3.0,
334
"loc": null,
335
"range": {
336
"start": 0,
@@ -445,7 +445,7 @@ Output:
445
},
446
"right": {
447
"type": "NumericLiteral",
448
- "value": 4616189618054758400,
448
+ "value": 4.0,
449
"loc": null,
450
"range": {
451
"start": 0,
@@ -567,7 +567,7 @@ Output:
567
},
568
"right": {
569
"type": "NumericLiteral",
570
- "value": 4617315517961601024,
570
+ "value": 5.0,
571
"loc": null,
572
"range": {
573
"start": 0,
@@ -625,7 +625,7 @@ Output:
625
},
626
"right": {
627
"type": "NumericLiteral",
628
- "value": 4618441417868443648,
628
+ "value": 6.0,
629
"loc": null,
630
"range": {
631
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@early-return.js.snap
+1
-1
@@ -145,7 +145,7 @@ Output:
145
},
146
"right": {
147
"type": "NumericLiteral",
148
- "value": 4607182418800017408,
148
+ "value": 1.0,
149
"loc": null,
150
"range": {
151
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@error.babel-existing-react-namespace-import.js.snap
+2
-2
@@ -149,7 +149,7 @@ Output:
149
"arguments": [
150
{
151
"type": "NumericLiteral",
152
- "value": 0,
152
+ "value": 0.0,
153
"loc": null,
154
"range": {
155
"start": 0,
@@ -491,7 +491,7 @@ Output:
491
"arguments": [
492
{
493
"type": "NumericLiteral",
494
- "value": 0,
494
+ "value": 0.0,
495
"loc": null,
496
"range": {
497
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@error.bug-validate-no-set-state-not-all-mutable-range-extensions-are-bad.js.snap
+4
-4
@@ -190,7 +190,7 @@ Output:
190
"arguments": [
191
{
192
"type": "NumericLiteral",
193
- "value": 0,
193
+ "value": 0.0,
194
"loc": null,
195
"range": {
196
"start": 0,
@@ -307,7 +307,7 @@ Output:
307
"arguments": [
308
{
309
"type": "NumericLiteral",
310
- "value": 4607182418800017408,
310
+ "value": 1.0,
311
"loc": null,
312
"range": {
313
"start": 0,
@@ -379,7 +379,7 @@ Output:
379
"type": "SwitchCase",
380
"test": {
381
"type": "NumericLiteral",
382
- "value": 0,
382
+ "value": 0.0,
383
"loc": null,
384
"range": {
385
"start": 0,
@@ -502,7 +502,7 @@ Output:
502
"type": "SwitchCase",
503
"test": {
504
"type": "NumericLiteral",
505
- "value": 4607182418800017408,
505
+ "value": 1.0,
506
"loc": null,
507
"range": {
508
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@error.hooks-with-React-namespace.js.snap
+1
-1
@@ -100,7 +100,7 @@ Output:
100
"arguments": [
101
{
102
"type": "NumericLiteral",
103
- "value": 4607182418800017408,
103
+ "value": 1.0,
104
"loc": null,
105
"range": {
106
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@error.invalid-assign-hook-to-local.js.snap
+1
-1
@@ -154,7 +154,7 @@ Output:
154
},
155
"property": {
156
"type": "NumericLiteral",
157
- "value": 0,
157
+ "value": 0.0,
158
"loc": null,
159
"range": {
160
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@error.invalid-capture-func-passed-to-jsx.js.snap
+1
-1
@@ -259,7 +259,7 @@ Output:
259
},
260
"right": {
261
"type": "NumericLiteral",
262
- "value": 4611686018427387904,
262
+ "value": 2.0,
263
"loc": null,
264
"range": {
265
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@error.invalid-computed-store-to-frozen-value.js.snap
+1
-1
@@ -184,7 +184,7 @@ Output:
184
},
185
"property": {
186
"type": "NumericLiteral",
187
- "value": 0,
187
+ "value": 0.0,
188
"loc": null,
189
"range": {
190
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@error.invalid-unconditional-set-state-in-render.js.snap
+3
-3
@@ -97,7 +97,7 @@ Output:
97
"arguments": [
98
{
99
"type": "NumericLiteral",
100
- "value": 0,
100
+ "value": 0.0,
101
"loc": null,
102
"range": {
103
"start": 0,
@@ -180,7 +180,7 @@ Output:
180
"arguments": [
181
{
182
"type": "NumericLiteral",
183
- "value": 4607182418800017408,
183
+ "value": 1.0,
184
"loc": null,
185
"range": {
186
"start": 0,
@@ -218,7 +218,7 @@ Output:
218
"arguments": [
219
{
220
"type": "NumericLiteral",
221
- "value": 4611686018427387904,
221
+ "value": 2.0,
222
"loc": null,
223
"range": {
224
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@error.mutate-global-increment-op-invalid-react.js.snap
+1
-1
@@ -34,7 +34,7 @@ Output:
34
},
35
"init": {
36
"type": "NumericLiteral",
37
- "value": 0,
37
+ "value": 0.0,
38
"loc": null,
39
"range": {
40
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@error.todo-kitchensink.js.snap
+16
-16
@@ -313,7 +313,7 @@ Output:
313
},
314
"init": {
315
"type": "NumericLiteral",
316
- "value": 0,
316
+ "value": 0.0,
317
"loc": null,
318
"range": {
319
"start": 0,
@@ -401,7 +401,7 @@ Output:
401
},
402
"value": {
403
"type": "NumericLiteral",
404
- "value": 4631107791820423168,
404
+ "value": 42.0,
405
"loc": null,
406
"range": {
407
"start": 0,
@@ -855,7 +855,7 @@ Output:
855
"type": "JSXExpressionContainer",
856
"expression": {
857
"type": "NumericLiteral",
858
- "value": 4607182418800017408,
858
+ "value": 1.0,
859
"loc": null,
860
"range": {
861
"start": 0,
@@ -1115,7 +1115,7 @@ Output:
1115
"operator": "<",
1116
"right": {
1117
"type": "NumericLiteral",
1118
- "value": 4613937818241073152,
1118
+ "value": 3.0,
1119
"loc": null,
1120
"range": {
1121
"start": 0,
@@ -1143,7 +1143,7 @@ Output:
1143
},
1144
"right": {
1145
"type": "NumericLiteral",
1146
- "value": 4607182418800017408,
1146
+ "value": 1.0,
1147
"loc": null,
1148
"range": {
1149
"start": 0,
@@ -1248,7 +1248,7 @@ Output:
1248
"operator": "<",
1249
"right": {
1250
"type": "NumericLiteral",
1251
- "value": 4613937818241073152,
1251
+ "value": 3.0,
1252
"loc": null,
1253
"range": {
1254
"start": 0,
@@ -1461,7 +1461,7 @@ Output:
1461
"elements": [
1462
{
1463
"type": "NumericLiteral",
1464
- "value": 4607182418800017408,
1464
+ "value": 1.0,
1465
"loc": null,
1466
"range": {
1467
"start": 0,
@@ -1470,7 +1470,7 @@ Output:
1470
},
1471
{
1472
"type": "NumericLiteral",
1473
- "value": 4611686018427387904,
1473
+ "value": 2.0,
1474
"loc": null,
1475
"range": {
1476
"start": 0,
@@ -1530,7 +1530,7 @@ Output:
1530
"elements": [
1531
{
1532
"type": "NumericLiteral",
1533
- "value": 4607182418800017408,
1533
+ "value": 1.0,
1534
"loc": null,
1535
"range": {
1536
"start": 0,
@@ -1549,7 +1549,7 @@ Output:
1549
"elements": [
1550
{
1551
"type": "NumericLiteral",
1552
- "value": 4611686018427387904,
1552
+ "value": 2.0,
1553
"loc": null,
1554
"range": {
1555
"start": 0,
@@ -1650,7 +1650,7 @@ Output:
1650
},
1651
"value": {
1652
"type": "NumericLiteral",
1653
- "value": 4607182418800017408,
1653
+ "value": 1.0,
1654
"loc": null,
1655
"range": {
1656
"start": 0,
@@ -1691,7 +1691,7 @@ Output:
1691
},
1692
"value": {
1693
"type": "NumericLiteral",
1694
- "value": 4611686018427387904,
1694
+ "value": 2.0,
1695
"loc": null,
1696
"range": {
1697
"start": 0,
@@ -1786,7 +1786,7 @@ Output:
1786
},
1787
"value": {
1788
"type": "NumericLiteral",
1789
- "value": 4607182418800017408,
1789
+ "value": 1.0,
1790
"loc": null,
1791
"range": {
1792
"start": 0,
@@ -1843,7 +1843,7 @@ Output:
1843
},
1844
"init": {
1845
"type": "NumericLiteral",
1846
- "value": 0,
1846
+ "value": 0.0,
1847
"loc": null,
1848
"range": {
1849
"start": 0,
@@ -2036,7 +2036,7 @@ Output:
2036
"type": "BinaryExpression",
2037
"left": {
2038
"type": "NumericLiteral",
2039
- "value": 4607182418800017408,
2039
+ "value": 1.0,
2040
"loc": null,
2041
"range": {
2042
"start": 0,
@@ -2046,7 +2046,7 @@ Output:
2046
"operator": "+",
2047
"right": {
2048
"type": "NumericLiteral",
2049
- "value": 4607182418800017408,
2049
+ "value": 1.0,
2050
"loc": null,
2051
"range": {
2052
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@error.todo-unconditional-set-state-lambda.js.snap
+4
-4
@@ -67,7 +67,7 @@ Output:
67
},
68
"init": {
69
"type": "NumericLiteral",
70
- "value": 0,
70
+ "value": 0.0,
71
"loc": null,
72
"range": {
73
"start": 0,
@@ -138,7 +138,7 @@ Output:
138
"arguments": [
139
{
140
"type": "NumericLiteral",
141
- "value": 0,
141
+ "value": 0.0,
142
"loc": null,
143
"range": {
144
"start": 0,
@@ -205,7 +205,7 @@ Output:
205
"arguments": [
206
{
207
"type": "NumericLiteral",
208
- "value": 4607182418800017408,
208
+ "value": 1.0,
209
"loc": null,
210
"range": {
211
"start": 0,
@@ -243,7 +243,7 @@ Output:
243
},
244
"right": {
245
"type": "NumericLiteral",
246
- "value": 4607182418800017408,
246
+ "value": 1.0,
247
"loc": null,
248
"range": {
249
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@error.while-with-assignment-in-test.js.snap
+5
-5
@@ -68,7 +68,7 @@ Output:
68
"elements": [
69
{
70
"type": "NumericLiteral",
71
- "value": 4607182418800017408,
71
+ "value": 1.0,
72
"loc": null,
73
"range": {
74
"start": 0,
@@ -77,7 +77,7 @@ Output:
77
},
78
{
79
"type": "NumericLiteral",
80
- "value": 4611686018427387904,
80
+ "value": 2.0,
81
"loc": null,
82
"range": {
83
"start": 0,
@@ -86,7 +86,7 @@ Output:
86
},
87
{
88
"type": "NumericLiteral",
89
- "value": 4613937818241073152,
89
+ "value": 3.0,
90
"loc": null,
91
"range": {
92
"start": 0,
@@ -131,7 +131,7 @@ Output:
131
},
132
"init": {
133
"type": "NumericLiteral",
134
- "value": 0,
134
+ "value": 0.0,
135
"loc": null,
136
"range": {
137
"start": 0,
@@ -169,7 +169,7 @@ Output:
169
},
170
"init": {
171
"type": "NumericLiteral",
172
- "value": 0,
172
+ "value": 0.0,
173
"loc": null,
174
"range": {
175
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@expression-with-assignment-dynamic.js.snap
+1
-1
@@ -112,7 +112,7 @@ Output:
112
},
113
"right": {
114
"type": "NumericLiteral",
115
- "value": 4611686018427387904,
115
+ "value": 2.0,
116
"loc": null,
117
"range": {
118
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@expression-with-assignment.js.snap
+2
-2
@@ -48,7 +48,7 @@ Output:
48
},
49
"init": {
50
"type": "NumericLiteral",
51
- "value": 4607182418800017408,
51
+ "value": 1.0,
52
"loc": null,
53
"range": {
54
"start": 0,
@@ -100,7 +100,7 @@ Output:
100
},
101
"right": {
102
"type": "NumericLiteral",
103
- "value": 4611686018427387904,
103
+ "value": 2.0,
104
"loc": null,
105
"range": {
106
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@extend-scopes-if.js.snap
+1
-1
@@ -190,7 +190,7 @@ Output:
190
"arguments": [
191
{
192
"type": "NumericLiteral",
193
- "value": 0,
193
+ "value": 0.0,
194
"loc": null,
195
"range": {
196
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@fbt-template-string-same-scope.js.snap
+1
-1
@@ -111,7 +111,7 @@ Output:
111
},
112
"init": {
113
"type": "NumericLiteral",
114
- "value": 0,
114
+ "value": 0.0,
115
"loc": null,
116
"range": {
117
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@for-empty-update-with-continue.js.snap
+3
-3
@@ -64,7 +64,7 @@ Output:
64
},
65
"init": {
66
"type": "NumericLiteral",
67
- "value": 0,
67
+ "value": 0.0,
68
"loc": null,
69
"range": {
70
"start": 0,
@@ -104,7 +104,7 @@ Output:
104
},
105
"init": {
106
"type": "NumericLiteral",
107
- "value": 0,
107
+ "value": 0.0,
108
"loc": null,
109
"range": {
110
"start": 0,
@@ -231,7 +231,7 @@ Output:
231
},
232
"right": {
233
"type": "NumericLiteral",
234
- "value": 4607182418800017408,
234
+ "value": 1.0,
235
"loc": null,
236
"range": {
237
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@for-empty-update.js.snap
+3
-3
@@ -65,7 +65,7 @@ Output:
65
},
66
"init": {
67
"type": "NumericLiteral",
68
- "value": 0,
68
+ "value": 0.0,
69
"loc": null,
70
"range": {
71
"start": 0,
@@ -105,7 +105,7 @@ Output:
105
},
106
"init": {
107
"type": "NumericLiteral",
108
- "value": 0,
108
+ "value": 0.0,
109
"loc": null,
110
"range": {
111
"start": 0,
@@ -232,7 +232,7 @@ Output:
232
"operator": ">",
233
"right": {
234
"type": "NumericLiteral",
235
- "value": 4621819117588971520,
235
+ "value": 10.0,
236
"loc": null,
237
"range": {
238
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@for-logical.js.snap
+4
-4
@@ -67,7 +67,7 @@ Output:
67
},
68
"init": {
69
"type": "NumericLiteral",
70
- "value": 0,
70
+ "value": 0.0,
71
"loc": null,
72
"range": {
73
"start": 0,
@@ -107,7 +107,7 @@ Output:
107
},
108
"init": {
109
"type": "NumericLiteral",
110
- "value": 0,
110
+ "value": 0.0,
111
"loc": null,
112
"range": {
113
"start": 0,
@@ -278,7 +278,7 @@ Output:
278
},
279
"alternate": {
280
"type": "NumericLiteral",
281
- "value": 4611686018427387904,
281
+ "value": 2.0,
282
"loc": null,
283
"range": {
284
"start": 0,
@@ -346,7 +346,7 @@ Output:
346
},
347
"right": {
348
"type": "NumericLiteral",
349
- "value": 4611686018427387904,
349
+ "value": 2.0,
350
"loc": null,
351
"range": {
352
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@for-of-break.js.snap
+2
-2
@@ -109,7 +109,7 @@ Output:
109
"elements": [
110
{
111
"type": "NumericLiteral",
112
- "value": 4607182418800017408,
112
+ "value": 1.0,
113
"loc": null,
114
"range": {
115
"start": 0,
@@ -118,7 +118,7 @@ Output:
118
},
119
{
120
"type": "NumericLiteral",
121
- "value": 4611686018427387904,
121
+ "value": 2.0,
122
"loc": null,
123
"range": {
124
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@for-of-conditional-break.js.snap
+3
-3
@@ -112,7 +112,7 @@ Output:
112
"elements": [
113
{
114
"type": "NumericLiteral",
115
- "value": 4607182418800017408,
115
+ "value": 1.0,
116
"loc": null,
117
"range": {
118
"start": 0,
@@ -121,7 +121,7 @@ Output:
121
},
122
{
123
"type": "NumericLiteral",
124
- "value": 4611686018427387904,
124
+ "value": 2.0,
125
"loc": null,
126
"range": {
127
"start": 0,
@@ -155,7 +155,7 @@ Output:
155
"operator": "===",
156
"right": {
157
"type": "NumericLiteral",
158
- "value": 4607182418800017408,
158
+ "value": 1.0,
159
"loc": null,
160
"range": {
161
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@for-of-continue.js.snap
+6
-6
@@ -58,7 +58,7 @@ Output:
58
"elements": [
59
{
60
"type": "NumericLiteral",
61
- "value": 0,
61
+ "value": 0.0,
62
"loc": null,
63
"range": {
64
"start": 0,
@@ -67,7 +67,7 @@ Output:
67
},
68
{
69
"type": "NumericLiteral",
70
- "value": 4607182418800017408,
70
+ "value": 1.0,
71
"loc": null,
72
"range": {
73
"start": 0,
@@ -76,7 +76,7 @@ Output:
76
},
77
{
78
"type": "NumericLiteral",
79
- "value": 4611686018427387904,
79
+ "value": 2.0,
80
"loc": null,
81
"range": {
82
"start": 0,
@@ -85,7 +85,7 @@ Output:
85
},
86
{
87
"type": "NumericLiteral",
88
- "value": 4613937818241073152,
88
+ "value": 3.0,
89
"loc": null,
90
"range": {
91
"start": 0,
@@ -213,7 +213,7 @@ Output:
213
"operator": "===",
214
"right": {
215
"type": "NumericLiteral",
216
- "value": 0,
216
+ "value": 0.0,
217
"loc": null,
218
"range": {
219
"start": 0,
@@ -301,7 +301,7 @@ Output:
301
"operator": "/",
302
"right": {
303
"type": "NumericLiteral",
304
- "value": 4611686018427387904,
304
+ "value": 2.0,
305
"loc": null,
306
"range": {
307
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@for-of-destructure.js.snap
+4
-4
@@ -108,7 +108,7 @@ Output:
108
},
109
"value": {
110
"type": "NumericLiteral",
111
- "value": 0,
111
+ "value": 0.0,
112
"loc": null,
113
"range": {
114
"start": 0,
@@ -149,7 +149,7 @@ Output:
149
},
150
"value": {
151
"type": "NumericLiteral",
152
- "value": 4607182418800017408,
152
+ "value": 1.0,
153
"loc": null,
154
"range": {
155
"start": 0,
@@ -190,7 +190,7 @@ Output:
190
},
191
"value": {
192
"type": "NumericLiteral",
193
- "value": 4611686018427387904,
193
+ "value": 2.0,
194
"loc": null,
195
"range": {
196
"start": 0,
@@ -361,7 +361,7 @@ Output:
361
"operator": "*",
362
"right": {
363
"type": "NumericLiteral",
364
- "value": 4611686018427387904,
364
+ "value": 2.0,
365
"loc": null,
366
"range": {
367
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@for-of-simple.js.snap
+4
-4
@@ -93,7 +93,7 @@ Output:
93
"elements": [
94
{
95
"type": "NumericLiteral",
96
- "value": 0,
96
+ "value": 0.0,
97
"loc": null,
98
"range": {
99
"start": 0,
@@ -102,7 +102,7 @@ Output:
102
},
103
{
104
"type": "NumericLiteral",
105
- "value": 4607182418800017408,
105
+ "value": 1.0,
106
"loc": null,
107
"range": {
108
"start": 0,
@@ -111,7 +111,7 @@ Output:
111
},
112
{
113
"type": "NumericLiteral",
114
- "value": 4611686018427387904,
114
+ "value": 2.0,
115
"loc": null,
116
"range": {
117
"start": 0,
@@ -233,7 +233,7 @@ Output:
233
"operator": "*",
234
"right": {
235
"type": "NumericLiteral",
236
- "value": 4611686018427387904,
236
+ "value": 2.0,
237
"loc": null,
238
"range": {
239
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@for-return.js.snap
+1
-1
@@ -62,7 +62,7 @@ Output:
62
},
63
"init": {
64
"type": "NumericLiteral",
65
- "value": 0,
65
+ "value": 0.0,
66
"loc": null,
67
"range": {
68
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@holey-array.js.snap
+1
-1
@@ -118,7 +118,7 @@ Output:
118
"arguments": [
119
{
120
"type": "NumericLiteral",
121
- "value": 4607182418800017408,
121
+ "value": 1.0,
122
"loc": null,
123
"range": {
124
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@infer-phi-primitive.js.snap
+2
-2
@@ -120,7 +120,7 @@ Output:
120
},
121
"right": {
122
"type": "NumericLiteral",
123
- "value": 4607182418800017408,
123
+ "value": 1.0,
124
"loc": null,
125
"range": {
126
"start": 0,
@@ -167,7 +167,7 @@ Output:
167
},
168
"right": {
169
"type": "NumericLiteral",
170
- "value": 4611686018427387904,
170
+ "value": 2.0,
171
"loc": null,
172
"range": {
173
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@infer-types-through-type-cast.flow.js.snap
+1
-1
@@ -165,7 +165,7 @@ Output:
165
"operator": "+",
166
"right": {
167
"type": "NumericLiteral",
168
- "value": 4607182418800017408,
168
+ "value": 1.0,
169
"loc": null,
170
"range": {
171
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@lambda-reassign-primitive.js.snap
+2
-2
@@ -58,7 +58,7 @@ Output:
58
},
59
"init": {
60
"type": "NumericLiteral",
61
- "value": 4630826316843712512,
61
+ "value": 40.0,
62
"loc": null,
63
"range": {
64
"start": 0,
@@ -131,7 +131,7 @@ Output:
131
"operator": "+",
132
"right": {
133
"type": "NumericLiteral",
134
- "value": 4607182418800017408,
134
+ "value": 1.0,
135
"loc": null,
136
"range": {
137
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@lambda-reassign-shadowed-primitive.js.snap
+2
-2
@@ -96,7 +96,7 @@ Output:
96
},
97
"init": {
98
"type": "NumericLiteral",
99
- "value": 4633078116657397760,
99
+ "value": 56.0,
100
"loc": null,
101
"range": {
102
"start": 0,
@@ -156,7 +156,7 @@ Output:
156
},
157
"right": {
158
"type": "NumericLiteral",
159
- "value": 4631107791820423168,
159
+ "value": 42.0,
160
"loc": null,
161
"range": {
162
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@obj-literal-mutated-after-if-else.js.snap
+1
-1
@@ -330,7 +330,7 @@ Output:
330
},
331
"right": {
332
"type": "NumericLiteral",
333
- "value": 4607182418800017408,
333
+ "value": 1.0,
334
"loc": null,
335
"range": {
336
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@obj-mutated-after-if-else-with-alias.js.snap
+1
-1
@@ -374,7 +374,7 @@ Output:
374
},
375
"right": {
376
"type": "NumericLiteral",
377
- "value": 4607182418800017408,
377
+ "value": 1.0,
378
"loc": null,
379
"range": {
380
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@obj-mutated-after-if-else.js.snap
+1
-1
@@ -294,7 +294,7 @@ Output:
294
},
295
"right": {
296
"type": "NumericLiteral",
297
- "value": 4607182418800017408,
297
+ "value": 1.0,
298
"loc": null,
299
"range": {
300
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@obj-mutated-after-nested-if-else-with-alias.js.snap
+1
-1
@@ -533,7 +533,7 @@ Output:
533
},
534
"right": {
535
"type": "NumericLiteral",
536
- "value": 4607182418800017408,
536
+ "value": 1.0,
537
"loc": null,
538
"range": {
539
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@object-computed-access-assignment.js.snap
+3
-3
@@ -216,7 +216,7 @@ Output:
216
"type": "BinaryExpression",
217
"left": {
218
"type": "NumericLiteral",
219
- "value": 4607182418800017408,
219
+ "value": 1.0,
220
"loc": null,
221
"range": {
222
"start": 0,
@@ -226,7 +226,7 @@ Output:
226
"operator": "+",
227
"right": {
228
"type": "NumericLiteral",
229
- "value": 4611686018427387904,
229
+ "value": 2.0,
230
"loc": null,
231
"range": {
232
"start": 0,
@@ -273,7 +273,7 @@ Output:
273
"operator": "*",
274
"right": {
275
"type": "NumericLiteral",
276
- "value": 4616189618054758400,
276
+ "value": 4.0,
277
"loc": null,
278
"range": {
279
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@optional-computed-load-static.js.snap
+1
-1
@@ -111,7 +111,7 @@ Output:
111
},
112
"property": {
113
"type": "NumericLiteral",
114
- "value": 0,
114
+ "value": 0.0,
115
"loc": null,
116
"range": {
117
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@primitive-as-dep-nested-scope.js.snap
+1
-1
@@ -189,7 +189,7 @@ Output:
189
"operator": "+",
190
"right": {
191
"type": "NumericLiteral",
192
- "value": 4607182418800017408,
192
+ "value": 1.0,
193
"loc": null,
194
"range": {
195
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@primitive-as-dep.js.snap
+1
-1
@@ -109,7 +109,7 @@ Output:
109
"operator": "+",
110
"right": {
111
"type": "NumericLiteral",
112
- "value": 4607182418800017408,
112
+ "value": 1.0,
113
"loc": null,
114
"range": {
115
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@property-call-evaluation-order.js.snap
+1
-1
@@ -522,7 +522,7 @@ Output:
522
},
523
{
524
"type": "NumericLiteral",
525
- "value": 4607182418800017408,
525
+ "value": 1.0,
526
"loc": null,
527
"range": {
528
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@reactive-scopes.js.snap
+1
-1
@@ -131,7 +131,7 @@ Output:
131
"operator": "===",
132
"right": {
133
"type": "NumericLiteral",
134
- "value": 4607182418800017408,
134
+ "value": 1.0,
135
"loc": null,
136
"range": {
137
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@reactivity-analysis-reactive-via-mutation-of-computed-load.js.snap
+1
-1
@@ -262,7 +262,7 @@ Output:
262
"operator": "+",
263
"right": {
264
"type": "NumericLiteral",
265
- "value": 4607182418800017408,
265
+ "value": 1.0,
266
"loc": null,
267
"range": {
268
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@reactivity-analysis-reactive-via-mutation-of-property-load.js.snap
+1
-1
@@ -243,7 +243,7 @@ Output:
243
"operator": "+",
244
"right": {
245
"type": "NumericLiteral",
246
- "value": 4607182418800017408,
246
+ "value": 1.0,
247
"loc": null,
248
"range": {
249
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@reassign-primitive-in-context.js.snap
+1
-1
@@ -63,7 +63,7 @@ Output:
63
},
64
"init": {
65
"type": "NumericLiteral",
66
- "value": 4617315517961601024,
66
+ "value": 5.0,
67
"loc": null,
68
"range": {
69
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@reassigned-phi-in-returned-function-expression.js.snap
+1
-1
@@ -150,7 +150,7 @@ Output:
150
},
151
"property": {
152
"type": "NumericLiteral",
153
- "value": 0,
153
+ "value": 0.0,
154
"loc": null,
155
"range": {
156
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@reassignment-separate-scopes.js.snap
+1
-1
@@ -317,7 +317,7 @@ Output:
317
"type": "SwitchCase",
318
"test": {
319
"type": "NumericLiteral",
320
- "value": 0,
320
+ "value": 0.0,
321
"loc": null,
322
"range": {
323
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@reduce-reactive-cond-deps-cfg-switch-missing-case.js.snap
+3
-3
@@ -140,7 +140,7 @@ Output:
140
"type": "SwitchCase",
141
"test": {
142
"type": "NumericLiteral",
143
- "value": 4607182418800017408,
143
+ "value": 1.0,
144
"loc": null,
145
"range": {
146
"start": 0,
@@ -263,7 +263,7 @@ Output:
263
"type": "SwitchCase",
264
"test": {
265
"type": "NumericLiteral",
266
- "value": 4611686018427387904,
266
+ "value": 2.0,
267
"loc": null,
268
"range": {
269
"start": 0,
@@ -307,7 +307,7 @@ Output:
307
},
308
"right": {
309
"type": "NumericLiteral",
310
- "value": 4631107791820423168,
310
+ "value": 42.0,
311
"loc": null,
312
"range": {
313
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@reduce-reactive-cond-deps-cfg-switch-missing-default.js.snap
+2
-2
@@ -137,7 +137,7 @@ Output:
137
"type": "SwitchCase",
138
"test": {
139
"type": "NumericLiteral",
140
- "value": 4607182418800017408,
140
+ "value": 1.0,
141
"loc": null,
142
"range": {
143
"start": 0,
@@ -260,7 +260,7 @@ Output:
260
"type": "SwitchCase",
261
"test": {
262
"type": "NumericLiteral",
263
- "value": 4611686018427387904,
263
+ "value": 2.0,
264
"loc": null,
265
"range": {
266
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@reduce-reactive-cond-deps-cfg-switch.js.snap
+2
-2
@@ -140,7 +140,7 @@ Output:
140
"type": "SwitchCase",
141
"test": {
142
"type": "NumericLiteral",
143
- "value": 4607182418800017408,
143
+ "value": 1.0,
144
"loc": null,
145
"range": {
146
"start": 0,
@@ -263,7 +263,7 @@ Output:
263
"type": "SwitchCase",
264
"test": {
265
"type": "NumericLiteral",
266
- "value": 4611686018427387904,
266
+ "value": 2.0,
267
"loc": null,
268
"range": {
269
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@ref-current-write-not-added-to-dep.js.snap
+1
-1
@@ -141,7 +141,7 @@ Output:
141
},
142
"right": {
143
"type": "NumericLiteral",
144
- "value": 4607182418800017408,
144
+ "value": 1.0,
145
"loc": null,
146
"range": {
147
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@repro-scope-missing-mutable-range.js.snap
+2
-2
@@ -113,7 +113,7 @@ Output:
113
},
114
"init": {
115
"type": "NumericLiteral",
116
- "value": 0,
116
+ "value": 0.0,
117
"loc": null,
118
"range": {
119
"start": 0,
@@ -311,7 +311,7 @@ Output:
311
},
312
"right": {
313
"type": "NumericLiteral",
314
- "value": 0,
314
+ "value": 0.0,
315
"loc": null,
316
"range": {
317
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@reverse-postorder.js.snap
+3
-3
@@ -164,7 +164,7 @@ Output:
164
"type": "SwitchCase",
165
"test": {
166
"type": "NumericLiteral",
167
- "value": 0,
167
+ "value": 0.0,
168
"loc": null,
169
"range": {
170
"start": 0,
@@ -259,7 +259,7 @@ Output:
259
"type": "SwitchCase",
260
"test": {
261
"type": "NumericLiteral",
262
- "value": 4607182418800017408,
262
+ "value": 1.0,
263
"loc": null,
264
"range": {
265
"start": 0,
@@ -354,7 +354,7 @@ Output:
354
"type": "SwitchCase",
355
"test": {
356
"type": "NumericLiteral",
357
- "value": 4611686018427387904,
357
+ "value": 2.0,
358
"loc": null,
359
"range": {
360
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@sequence-expression.js.snap
+3
-3
@@ -107,7 +107,7 @@ Output:
107
"arguments": [
108
{
109
"type": "NumericLiteral",
110
- "value": 4607182418800017408,
110
+ "value": 1.0,
111
"loc": null,
112
"range": {
113
"start": 0,
@@ -116,7 +116,7 @@ Output:
116
},
117
{
118
"type": "NumericLiteral",
119
- "value": 4611686018427387904,
119
+ "value": 2.0,
120
"loc": null,
121
"range": {
122
"start": 0,
@@ -251,7 +251,7 @@ Output:
251
},
252
{
253
"type": "NumericLiteral",
254
- "value": 4611686018427387904,
254
+ "value": 2.0,
255
"loc": null,
256
"range": {
257
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@sequentially-constant-progagatable-if-test-conditions.js.snap
+5
-5
@@ -78,7 +78,7 @@ Output:
78
},
79
"init": {
80
"type": "NumericLiteral",
81
- "value": 4607182418800017408,
81
+ "value": 1.0,
82
"loc": null,
83
"range": {
84
"start": 0,
@@ -145,7 +145,7 @@ Output:
145
"operator": "===",
146
"right": {
147
"type": "NumericLiteral",
148
- "value": 4607182418800017408,
148
+ "value": 1.0,
149
"loc": null,
150
"range": {
151
"start": 0,
@@ -479,7 +479,7 @@ Output:
479
},
480
"right": {
481
"type": "NumericLiteral",
482
- "value": 4631107791820423168,
482
+ "value": 42.0,
483
"loc": null,
484
"range": {
485
"start": 0,
@@ -526,7 +526,7 @@ Output:
526
},
527
"right": {
528
"type": "NumericLiteral",
529
- "value": 4631107932557911523,
529
+ "value": 42.001,
530
"loc": null,
531
"range": {
532
"start": 0,
@@ -606,7 +606,7 @@ Output:
606
"operator": "===",
607
"right": {
608
"type": "NumericLiteral",
609
- "value": 4631107791820423168,
609
+ "value": 42.0,
610
"loc": null,
611
"range": {
612
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@simple.js.snap
+1
-1
@@ -151,7 +151,7 @@ Output:
151
"operator": "*",
152
"right": {
153
"type": "NumericLiteral",
154
- "value": 4621819117588971520,
154
+ "value": 10.0,
155
"loc": null,
156
"range": {
157
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@sketchy-code-exhaustive-deps.js.snap
+1
-1
@@ -147,7 +147,7 @@ Output:
147
"arguments": [
148
{
149
"type": "NumericLiteral",
150
- "value": 4607182418800017408,
150
+ "value": 1.0,
151
"loc": null,
152
"range": {
153
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@ssa-arrayexpression.js.snap
+2
-2
@@ -61,7 +61,7 @@ Output:
61
},
62
"init": {
63
"type": "NumericLiteral",
64
- "value": 4607182418800017408,
64
+ "value": 1.0,
65
"loc": null,
66
"range": {
67
"start": 0,
@@ -99,7 +99,7 @@ Output:
99
},
100
"init": {
101
"type": "NumericLiteral",
102
- "value": 4611686018427387904,
102
+ "value": 2.0,
103
"loc": null,
104
"range": {
105
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@ssa-cascading-eliminated-phis.js.snap
+3
-3
@@ -70,7 +70,7 @@ Output:
70
},
71
"init": {
72
"type": "NumericLiteral",
73
- "value": 0,
73
+ "value": 0.0,
74
"loc": null,
75
"range": {
76
"start": 0,
@@ -333,7 +333,7 @@ Output:
333
},
334
"right": {
335
"type": "NumericLiteral",
336
- "value": 4607182418800017408,
336
+ "value": 1.0,
337
"loc": null,
338
"range": {
339
"start": 0,
@@ -476,7 +476,7 @@ Output:
476
},
477
"right": {
478
"type": "NumericLiteral",
479
- "value": 4611686018427387904,
479
+ "value": 2.0,
480
"loc": null,
481
"range": {
482
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@ssa-complex-multiple-if.js.snap
+6
-6
@@ -56,7 +56,7 @@ Output:
56
},
57
"init": {
58
"type": "NumericLiteral",
59
- "value": 4607182418800017408,
59
+ "value": 1.0,
60
"loc": null,
61
"range": {
62
"start": 0,
@@ -94,7 +94,7 @@ Output:
94
},
95
"init": {
96
"type": "NumericLiteral",
97
- "value": 4611686018427387904,
97
+ "value": 2.0,
98
"loc": null,
99
"range": {
100
"start": 0,
@@ -131,7 +131,7 @@ Output:
131
"operator": "===",
132
"right": {
133
"type": "NumericLiteral",
134
- "value": 4611686018427387904,
134
+ "value": 2.0,
135
"loc": null,
136
"range": {
137
"start": 0,
@@ -164,7 +164,7 @@ Output:
164
},
165
"right": {
166
"type": "NumericLiteral",
167
- "value": 4613937818241073152,
167
+ "value": 3.0,
168
"loc": null,
169
"range": {
170
"start": 0,
@@ -215,7 +215,7 @@ Output:
215
"operator": "===",
216
"right": {
217
"type": "NumericLiteral",
218
- "value": 4613937818241073152,
218
+ "value": 3.0,
219
"loc": null,
220
"range": {
221
"start": 0,
@@ -248,7 +248,7 @@ Output:
248
},
249
"right": {
250
"type": "NumericLiteral",
251
- "value": 4617315517961601024,
251
+ "value": 5.0,
252
"loc": null,
253
"range": {
254
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@ssa-complex-single-if.js.snap
+4
-4
@@ -53,7 +53,7 @@ Output:
53
},
54
"init": {
55
"type": "NumericLiteral",
56
- "value": 4607182418800017408,
56
+ "value": 1.0,
57
"loc": null,
58
"range": {
59
"start": 0,
@@ -91,7 +91,7 @@ Output:
91
},
92
"init": {
93
"type": "NumericLiteral",
94
- "value": 4611686018427387904,
94
+ "value": 2.0,
95
"loc": null,
96
"range": {
97
"start": 0,
@@ -128,7 +128,7 @@ Output:
128
"operator": "===",
129
"right": {
130
"type": "NumericLiteral",
131
- "value": 4611686018427387904,
131
+ "value": 2.0,
132
"loc": null,
133
"range": {
134
"start": 0,
@@ -161,7 +161,7 @@ Output:
161
},
162
"right": {
163
"type": "NumericLiteral",
164
- "value": 4613937818241073152,
164
+ "value": 3.0,
165
"loc": null,
166
"range": {
167
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@ssa-for-of.js.snap
+2
-2
@@ -149,7 +149,7 @@ Output:
149
},
150
"init": {
151
"type": "NumericLiteral",
152
- "value": 0,
152
+ "value": 0.0,
153
"loc": null,
154
"range": {
155
"start": 0,
@@ -201,7 +201,7 @@ Output:
201
},
202
"right": {
203
"type": "NumericLiteral",
204
- "value": 4607182418800017408,
204
+ "value": 1.0,
205
"loc": null,
206
"range": {
207
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@ssa-for-trivial-update.js.snap
+4
-4
@@ -51,7 +51,7 @@ Output:
51
},
52
"init": {
53
"type": "NumericLiteral",
54
- "value": 4607182418800017408,
54
+ "value": 1.0,
55
"loc": null,
56
"range": {
57
"start": 0,
@@ -91,7 +91,7 @@ Output:
91
},
92
"init": {
93
"type": "NumericLiteral",
94
- "value": 0,
94
+ "value": 0.0,
95
"loc": null,
96
"range": {
97
"start": 0,
@@ -126,7 +126,7 @@ Output:
126
"operator": "<",
127
"right": {
128
"type": "NumericLiteral",
129
- "value": 4621819117588971520,
129
+ "value": 10.0,
130
"loc": null,
131
"range": {
132
"start": 0,
@@ -169,7 +169,7 @@ Output:
169
},
170
"right": {
171
"type": "NumericLiteral",
172
- "value": 4607182418800017408,
172
+ "value": 1.0,
173
"loc": null,
174
"range": {
175
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@ssa-for.js.snap
+4
-4
@@ -51,7 +51,7 @@ Output:
51
},
52
"init": {
53
"type": "NumericLiteral",
54
- "value": 4607182418800017408,
54
+ "value": 1.0,
55
"loc": null,
56
"range": {
57
"start": 0,
@@ -91,7 +91,7 @@ Output:
91
},
92
"init": {
93
"type": "NumericLiteral",
94
- "value": 0,
94
+ "value": 0.0,
95
"loc": null,
96
"range": {
97
"start": 0,
@@ -126,7 +126,7 @@ Output:
126
"operator": "<",
127
"right": {
128
"type": "NumericLiteral",
129
- "value": 4621819117588971520,
129
+ "value": 10.0,
130
"loc": null,
131
"range": {
132
"start": 0,
@@ -179,7 +179,7 @@ Output:
179
},
180
"right": {
181
"type": "NumericLiteral",
182
- "value": 4607182418800017408,
182
+ "value": 1.0,
183
"loc": null,
184
"range": {
185
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@ssa-if-else.js.snap
+2
-2
@@ -54,7 +54,7 @@ Output:
54
},
55
"init": {
56
"type": "NumericLiteral",
57
- "value": 4607182418800017408,
57
+ "value": 1.0,
58
"loc": null,
59
"range": {
60
"start": 0,
@@ -92,7 +92,7 @@ Output:
92
},
93
"init": {
94
"type": "NumericLiteral",
95
- "value": 4611686018427387904,
95
+ "value": 2.0,
96
"loc": null,
97
"range": {
98
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@ssa-multiple-phis.js.snap
+1
-1
@@ -104,7 +104,7 @@ Output:
104
},
105
"init": {
106
"type": "NumericLiteral",
107
- "value": 0,
107
+ "value": 0.0,
108
"loc": null,
109
"range": {
110
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@ssa-nested-loops-no-reassign.js.snap
+2
-2
@@ -87,7 +87,7 @@ Output:
87
},
88
"init": {
89
"type": "NumericLiteral",
90
- "value": 0,
90
+ "value": 0.0,
91
"loc": null,
92
"range": {
93
"start": 0,
@@ -169,7 +169,7 @@ Output:
169
"operator": "+",
170
"right": {
171
"type": "NumericLiteral",
172
- "value": 4607182418800017408,
172
+ "value": 1.0,
173
"loc": null,
174
"range": {
175
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@ssa-non-empty-initializer.js.snap
+1
-1
@@ -126,7 +126,7 @@ Output:
126
},
127
"right": {
128
"type": "NumericLiteral",
129
- "value": 4607182418800017408,
129
+ "value": 1.0,
130
"loc": null,
131
"range": {
132
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@ssa-objectexpression-phi.js.snap
+5
-5
@@ -57,7 +57,7 @@ Output:
57
},
58
"init": {
59
"type": "NumericLiteral",
60
- "value": 4607182418800017408,
60
+ "value": 1.0,
61
"loc": null,
62
"range": {
63
"start": 0,
@@ -95,7 +95,7 @@ Output:
95
},
96
"init": {
97
"type": "NumericLiteral",
98
- "value": 4611686018427387904,
98
+ "value": 2.0,
99
"loc": null,
100
"range": {
101
"start": 0,
@@ -132,7 +132,7 @@ Output:
132
"operator": ">",
133
"right": {
134
"type": "NumericLiteral",
135
- "value": 4607182418800017408,
135
+ "value": 1.0,
136
"loc": null,
137
"range": {
138
"start": 0,
@@ -165,7 +165,7 @@ Output:
165
},
166
"right": {
167
"type": "NumericLiteral",
168
- "value": 4611686018427387904,
168
+ "value": 2.0,
169
"loc": null,
170
"range": {
171
"start": 0,
@@ -212,7 +212,7 @@ Output:
212
},
213
"right": {
214
"type": "NumericLiteral",
215
- "value": 4613937818241073152,
215
+ "value": 3.0,
216
"loc": null,
217
"range": {
218
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@ssa-objectexpression.js.snap
+2
-2
@@ -61,7 +61,7 @@ Output:
61
},
62
"init": {
63
"type": "NumericLiteral",
64
- "value": 4607182418800017408,
64
+ "value": 1.0,
65
"loc": null,
66
"range": {
67
"start": 0,
@@ -99,7 +99,7 @@ Output:
99
},
100
"init": {
101
"type": "NumericLiteral",
102
- "value": 4611686018427387904,
102
+ "value": 2.0,
103
"loc": null,
104
"range": {
105
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@ssa-reassign-in-rval.js.snap
+1
-1
@@ -149,7 +149,7 @@ Output:
149
},
150
{
151
"type": "NumericLiteral",
152
- "value": 4617315517961601024,
152
+ "value": 5.0,
153
"loc": null,
154
"range": {
155
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@ssa-reassign.js.snap
+1
-1
@@ -82,7 +82,7 @@ Output:
82
},
83
"init": {
84
"type": "NumericLiteral",
85
- "value": 0,
85
+ "value": 0.0,
86
"loc": null,
87
"range": {
88
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@ssa-return.js.snap
+3
-3
@@ -52,7 +52,7 @@ Output:
52
},
53
"init": {
54
"type": "NumericLiteral",
55
- "value": 4607182418800017408,
55
+ "value": 1.0,
56
"loc": null,
57
"range": {
58
"start": 0,
@@ -89,7 +89,7 @@ Output:
89
"operator": "===",
90
"right": {
91
"type": "NumericLiteral",
92
- "value": 4607182418800017408,
92
+ "value": 1.0,
93
"loc": null,
94
"range": {
95
"start": 0,
@@ -122,7 +122,7 @@ Output:
122
},
123
"right": {
124
"type": "NumericLiteral",
125
- "value": 4611686018427387904,
125
+ "value": 2.0,
126
"loc": null,
127
"range": {
128
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@ssa-sibling-phis.js.snap
+1
-1
@@ -104,7 +104,7 @@ Output:
104
},
105
"init": {
106
"type": "NumericLiteral",
107
- "value": 0,
107
+ "value": 0.0,
108
"loc": null,
109
"range": {
110
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@ssa-simple-phi.js.snap
+4
-4
@@ -55,7 +55,7 @@ Output:
55
},
56
"init": {
57
"type": "NumericLiteral",
58
- "value": 4611686018427387904,
58
+ "value": 2.0,
59
"loc": null,
60
"range": {
61
"start": 0,
@@ -92,7 +92,7 @@ Output:
92
"operator": ">",
93
"right": {
94
"type": "NumericLiteral",
95
- "value": 4607182418800017408,
95
+ "value": 1.0,
96
"loc": null,
97
"range": {
98
"start": 0,
@@ -125,7 +125,7 @@ Output:
125
},
126
"right": {
127
"type": "NumericLiteral",
128
- "value": 4607182418800017408,
128
+ "value": 1.0,
129
"loc": null,
130
"range": {
131
"start": 0,
@@ -172,7 +172,7 @@ Output:
172
},
173
"right": {
174
"type": "NumericLiteral",
175
- "value": 4611686018427387904,
175
+ "value": 2.0,
176
"loc": null,
177
"range": {
178
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@ssa-simple.js.snap
+2
-2
@@ -48,7 +48,7 @@ Output:
48
},
49
"init": {
50
"type": "NumericLiteral",
51
- "value": 4607182418800017408,
51
+ "value": 1.0,
52
"loc": null,
53
"range": {
54
"start": 0,
@@ -86,7 +86,7 @@ Output:
86
},
87
"init": {
88
"type": "NumericLiteral",
89
- "value": 4611686018427387904,
89
+ "value": 2.0,
90
"loc": null,
91
"range": {
92
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@ssa-single-if.js.snap
+2
-2
@@ -52,7 +52,7 @@ Output:
52
},
53
"init": {
54
"type": "NumericLiteral",
55
- "value": 4607182418800017408,
55
+ "value": 1.0,
56
"loc": null,
57
"range": {
58
"start": 0,
@@ -90,7 +90,7 @@ Output:
90
},
91
"init": {
92
"type": "NumericLiteral",
93
- "value": 4611686018427387904,
93
+ "value": 2.0,
94
"loc": null,
95
"range": {
96
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@ssa-switch.js.snap
+6
-6
@@ -63,7 +63,7 @@ Output:
63
},
64
"init": {
65
"type": "NumericLiteral",
66
- "value": 4607182418800017408,
66
+ "value": 1.0,
67
"loc": null,
68
"range": {
69
"start": 0,
@@ -100,7 +100,7 @@ Output:
100
"type": "SwitchCase",
101
"test": {
102
"type": "NumericLiteral",
103
- "value": 4607182418800017408,
103
+ "value": 1.0,
104
"loc": null,
105
"range": {
106
"start": 0,
@@ -141,7 +141,7 @@ Output:
141
"operator": "+",
142
"right": {
143
"type": "NumericLiteral",
144
- "value": 4607182418800017408,
144
+ "value": 1.0,
145
"loc": null,
146
"range": {
147
"start": 0,
@@ -194,7 +194,7 @@ Output:
194
"type": "SwitchCase",
195
"test": {
196
"type": "NumericLiteral",
197
- "value": 4611686018427387904,
197
+ "value": 2.0,
198
"loc": null,
199
"range": {
200
"start": 0,
@@ -235,7 +235,7 @@ Output:
235
"operator": "+",
236
"right": {
237
"type": "NumericLiteral",
238
- "value": 4611686018427387904,
238
+ "value": 2.0,
239
"loc": null,
240
"range": {
241
"start": 0,
@@ -321,7 +321,7 @@ Output:
321
"operator": "+",
322
"right": {
323
"type": "NumericLiteral",
324
- "value": 4613937818241073152,
324
+ "value": 3.0,
325
"loc": null,
326
"range": {
327
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@ssa-throw.js.snap
+3
-3
@@ -51,7 +51,7 @@ Output:
51
},
52
"init": {
53
"type": "NumericLiteral",
54
- "value": 4607182418800017408,
54
+ "value": 1.0,
55
"loc": null,
56
"range": {
57
"start": 0,
@@ -88,7 +88,7 @@ Output:
88
"operator": "===",
89
"right": {
90
"type": "NumericLiteral",
91
- "value": 4607182418800017408,
91
+ "value": 1.0,
92
"loc": null,
93
"range": {
94
"start": 0,
@@ -121,7 +121,7 @@ Output:
121
},
122
"right": {
123
"type": "NumericLiteral",
124
- "value": 4611686018427387904,
124
+ "value": 2.0,
125
"loc": null,
126
"range": {
127
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@ssa-while-no-reassign.js.snap
+3
-3
@@ -52,7 +52,7 @@ Output:
52
},
53
"init": {
54
"type": "NumericLiteral",
55
- "value": 4607182418800017408,
55
+ "value": 1.0,
56
"loc": null,
57
"range": {
58
"start": 0,
@@ -89,7 +89,7 @@ Output:
89
"operator": "<",
90
"right": {
91
"type": "NumericLiteral",
92
- "value": 4621819117588971520,
92
+ "value": 10.0,
93
"loc": null,
94
"range": {
95
"start": 0,
@@ -122,7 +122,7 @@ Output:
122
"operator": "+",
123
"right": {
124
"type": "NumericLiteral",
125
- "value": 4607182418800017408,
125
+ "value": 1.0,
126
"loc": null,
127
"range": {
128
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@ssa-while.js.snap
+3
-3
@@ -52,7 +52,7 @@ Output:
52
},
53
"init": {
54
"type": "NumericLiteral",
55
- "value": 4607182418800017408,
55
+ "value": 1.0,
56
"loc": null,
57
"range": {
58
"start": 0,
@@ -89,7 +89,7 @@ Output:
89
"operator": "<",
90
"right": {
91
"type": "NumericLiteral",
92
- "value": 4621819117588971520,
92
+ "value": 10.0,
93
"loc": null,
94
"range": {
95
"start": 0,
@@ -135,7 +135,7 @@ Output:
135
"operator": "+",
136
"right": {
137
"type": "NumericLiteral",
138
- "value": 4607182418800017408,
138
+ "value": 1.0,
139
"loc": null,
140
"range": {
141
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@switch-non-final-default.js.snap
+1
-1
@@ -164,7 +164,7 @@ Output:
164
"type": "SwitchCase",
165
"test": {
166
"type": "NumericLiteral",
167
- "value": 4607182418800017408,
167
+ "value": 1.0,
168
"loc": null,
169
"range": {
170
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@switch-with-fallthrough.js.snap
+12
-12
@@ -111,7 +111,7 @@ Output:
111
"type": "SwitchCase",
112
"test": {
113
"type": "NumericLiteral",
114
- "value": 0,
114
+ "value": 0.0,
115
"loc": null,
116
"range": {
117
"start": 0,
@@ -139,7 +139,7 @@ Output:
139
},
140
"right": {
141
"type": "NumericLiteral",
142
- "value": 0,
142
+ "value": 0.0,
143
"loc": null,
144
"range": {
145
"start": 0,
@@ -177,7 +177,7 @@ Output:
177
"type": "SwitchCase",
178
"test": {
179
"type": "NumericLiteral",
180
- "value": 4607182418800017408,
180
+ "value": 1.0,
181
"loc": null,
182
"range": {
183
"start": 0,
@@ -205,7 +205,7 @@ Output:
205
},
206
"right": {
207
"type": "NumericLiteral",
208
- "value": 4607182418800017408,
208
+ "value": 1.0,
209
"loc": null,
210
"range": {
211
"start": 0,
@@ -243,7 +243,7 @@ Output:
243
"type": "SwitchCase",
244
"test": {
245
"type": "NumericLiteral",
246
- "value": 4611686018427387904,
246
+ "value": 2.0,
247
"loc": null,
248
"range": {
249
"start": 0,
@@ -281,7 +281,7 @@ Output:
281
"type": "SwitchCase",
282
"test": {
283
"type": "NumericLiteral",
284
- "value": 4613937818241073152,
284
+ "value": 3.0,
285
"loc": null,
286
"range": {
287
"start": 0,
@@ -309,7 +309,7 @@ Output:
309
},
310
"right": {
311
"type": "NumericLiteral",
312
- "value": 4613937818241073152,
312
+ "value": 3.0,
313
"loc": null,
314
"range": {
315
"start": 0,
@@ -356,7 +356,7 @@ Output:
356
"type": "SwitchCase",
357
"test": {
358
"type": "NumericLiteral",
359
- "value": 4616189618054758400,
359
+ "value": 4.0,
360
"loc": null,
361
"range": {
362
"start": 0,
@@ -384,7 +384,7 @@ Output:
384
},
385
"right": {
386
"type": "NumericLiteral",
387
- "value": 4616189618054758400,
387
+ "value": 4.0,
388
"loc": null,
389
"range": {
390
"start": 0,
@@ -422,7 +422,7 @@ Output:
422
"type": "SwitchCase",
423
"test": {
424
"type": "NumericLiteral",
425
- "value": 4617315517961601024,
425
+ "value": 5.0,
426
"loc": null,
427
"range": {
428
"start": 0,
@@ -450,7 +450,7 @@ Output:
450
},
451
"right": {
452
"type": "NumericLiteral",
453
- "value": 4617315517961601024,
453
+ "value": 5.0,
454
"loc": null,
455
"range": {
456
"start": 0,
@@ -508,7 +508,7 @@ Output:
508
},
509
"right": {
510
"type": "NumericLiteral",
511
- "value": 0,
511
+ "value": 0.0,
512
"loc": null,
513
"range": {
514
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@ternary-assignment-expression.js.snap
+3
-3
@@ -60,7 +60,7 @@ Output:
60
},
61
"init": {
62
"type": "NumericLiteral",
63
- "value": 0,
63
+ "value": 0.0,
64
"loc": null,
65
"range": {
66
"start": 0,
@@ -142,7 +142,7 @@ Output:
142
},
143
"right": {
144
"type": "NumericLiteral",
145
- "value": 4611686018427387904,
145
+ "value": 2.0,
146
"loc": null,
147
"range": {
148
"start": 0,
@@ -170,7 +170,7 @@ Output:
170
},
171
"right": {
172
"type": "NumericLiteral",
173
- "value": 4607182418800017408,
173
+ "value": 1.0,
174
"loc": null,
175
"range": {
176
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@type-field-load.js.snap
+1
-1
@@ -64,7 +64,7 @@ Output:
64
},
65
"value": {
66
"type": "NumericLiteral",
67
- "value": 4607182418800017408,
67
+ "value": 1.0,
68
"loc": null,
69
"range": {
70
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@type-test-primitive.js.snap
+2
-2
@@ -50,7 +50,7 @@ Output:
50
},
51
"init": {
52
"type": "NumericLiteral",
53
- "value": 4607182418800017408,
53
+ "value": 1.0,
54
"loc": null,
55
"range": {
56
"start": 0,
@@ -88,7 +88,7 @@ Output:
88
},
89
"init": {
90
"type": "NumericLiteral",
91
- "value": 4611686018427387904,
91
+ "value": 2.0,
92
"loc": null,
93
"range": {
94
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@unconditional-break-label.js.snap
+2
-2
@@ -63,7 +63,7 @@ Output:
63
},
64
"init": {
65
"type": "NumericLiteral",
66
- "value": 0,
66
+ "value": 0.0,
67
"loc": null,
68
"range": {
69
"start": 0,
@@ -115,7 +115,7 @@ Output:
115
},
116
"right": {
117
"type": "NumericLiteral",
118
- "value": 4607182418800017408,
118
+ "value": 1.0,
119
"loc": null,
120
"range": {
121
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@unused-conditional.js.snap
+3
-3
@@ -60,7 +60,7 @@ Output:
60
},
61
"init": {
62
"type": "NumericLiteral",
63
- "value": 0,
63
+ "value": 0.0,
64
"loc": null,
65
"range": {
66
"start": 0,
@@ -100,7 +100,7 @@ Output:
100
},
101
"right": {
102
"type": "NumericLiteral",
103
- "value": 4607182418800017408,
103
+ "value": 1.0,
104
"loc": null,
105
"range": {
106
"start": 0,
@@ -128,7 +128,7 @@ Output:
128
},
129
"right": {
130
"type": "NumericLiteral",
131
- "value": 4611686018427387904,
131
+ "value": 2.0,
132
"loc": null,
133
"range": {
134
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@unused-logical.js.snap
+3
-3
@@ -60,7 +60,7 @@ Output:
60
},
61
"init": {
62
"type": "NumericLiteral",
63
- "value": 0,
63
+ "value": 0.0,
64
"loc": null,
65
"range": {
66
"start": 0,
@@ -128,7 +128,7 @@ Output:
128
},
129
"right": {
130
"type": "NumericLiteral",
131
- "value": 4611686018427387904,
131
+ "value": 2.0,
132
"loc": null,
133
"range": {
134
"start": 0,
@@ -156,7 +156,7 @@ Output:
156
},
157
"right": {
158
"type": "NumericLiteral",
159
- "value": 4607182418800017408,
159
+ "value": 1.0,
160
"loc": null,
161
"range": {
162
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@use-callback-simple.js.snap
+2
-2
@@ -83,7 +83,7 @@ Output:
83
"arguments": [
84
{
85
"type": "NumericLiteral",
86
- "value": 0,
86
+ "value": 0.0,
87
"loc": null,
88
"range": {
89
"start": 0,
@@ -171,7 +171,7 @@ Output:
171
"operator": "+",
172
"right": {
173
"type": "NumericLiteral",
174
- "value": 4607182418800017408,
174
+ "value": 1.0,
175
"loc": null,
176
"range": {
177
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@while-logical.js.snap
+2
-2
@@ -62,7 +62,7 @@ Output:
62
},
63
"init": {
64
"type": "NumericLiteral",
65
- "value": 0,
65
+ "value": 0.0,
66
"loc": null,
67
"range": {
68
"start": 0,
@@ -209,7 +209,7 @@ Output:
209
},
210
"right": {
211
"type": "NumericLiteral",
212
- "value": 4611686018427387904,
212
+ "value": 2.0,
213
"loc": null,
214
"range": {
215
"start": 0,
compiler/forget/crates/forget_hermes_parser/tests/snapshots/parser_test__fixtures@while-property.js.snap
+1
-1
@@ -72,7 +72,7 @@ Output:
72
},
73
"init": {
74
"type": "NumericLiteral",
75
- "value": 0,
75
+ "value": 0.0,
76
"loc": null,
77
"range": {
78
"start": 0,
compiler/forget/crates/forget_hir/src/instruction.rs
+2
-148
@@ -2,7 +2,7 @@ use std::cell::RefCell;
2
use std::fmt::Display;
3
use std::rc::Rc;
4
5
-use forget_estree::BinaryOperator;
5
+use forget_estree::{BinaryOperator, JsValue};
6
7
use crate::{Function, IdentifierId, InstrIx, InstructionId, ScopeId, Type};
8
@@ -219,153 +219,7 @@ pub struct FunctionExpression {
219
220
#[derive(Debug, Clone, PartialEq, Eq)]
221
pub struct Primitive {
222
- pub value: PrimitiveValue,
223
-}
224
-
225
-#[derive(Debug, Clone, PartialEq, Eq)]
226
-pub enum PrimitiveValue {
227
- Boolean(bool),
228
- Null,
229
- Number(Number),
230
- String(String),
231
- Undefined,
232
-}
233
-
234
-impl PrimitiveValue {
235
- pub fn is_truthy(&self) -> bool {
236
- match &self {
237
- PrimitiveValue::Boolean(value) => *value,
238
- PrimitiveValue::Number(value) => value.is_truthy(),
239
- PrimitiveValue::String(value) => value.len() != 0,
240
- PrimitiveValue::Null => false,
241
- PrimitiveValue::Undefined => false,
242
- }
243
- }
244
-
245
- // Partial implementation of loose equality for javascript, returns Some for supported
246
- // cases w the equality result, and None for unsupported cases
247
- pub fn loosely_equals(&self, other: &Self) -> Option<bool> {
248
- // https://tc39.es/ecma262/multipage/abstract-operations.html#sec-islooselyequal
249
- match (&self, &other) {
250
- // 1. If Type(x) is Type(y), then
251
- // a. Return IsStrictlyEqual(x, y).
252
- (PrimitiveValue::Number(left), PrimitiveValue::Number(right)) => {
253
- Some(left.equals(*right))
254
- }
255
- (PrimitiveValue::Null, PrimitiveValue::Null) => Some(true),
256
- (PrimitiveValue::Undefined, PrimitiveValue::Undefined) => Some(true),
257
- (PrimitiveValue::Boolean(left), PrimitiveValue::Boolean(right)) => Some(left == right),
258
- (PrimitiveValue::String(left), PrimitiveValue::String(right)) => Some(left == right),
259
-
260
- // 2. If x is null and y is undefined, return true.
261
- (PrimitiveValue::Null, PrimitiveValue::Undefined) => Some(true),
262
-
263
- // 3. If x is undefined and y is null, return true.
264
- (PrimitiveValue::Undefined, PrimitiveValue::Null) => Some(true),
265
- _ => None,
266
- }
267
- }
268
-
269
- pub fn not_loosely_equals(&self, other: &Self) -> Option<bool> {
270
- self.loosely_equals(other).map(|value| !value)
271
- }
272
-
273
- // Complete implementation of strict equality for javascript
274
- pub fn strictly_equals(&self, other: &Self) -> bool {
275
- // https://tc39.es/ecma262/multipage/abstract-operations.html#sec-isstrictlyequal
276
- match (&self, &other) {
277
- (PrimitiveValue::Number(left), PrimitiveValue::Number(right)) => left.equals(*right),
278
- (PrimitiveValue::Null, PrimitiveValue::Null) => true,
279
- (PrimitiveValue::Undefined, PrimitiveValue::Undefined) => true,
280
- (PrimitiveValue::Boolean(left), PrimitiveValue::Boolean(right)) => left == right,
281
- (PrimitiveValue::String(left), PrimitiveValue::String(right)) => left == right,
282
- _ => false,
283
- }
284
- }
285
-
286
- pub fn not_strictly_equals(&self, other: &Self) -> bool {
287
- !self.strictly_equals(other)
288
- }
289
-}
290
-
291
-/// Represents a JavaScript Number as its binary representation so that
292
-/// -1 == -1, NaN == Nan etc.
293
-/// Note: NaN is *always* represented as the f64::NAN constant to allow
294
-/// comparison of NaNs.
295
-#[derive(Clone, Copy, Eq, PartialEq, PartialOrd, Ord, Debug, Hash)]
296
-pub struct Number(u64);
297
-
298
-impl From<f64> for Number {
299
- fn from(value: f64) -> Self {
300
- if value.is_nan() {
301
- Self(f64::NAN.to_bits())
302
- } else {
303
- Self(value.to_bits())
304
- }
305
- }
306
-}
307
-
308
-impl From<Number> for f64 {
309
- fn from(number: Number) -> Self {
310
- let value = f64::from_bits(number.0);
311
- assert!(!f64::is_nan(value) || number.0 == f64::NAN.to_bits());
312
- value
313
- }
314
-}
315
-
316
-impl Number {
317
- pub fn equals(self, other: Self) -> bool {
318
- f64::from(self) == f64::from(other)
319
- }
320
-
321
- pub fn not_equals(self, other: Self) -> bool {
322
- !self.equals(other)
323
- }
324
-
325
- pub fn is_truthy(self) -> bool {
326
- let value = f64::from(self);
327
- if self.0 == f64::NAN.to_bits() || value == 0.0 || value == -0.0 {
328
- false
329
- } else {
330
- true
331
- }
332
- }
333
-}
334
-
335
-impl std::ops::Add for Number {
336
- type Output = Number;
337
-
338
- fn add(self, rhs: Self) -> Self::Output {
339
- let result = f64::from(self) + f64::from(rhs);
340
- Self::from(result)
341
- }
342
-}
343
-
344
-impl std::ops::Sub for Number {
345
- type Output = Number;
346
-
347
- fn sub(self, rhs: Self) -> Self::Output {
348
- let result = f64::from(self) - f64::from(rhs);
349
- Self::from(result)
350
- }
351
-}
352
-
353
-impl std::ops::Mul for Number {
354
- type Output = Number;
355
-
356
- fn mul(self, rhs: Self) -> Self::Output {
357
- let result = f64::from(self) * f64::from(rhs);
358
- Self::from(result)
359
- }
360
-}
361
-
362
-impl std::ops::Div for Number {
363
- type Output = Number;
364
-
365
- fn div(self, rhs: Self) -> Self::Output {
366
- let result = f64::from(self) / f64::from(rhs);
367
- Self::from(result)
368
- }
222
+ pub value: JsValue,
223
}
224
225
#[derive(Debug)]
compiler/forget/crates/forget_hir/src/print.rs
+7
-6
@@ -1,10 +1,11 @@
1
use std::fmt::{Result, Write};
2
3
+use forget_estree::JsValue;
4
use forget_utils::ensure_sufficient_stack;
5
6
use crate::{
7
BasicBlock, Function, Identifier, IdentifierOperand, Instruction, InstructionValue, LValue,
7
- Operand, Phi, PlaceOrSpread, PrimitiveValue, Terminal, TerminalValue, HIR,
8
+ Operand, Phi, PlaceOrSpread, Terminal, TerminalValue, HIR,
9
};
10
11
/// Trait for HIR types to describe how they print themselves.
@@ -149,14 +150,14 @@ impl Print for InstructionValue {
150
// Unlike other variants we don't print the variant name ("Primitive") since it's
151
// obvious
152
match &value.value {
152
- PrimitiveValue::Boolean(value) => write!(out, "{}", value)?,
153
- PrimitiveValue::Null => write!(out, "null")?,
154
- PrimitiveValue::Number(value) => write!(out, "{}", f64::from(*value))?,
153
+ JsValue::Boolean(value) => write!(out, "{}", value)?,
154
+ JsValue::Null => write!(out, "null")?,
155
+ JsValue::Number(value) => write!(out, "{}", f64::from(*value))?,
156
157
// TODO: quote the string itself (JS version uses JSON.stringify())
157
- PrimitiveValue::String(value) => write!(out, "\"{}\"", value.as_str())?,
158
+ JsValue::String(value) => write!(out, "\"{}\"", value.as_str())?,
159
159
- PrimitiveValue::Undefined => write!(out, "<undefined>")?,
160
+ JsValue::Undefined => write!(out, "<undefined>")?,
161
};
162
}
163
InstructionValue::StoreLocal(value) => {
compiler/forget/crates/forget_optimization/src/constant_propagation.rs
+19
-19
@@ -1,11 +1,11 @@
1
use std::collections::HashMap;
2
3
use forget_diagnostics::Diagnostic;
4
-use forget_estree::BinaryOperator;
4
+use forget_estree::{BinaryOperator, JsValue};
5
use forget_hir::{
6
initialize_hir, merge_consecutive_blocks, BlockKind, Environment, Function, GotoKind,
7
GotoTerminal, IdentifierId, Instruction, InstructionValue, LoadGlobal, Operand, Primitive,
8
- PrimitiveValue, TerminalValue,
8
+ TerminalValue,
9
};
10
use forget_ssa::eliminate_redundant_phis;
11
@@ -208,57 +208,57 @@ fn apply_binary_operator(
208
right: Primitive,
209
) -> Option<Primitive> {
210
match (left.value, right.value) {
211
- (PrimitiveValue::Number(left), PrimitiveValue::Number(right)) => match operator {
211
+ (JsValue::Number(left), JsValue::Number(right)) => match operator {
212
BinaryOperator::Add => Some(Primitive {
213
- value: PrimitiveValue::Number(left + right),
213
+ value: JsValue::Number(left + right),
214
}),
215
BinaryOperator::Subtract => Some(Primitive {
216
- value: PrimitiveValue::Number(left - right),
216
+ value: JsValue::Number(left - right),
217
}),
218
BinaryOperator::Multiply => Some(Primitive {
219
- value: PrimitiveValue::Number(left * right),
219
+ value: JsValue::Number(left * right),
220
}),
221
BinaryOperator::Divide => Some(Primitive {
222
- value: PrimitiveValue::Number(left / right),
222
+ value: JsValue::Number(left / right),
223
}),
224
BinaryOperator::LessThan => Some(Primitive {
225
- value: PrimitiveValue::Boolean(left < right),
225
+ value: JsValue::Boolean(left < right),
226
}),
227
BinaryOperator::LessThanOrEqual => Some(Primitive {
228
- value: PrimitiveValue::Boolean(left <= right),
228
+ value: JsValue::Boolean(left <= right),
229
}),
230
BinaryOperator::GreaterThan => Some(Primitive {
231
- value: PrimitiveValue::Boolean(left > right),
231
+ value: JsValue::Boolean(left > right),
232
}),
233
BinaryOperator::GreaterThanOrEqual => Some(Primitive {
234
- value: PrimitiveValue::Boolean(left >= right),
234
+ value: JsValue::Boolean(left >= right),
235
}),
236
BinaryOperator::Equals => Some(Primitive {
237
- value: PrimitiveValue::Boolean(left.equals(right)),
237
+ value: JsValue::Boolean(left.equals(right)),
238
}),
239
BinaryOperator::NotEquals => Some(Primitive {
240
- value: PrimitiveValue::Boolean(left.not_equals(right)),
240
+ value: JsValue::Boolean(left.not_equals(right)),
241
}),
242
BinaryOperator::StrictEquals => Some(Primitive {
243
- value: PrimitiveValue::Boolean(left.equals(right)),
243
+ value: JsValue::Boolean(left.equals(right)),
244
}),
245
BinaryOperator::NotStrictEquals => Some(Primitive {
246
- value: PrimitiveValue::Boolean(left.not_equals(right)),
246
+ value: JsValue::Boolean(left.not_equals(right)),
247
}),
248
_ => None,
249
},
250
(left, right) => match operator {
251
BinaryOperator::Equals => left.loosely_equals(&right).map(|value| Primitive {
252
- value: PrimitiveValue::Boolean(value),
252
+ value: JsValue::Boolean(value),
253
}),
254
BinaryOperator::NotEquals => left.not_loosely_equals(&right).map(|value| Primitive {
255
- value: PrimitiveValue::Boolean(value),
255
+ value: JsValue::Boolean(value),
256
}),
257
BinaryOperator::StrictEquals => Some(Primitive {
258
- value: PrimitiveValue::Boolean(left.strictly_equals(&right)),
258
+ value: JsValue::Boolean(left.strictly_equals(&right)),
259
}),
260
BinaryOperator::NotStrictEquals => Some(Primitive {
261
- value: PrimitiveValue::Boolean(left.not_strictly_equals(&right)),
261
+ value: JsValue::Boolean(left.not_strictly_equals(&right)),
262
}),
263
_ => None,
264
},