Unverified Commit 61651b2b authored by Luke Sandberg's avatar Luke Sandberg Committed by GitHub

[turbopack] Track the scope in which variables are assigned (#82845)

Track where variable assignments occur for all variables.

Right now we only care to identify variables that are _only_ assigned in the 'module evaluation' scope which can later flow into analysis of esm exports.
parent 52ac89f6
...@@ -18,7 +18,7 @@ use turbopack_core::{ ...@@ -18,7 +18,7 @@ use turbopack_core::{
target::CompileTarget, target::CompileTarget,
}; };
use turbopack_ecmascript::analyzer::{ use turbopack_ecmascript::analyzer::{
graph::{EvalContext, VarGraph, create_graph}, graph::{EvalContext, VarGraph, VarMeta, create_graph},
imports::ImportAttributes, imports::ImportAttributes,
linker::link, linker::link,
test_utils::{early_visitor, visitor}, test_utils::{early_visitor, visitor},
...@@ -98,7 +98,7 @@ fn bench_link(b: &mut Bencher, input: &BenchInput) { ...@@ -98,7 +98,7 @@ fn bench_link(b: &mut Bencher, input: &BenchInput) {
b.to_async(rt).iter(|| async { b.to_async(rt).iter(|| async {
let var_cache = Default::default(); let var_cache = Default::default();
for val in input.var_graph.values.values() { for VarMeta { value, .. } in input.var_graph.values.values() {
VcStorage::with(async { VcStorage::with(async {
let compile_time_info = CompileTimeInfo::builder( let compile_time_info = CompileTimeInfo::builder(
Environment::new(ExecutionEnvironment::NodeJsLambda( Environment::new(ExecutionEnvironment::NodeJsLambda(
...@@ -116,7 +116,7 @@ fn bench_link(b: &mut Bencher, input: &BenchInput) { ...@@ -116,7 +116,7 @@ fn bench_link(b: &mut Bencher, input: &BenchInput) {
.await?; .await?;
link( link(
&input.var_graph, &input.var_graph,
val.clone(), value.clone(),
&early_visitor, &early_visitor,
&(|val| visitor(val, compile_time_info, ImportAttributes::empty_ref())), &(|val| visitor(val, compile_time_info, ImportAttributes::empty_ref())),
&Default::default(), &Default::default(),
......
...@@ -247,10 +247,71 @@ impl Effect { ...@@ -247,10 +247,71 @@ impl Effect {
} }
} }
pub enum AssignmentScope {
ModuleEval,
Function,
}
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum AssignmentScopes {
AllInModuleEvalScope,
AllInFunctionScopes,
Mixed,
}
impl AssignmentScopes {
fn new(initial: AssignmentScope) -> Self {
match initial {
AssignmentScope::ModuleEval => AssignmentScopes::AllInModuleEvalScope,
AssignmentScope::Function => AssignmentScopes::AllInFunctionScopes,
}
}
fn merge(self, other: AssignmentScope) -> Self {
// If the other assignment kind is the same as the current one, return the current one.
if self == Self::new(other) {
self
} else {
AssignmentScopes::Mixed
}
}
}
#[derive(Debug, Clone)]
pub struct VarMeta {
pub value: JsValue,
/// Tracks the locations where this was assigned to:
/// - [`AssignmentScopes::AllInModuleEvalScope`] if it was assigned only in the root scope
/// - [`AssignmentScopes::AllInFunctionScopes`] if it was assigned in any set of function
/// scopes
/// - [`AssignmentScopes::Mixed`] if it was assigned in both
///
/// This is used to track the _liveness_ of exports.
pub assignment_scopes: AssignmentScopes,
}
impl VarMeta {
pub fn new(value: JsValue, kind: AssignmentScope) -> Self {
Self {
value,
assignment_scopes: AssignmentScopes::new(kind),
}
}
pub fn normalize(&mut self) {
self.value.normalize();
}
fn add_alt(&mut self, value: JsValue, kind: AssignmentScope) {
self.value.add_alt(value);
self.assignment_scopes = self.assignment_scopes.merge(kind);
}
}
#[derive(Debug)] #[derive(Debug)]
pub struct VarGraph { pub struct VarGraph {
pub values: FxHashMap<Id, JsValue>, pub values: FxHashMap<Id, VarMeta>,
/// Map FreeVar names to their Id to facilitate lookups into [values] /// Map FreeVar names to their Id to facilitate lookups into [values]
/// Doesn't necessarily contain every FreeVar, just those who have non trivial values.
pub free_var_ids: FxHashMap<Atom, Id>, pub free_var_ids: FxHashMap<Atom, Id>,
pub effects: Vec<Effect>, pub effects: Vec<Effect>,
...@@ -1027,10 +1088,15 @@ impl Analyzer<'_> { ...@@ -1027,10 +1088,15 @@ impl Analyzer<'_> {
self.data.free_var_ids.insert(id.0.clone(), id.clone()); self.data.free_var_ids.insert(id.0.clone(), id.clone());
} }
let kind = if self.is_in_fn() {
AssignmentScope::Function
} else {
AssignmentScope::ModuleEval
};
if let Some(prev) = self.data.values.get_mut(&id) { if let Some(prev) = self.data.values.get_mut(&id) {
prev.add_alt(value); prev.add_alt(value, kind);
} else { } else {
self.data.values.insert(id, value); self.data.values.insert(id, VarMeta::new(value, kind));
} }
// TODO(kdy1): We may need to report an error for this. // TODO(kdy1): We may need to report an error for this.
// Variables declared with `var` are hoisted, but using undefined as its // Variables declared with `var` are hoisted, but using undefined as its
......
...@@ -6,6 +6,7 @@ use rustc_hash::{FxHashMap, FxHashSet}; ...@@ -6,6 +6,7 @@ use rustc_hash::{FxHashMap, FxHashSet};
use swc_core::ecma::ast::Id; use swc_core::ecma::ast::Id;
use super::{JsValue, graph::VarGraph}; use super::{JsValue, graph::VarGraph};
use crate::analyzer::graph::VarMeta;
pub async fn link<'a, B, RB, F, RF>( pub async fn link<'a, B, RB, F, RF>(
graph: &VarGraph, graph: &VarGraph,
...@@ -122,11 +123,11 @@ where ...@@ -122,11 +123,11 @@ where
if let Some(val) = var_cache_lock.as_deref().and_then(|cache| cache.get(&var)) { if let Some(val) = var_cache_lock.as_deref().and_then(|cache| cache.get(&var)) {
total_nodes += val.total_nodes(); total_nodes += val.total_nodes();
done.push(val.clone()); done.push(val.clone());
} else if let Some(val) = graph.values.get(&var) { } else if let Some(VarMeta { value, .. }) = graph.values.get(&var) {
cycle_stack.insert(var.clone()); cycle_stack.insert(var.clone());
work_queue_stack.push(Step::LeaveVar(var)); work_queue_stack.push(Step::LeaveVar(var));
total_nodes += val.total_nodes(); total_nodes += value.total_nodes();
work_queue_stack.push(Step::Enter(val.clone())); work_queue_stack.push(Step::Enter(value.clone()));
} else { } else {
total_nodes += 1; total_nodes += 1;
done.push(JsValue::unknown( done.push(JsValue::unknown(
......
...@@ -3813,7 +3813,10 @@ mod tests { ...@@ -3813,7 +3813,10 @@ mod tests {
graph::{ConditionalKind, Effect, EffectArg, EvalContext, VarGraph, create_graph}, graph::{ConditionalKind, Effect, EffectArg, EvalContext, VarGraph, create_graph},
linker::link, linker::link,
}; };
use crate::analyzer::imports::ImportAttributes; use crate::analyzer::{
graph::{AssignmentScopes, VarMeta},
imports::ImportAttributes,
};
#[fixture("tests/analyzer/graph/**/input.js")] #[fixture("tests/analyzer/graph/**/input.js")]
fn fixture(input: PathBuf) { fn fixture(input: PathBuf) {
...@@ -3873,13 +3876,21 @@ mod tests { ...@@ -3873,13 +3876,21 @@ mod tests {
named_values.sort_by(|a, b| a.0.cmp(&b.0)); named_values.sort_by(|a, b| a.0.cmp(&b.0));
fn explain_all<'a>( fn explain_all<'a>(
values: impl IntoIterator<Item = (&'a String, &'a JsValue)>, values: impl IntoIterator<
Item = (&'a String, &'a JsValue, Option<AssignmentScopes>),
>,
) -> String { ) -> String {
values values
.into_iter() .into_iter()
.map(|(id, value)| { .map(|(id, value, assignment_scopes)| {
let non_root_assignments = match assignment_scopes {
Some(AssignmentScopes::AllInModuleEvalScope) => {
" (const after eval)"
}
_ => "",
};
let (explainer, hints) = value.explain(10, 5); let (explainer, hints) = value.explain(10, 5);
format!("{id} = {explainer}{hints}") format!("{id}{non_root_assignments} = {explainer}{hints}")
}) })
.collect::<Vec<_>>() .collect::<Vec<_>>()
.join("\n\n") .join("\n\n")
...@@ -3895,15 +3906,24 @@ mod tests { ...@@ -3895,15 +3906,24 @@ mod tests {
"{:#?}", "{:#?}",
named_values named_values
.iter() .iter()
.map(|(name, (_, value))| (name, value)) .map(|(name, (_, VarMeta { value, .. }))| (name, value))
.collect::<Vec<_>>() .collect::<Vec<_>>()
)) ))
.compare_to_file(&graph_snapshot_path) .compare_to_file(&graph_snapshot_path)
.unwrap(); .unwrap();
} }
NormalizedOutput::from(explain_all( NormalizedOutput::from(explain_all(named_values.iter().map(
named_values.iter().map(|(name, (_, value))| (name, value)), |(
)) name,
(
_,
VarMeta {
value,
assignment_scopes,
},
),
)| (name, value, Some(*assignment_scopes)),
)))
.compare_to_file(&graph_explained_snapshot_path) .compare_to_file(&graph_explained_snapshot_path)
.unwrap(); .unwrap();
if !large { if !large {
...@@ -3947,7 +3967,8 @@ mod tests { ...@@ -3947,7 +3967,8 @@ mod tests {
} }
let start = Instant::now(); let start = Instant::now();
let explainer = explain_all(resolved.iter().map(|(name, value)| (name, value))); let explainer =
explain_all(resolved.iter().map(|(name, value)| (name, value, None)));
let time = start.elapsed(); let time = start.elapsed();
if time.as_millis() > 1 { if time.as_millis() > 1 {
println!( println!(
...@@ -4175,7 +4196,8 @@ mod tests { ...@@ -4175,7 +4196,8 @@ mod tests {
} }
let start = Instant::now(); let start = Instant::now();
let explainer = explain_all(resolved.iter().map(|(name, value)| (name, value))); let explainer =
explain_all(resolved.iter().map(|(name, value)| (name, value, None)));
let time = start.elapsed(); let time = start.elapsed();
if time.as_millis() > 1 { if time.as_millis() > 1 {
println!( println!(
......
a = (...) => undefined a (const after eval) = (...) => undefined
b = (...) => undefined b (const after eval) = (...) => undefined
c = (...) => undefined c (const after eval) = (...) => undefined
x = (1 | `${y}.js`) x = (1 | `${y}.js`)
......
x = (1 | y) x (const after eval) = (1 | y)
y = x y (const after eval) = x
z = x z (const after eval) = x
*anonymous function 170* = (...) => [file] *anonymous function 170* (const after eval) = (...) => [file]
*anonymous function 254* = (...) => FreeVar(require)["resolve"](file) *anonymous function 254* (const after eval) = (...) => FreeVar(require)["resolve"](file)
*anonymous function 88* = (...) => file *anonymous function 88* (const after eval) = (...) => file
a = ["../lib/a.js", "../lib/b.js"] a (const after eval) = ["../lib/a.js", "../lib/b.js"]
b = ["../lib/a.js", "../lib/b.js"]["map"](*anonymous function 88*) b (const after eval) = ["../lib/a.js", "../lib/b.js"]["map"](*anonymous function 88*)
c = ["../lib/a.js", "../lib/b.js"]["map"](*anonymous function 170*) c (const after eval) = ["../lib/a.js", "../lib/b.js"]["map"](*anonymous function 170*)
d = ["../lib/a.js", "../lib/b.js"]["map"](*anonymous function 254*) d (const after eval) = ["../lib/a.js", "../lib/b.js"]["map"](*anonymous function 254*)
file#3 = arguments[0] file#3 = arguments[0]
...@@ -20,4 +20,4 @@ file#5 = arguments[0] ...@@ -20,4 +20,4 @@ file#5 = arguments[0]
file#6 = arguments[0] file#6 = arguments[0]
func = (...) => FreeVar(require)["resolve"](file) func (const after eval) = (...) => FreeVar(require)["resolve"](file)
a = 1 a (const after eval) = 1
b = "foo" b (const after eval) = "foo"
c = [1, "foo"][FreeVar(global)["index"]] c (const after eval) = [1, "foo"][FreeVar(global)["index"]]
d1 = [1, "foo"] d1 (const after eval) = [1, "foo"]
d2 = d1[FreeVar(global)["index"]] d2 (const after eval) = d1[FreeVar(global)["index"]]
d3 = d1[1] d3 (const after eval) = d1[1]
d4 = d1[2] d4 (const after eval) = d1[2]
value#3 = Iterated(d1) value#3 (const after eval) = Iterated(d1)
value#5 = Iterated([]) value#5 (const after eval) = Iterated([])
*anonymous function 116* = (...) => 3 *anonymous function 116* (const after eval) = (...) => 3
*anonymous function 339* = (...) => 3 *anonymous function 339* = (...) => 3
*arrow function 11* = (...) => 1 *arrow function 11* (const after eval) = (...) => 1
*arrow function 214* = (...) => 1 *arrow function 214* = (...) => 1
...@@ -12,27 +12,27 @@ ...@@ -12,27 +12,27 @@
*arrow function 299* = (...) => 2 *arrow function 299* = (...) => 2
*arrow function 30* = (...) => 2 *arrow function 30* (const after eval) = (...) => 2
*arrow function 50* = (...) => 1 *arrow function 50* (const after eval) = (...) => 1
*arrow function 83* = (...) => 2 *arrow function 83* (const after eval) = (...) => 2
a = *arrow function 11* a (const after eval) = *arrow function 11*
b = *arrow function 30* b (const after eval) = *arrow function 30*
c = *arrow function 50* c (const after eval) = *arrow function 50*
d = *arrow function 83* d (const after eval) = *arrow function 83*
e#2 = *anonymous function 116* e#2 (const after eval) = *anonymous function 116*
e#6 = (...) => 4 e#6 (const after eval) = (...) => 4
f = e f (const after eval) = e
x = (...) => undefined x (const after eval) = (...) => undefined
xa = *arrow function 214* xa = *arrow function 214*
......
a = ("" | `${a}x`) a (const after eval) = ("" | `${a}x`)
b = (0 | ???*0*) b (const after eval) = (0 | ???*0*)
- *0* unsupported assign operation - *0* unsupported assign operation
⚠️ This value might have side effects ⚠️ This value might have side effects
c = (0 | ???*0*) c (const after eval) = (0 | ???*0*)
- *0* updated with update expression - *0* updated with update expression
⚠️ This value might have side effects ⚠️ This value might have side effects
d = (0 | 1) d (const after eval) = (0 | 1)
e = (1 | 2) e (const after eval) = (1 | 2)
f = (1 | 2) f (const after eval) = (1 | 2)
computeAsyncValue = (...) => Promise<"async result"> computeAsyncValue (const after eval) = (...) => Promise<"async result">
ensureAsyncProcessStarted = (...) => lasyInitAsyncProcess ensureAsyncProcessStarted (const after eval) = (...) => lasyInitAsyncProcess
getLasyInitAsyncValue = (...) => lasyInitAsyncValue getLasyInitAsyncValue (const after eval) = (...) => lasyInitAsyncValue
initLasyInitAsyncProcess = (...) => Promise<undefined> initLasyInitAsyncProcess (const after eval) = (...) => Promise<undefined>
lasyInitAsyncProcess = (null | initLasyInitAsyncProcess()) lasyInitAsyncProcess = (null | initLasyInitAsyncProcess())
......
*arrow function 138* = (...) => undefined *arrow function 138* = (...) => undefined
BaseClass = ???*0* BaseClass (const after eval) = ???*0*
- *0* unsupported expression - *0* unsupported expression
⚠️ This value might have side effects ⚠️ This value might have side effects
SubClass = ???*0* SubClass (const after eval) = ???*0*
- *0* unsupported expression - *0* unsupported expression
⚠️ This value might have side effects ⚠️ This value might have side effects
......
a = "" a (const after eval) = ""
b = "hello" b (const after eval) = "hello"
c = "--service=0.14.12" c (const after eval) = "--service=0.14.12"
d = "--service=0.14.12" d (const after eval) = "--service=0.14.12"
a = FreeVar(import)("a") a (const after eval) = FreeVar(import)("a")
b = (???*0* | FreeVar(import)("a") | FreeVar(import)("b")) b (const after eval) = (???*0* | FreeVar(import)("a") | FreeVar(import)("b"))
- *0* b - *0* b
⚠️ pattern without value ⚠️ pattern without value
c = FreeVar(import)( c (const after eval) = FreeVar(import)(
((FreeVar(process)["env"]["NEXT_RUNTIME"] === "edge") ? "next/dist/compiled/@vercel/og/index.edge.js" : "next/dist/compiled/@vercel/og/index.node.js") ((FreeVar(process)["env"]["NEXT_RUNTIME"] === "edge") ? "next/dist/compiled/@vercel/og/index.edge.js" : "next/dist/compiled/@vercel/og/index.node.js")
) )
earlyExit = (...) => (hoisted | undefined) earlyExit (const after eval) = (...) => (hoisted | undefined)
hoisted = (...) => undefined hoisted = (...) => undefined
*arrow function 425* = (...) => *arrow function 431* *arrow function 425* (const after eval) = (...) => *arrow function 431*
*arrow function 431* = (...) => *arrow function 437* *arrow function 431* = (...) => *arrow function 437*
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
*arrow function 449* = (...) => 1 *arrow function 449* = (...) => 1
*arrow function 468* = (...) => *arrow function 474* *arrow function 468* (const after eval) = (...) => *arrow function 474*
*arrow function 474* = (...) => *arrow function 480* *arrow function 474* = (...) => *arrow function 480*
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
*arrow function 492* = (...) => 2 *arrow function 492* = (...) => 2
*arrow function 511* = (...) => *arrow function 517* *arrow function 511* (const after eval) = (...) => *arrow function 517*
*arrow function 517* = (...) => *arrow function 523* *arrow function 517* = (...) => *arrow function 523*
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
*arrow function 535* = (...) => 2 *arrow function 535* = (...) => 2
*arrow function 554* = (...) => *arrow function 560* *arrow function 554* (const after eval) = (...) => *arrow function 560*
*arrow function 560* = (...) => *arrow function 566* *arrow function 560* = (...) => *arrow function 566*
...@@ -38,13 +38,13 @@ ...@@ -38,13 +38,13 @@
*arrow function 578* = (...) => 1 *arrow function 578* = (...) => 1
a = (1 | 2 | 3 | b) a (const after eval) = (1 | 2 | 3 | b)
b = (4 | 5 | 6 | c) b (const after eval) = (4 | 5 | 6 | c)
c = (7 | 8 | 9 | a) c (const after eval) = (7 | 8 | 9 | a)
d = ( d (const after eval) = (
| f11 | f11
| f22 | f22
| f32 | f32
...@@ -68,122 +68,122 @@ d = ( ...@@ -68,122 +68,122 @@ d = (
| fl2 | fl2
) )
f11 = (*arrow function 425* | *arrow function 468*) f11 (const after eval) = (*arrow function 425* | *arrow function 468*)
f12 = (*arrow function 511* | *arrow function 554*) f12 (const after eval) = (*arrow function 511* | *arrow function 554*)
f21 = (f11 | f12) f21 (const after eval) = (f11 | f12)
f22 = (f12 | f11) f22 (const after eval) = (f12 | f11)
f31 = (f21 | f22) f31 (const after eval) = (f21 | f22)
f32 = (f22 | f21) f32 (const after eval) = (f22 | f21)
f41 = (f31 | f32) f41 (const after eval) = (f31 | f32)
f42 = (f32 | f31) f42 (const after eval) = (f32 | f31)
f51 = (f41 | f42) f51 (const after eval) = (f41 | f42)
f52 = (f42 | f41) f52 (const after eval) = (f42 | f41)
f61 = (f51 | f52) f61 (const after eval) = (f51 | f52)
f62 = (f52 | f51) f62 (const after eval) = (f52 | f51)
f71 = (f61 | f62) f71 (const after eval) = (f61 | f62)
f72 = (f62 | f61) f72 (const after eval) = (f62 | f61)
f81 = (f71 | f72) f81 (const after eval) = (f71 | f72)
f82 = (f72 | f71) f82 (const after eval) = (f72 | f71)
f91 = (f81 | f82) f91 (const after eval) = (f81 | f82)
f92 = (f82 | f81) f92 (const after eval) = (f82 | f81)
fa1 = (f91 | f92) fa1 (const after eval) = (f91 | f92)
fa2 = (f92 | f91) fa2 (const after eval) = (f92 | f91)
fb1 = (fa1 | fa2) fb1 (const after eval) = (fa1 | fa2)
fb2 = (fa2 | fa1) fb2 (const after eval) = (fa2 | fa1)
fc1 = (fb1 | fb2) fc1 (const after eval) = (fb1 | fb2)
fc2 = (fb2 | fb1) fc2 (const after eval) = (fb2 | fb1)
fd1 = (fc1 | fc2) fd1 (const after eval) = (fc1 | fc2)
fd2 = (fc2 | fc1) fd2 (const after eval) = (fc2 | fc1)
fe1 = (fd1 | fd2) fe1 (const after eval) = (fd1 | fd2)
fe2 = (fd2 | fd1) fe2 (const after eval) = (fd2 | fd1)
ff1 = (fe1 | fe2) ff1 (const after eval) = (fe1 | fe2)
ff2 = (fe2 | fe1) ff2 (const after eval) = (fe2 | fe1)
fg1 = (ff1 | ff2) fg1 (const after eval) = (ff1 | ff2)
fg2 = (ff2 | ff1) fg2 (const after eval) = (ff2 | ff1)
fh1 = (fg1 | fg2) fh1 (const after eval) = (fg1 | fg2)
fh2 = (fg2 | fg1) fh2 (const after eval) = (fg2 | fg1)
fi1 = (fh1 | fh2) fi1 (const after eval) = (fh1 | fh2)
fi2 = (fh2 | fh1) fi2 (const after eval) = (fh2 | fh1)
fj1 = (fi1 | fi2) fj1 (const after eval) = (fi1 | fi2)
fj2 = (fi2 | fi1) fj2 (const after eval) = (fi2 | fi1)
fk1 = (fj1 | fj2) fk1 (const after eval) = (fj1 | fj2)
fk2 = (fj2 | fj1) fk2 (const after eval) = (fj2 | fj1)
fl1 = (fk1 | fk2) fl1 (const after eval) = (fk1 | fk2)
fl2 = (fk2 | fk1) fl2 (const after eval) = (fk2 | fk1)
x = (a | b | c) x (const after eval) = (a | b | c)
x1 = (x1 | x2 | x3 | x4 | x5 | x6) x1 (const after eval) = (x1 | x2 | x3 | x4 | x5 | x6)
x2 = (x1 | x2 | x3 | x4 | x5 | x6) x2 (const after eval) = (x1 | x2 | x3 | x4 | x5 | x6)
x3 = (x1 | x2 | x3 | x4 | x5 | x6) x3 (const after eval) = (x1 | x2 | x3 | x4 | x5 | x6)
x4 = (x1 | x2 | x3 | x4 | x5 | x6) x4 (const after eval) = (x1 | x2 | x3 | x4 | x5 | x6)
x5 = (x1 | x2 | x3 | x4 | x5 | x6) x5 (const after eval) = (x1 | x2 | x3 | x4 | x5 | x6)
x6 = (x1 | x2 | x3 | x4 | x5 | x6) x6 (const after eval) = (x1 | x2 | x3 | x4 | x5 | x6)
y = (a | b | c | x) y (const after eval) = (a | b | c | x)
z = (a | b | c | y) z (const after eval) = (a | b | c | y)
z1 = z z1 (const after eval) = z
z2 = z1 z2 (const after eval) = z1
z3 = z2 z3 (const after eval) = z2
z4 = z3 z4 (const after eval) = z3
z5 = z4 z5 (const after eval) = z4
z6 = z5 z6 (const after eval) = z5
z7 = z6 z7 (const after eval) = z6
z8 = z7 z8 (const after eval) = z7
z9 = z8 z9 (const after eval) = z8
*anonymous function 25* = (...) => undefined *anonymous function 25* (const after eval) = (...) => undefined
a = (...) => undefined a (const after eval) = (...) => undefined
aa = a aa (const after eval) = a
b = *anonymous function 25* b (const after eval) = *anonymous function 25*
bb = b bb (const after eval) = b
c = 123 c (const after eval) = 123
cc = c cc (const after eval) = c
d = "hello" d (const after eval) = "hello"
dd = d dd (const after eval) = d
e = ???*0* e (const after eval) = ???*0*
- *0* unsupported expression - *0* unsupported expression
⚠️ This value might have side effects ⚠️ This value might have side effects
ee = e ee (const after eval) = e
ff = FreeVar(f) ff (const after eval) = FreeVar(f)
*arrow function 105* = (...) => value2 *arrow function 105* (const after eval) = (...) => value2
Fun = (...) => value Fun (const after eval) = (...) => value
Fun2 = *arrow function 105* Fun2 (const after eval) = *arrow function 105*
value = (arguments[0]["value"] | module<./module.js, {}>["named"]) value = (arguments[0]["value"] | module<./module.js, {}>["named"])
......
a = (...) => undefined a (const after eval) = (...) => undefined
b = (...) => undefined b (const after eval) = (...) => undefined
c = (...) => undefined c (const after eval) = (...) => undefined
d = (...) => undefined d (const after eval) = (...) => undefined
e = (...) => undefined e (const after eval) = (...) => undefined
f = (...) => undefined f (const after eval) = (...) => undefined
g = (...) => undefined g (const after eval) = (...) => undefined
h = (...) => undefined h (const after eval) = (...) => undefined
i = (...) => (FreeVar(i1)() | FreeVar(i2)()) i (const after eval) = (...) => (FreeVar(i1)() | FreeVar(i2)())
j#2 = (...) => (FreeVar(i1)() | FreeVar(i2)()) j#2 (const after eval) = (...) => (FreeVar(i1)() | FreeVar(i2)())
j#25 = arguments[0] j#25 = arguments[0]
......
...@@ -6,17 +6,17 @@ e = ???*0* ...@@ -6,17 +6,17 @@ e = ???*0*
- *0* e - *0* e
⚠️ pattern without value ⚠️ pattern without value
generateBinPath = (...) => binPath generateBinPath (const after eval) = (...) => binPath
knownWindowsPackages = { knownWindowsPackages (const after eval) = {
"win32 arm64 LE": "esbuild-windows-arm64", "win32 arm64 LE": "esbuild-windows-arm64",
"win32 ia32 LE": "esbuild-windows-32", "win32 ia32 LE": "esbuild-windows-32",
"win32 x64 LE": "esbuild-windows-64" "win32 x64 LE": "esbuild-windows-64"
} }
path = FreeVar(require)("path") path (const after eval) = FreeVar(require)("path")
path2 = FreeVar(require)("path") path2 (const after eval) = FreeVar(require)("path")
pkg#3 = (???*0* | knownWindowsPackages[FreeVar(platformKey)]) pkg#3 = (???*0* | knownWindowsPackages[FreeVar(platformKey)])
- *0* pkg - *0* pkg
...@@ -24,7 +24,7 @@ pkg#3 = (???*0* | knownWindowsPackages[FreeVar(platformKey)]) ...@@ -24,7 +24,7 @@ pkg#3 = (???*0* | knownWindowsPackages[FreeVar(platformKey)])
pkg#4 = pkgAndSubpathForCurrentPlatform()["pkg"] pkg#4 = pkgAndSubpathForCurrentPlatform()["pkg"]
pkgAndSubpathForCurrentPlatform = (...) => {"pkg": pkg, "subpath": subpath} pkgAndSubpathForCurrentPlatform (const after eval) = (...) => {"pkg": pkg, "subpath": subpath}
subpath#3 = (???*0* | "esbuild.exe") subpath#3 = (???*0* | "esbuild.exe")
- *0* subpath - *0* subpath
...@@ -32,4 +32,4 @@ subpath#3 = (???*0* | "esbuild.exe") ...@@ -32,4 +32,4 @@ subpath#3 = (???*0* | "esbuild.exe")
subpath#4 = pkgAndSubpathForCurrentPlatform()["subpath"] subpath#4 = pkgAndSubpathForCurrentPlatform()["subpath"]
x = generateBinPath() x (const after eval) = generateBinPath()
*arrow function 2666* = (...) => ( *arrow function 2666* (const after eval) = (...) => (
| [ | [
"node", "node",
[ [
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
| [generateBinPath(), []] | [generateBinPath(), []]
) )
args = esbuildCommandAndArgs()[1] args (const after eval) = esbuildCommandAndArgs()[1]
binPath = ( binPath = (
| ???*0* | ???*0*
...@@ -20,7 +20,7 @@ binPath = ( ...@@ -20,7 +20,7 @@ binPath = (
binTargetPath = path["join"](esbuildLibDir, `pnpapi-${pkg}-${path["basename"](subpath)}`) binTargetPath = path["join"](esbuildLibDir, `pnpapi-${pkg}-${path["basename"](subpath)}`)
command = esbuildCommandAndArgs()[0] command (const after eval) = esbuildCommandAndArgs()[0]
e#10 = ???*0* e#10 = ???*0*
- *0* e - *0* e
...@@ -30,15 +30,15 @@ e#15 = ???*0* ...@@ -30,15 +30,15 @@ e#15 = ???*0*
- *0* e - *0* e
⚠️ pattern without value ⚠️ pattern without value
esbuildCommandAndArgs = *arrow function 2666* esbuildCommandAndArgs (const after eval) = *arrow function 2666*
esbuildLibDir = path["dirname"](FreeVar(require)["resolve"]("esbuild")) esbuildLibDir = path["dirname"](FreeVar(require)["resolve"]("esbuild"))
generateBinPath = (...) => (FreeVar(ESBUILD_BINARY_PATH) | binTargetPath | binPath) generateBinPath (const after eval) = (...) => (FreeVar(ESBUILD_BINARY_PATH) | binTargetPath | binPath)
isYarnPnP = (false | true) isYarnPnP = (false | true)
knownUnixlikePackages = { knownUnixlikePackages (const after eval) = {
"android arm64 LE": "esbuild-android-arm64", "android arm64 LE": "esbuild-android-arm64",
"darwin arm64 LE": "esbuild-darwin-arm64", "darwin arm64 LE": "esbuild-darwin-arm64",
"darwin x64 LE": "esbuild-darwin-64", "darwin x64 LE": "esbuild-darwin-64",
...@@ -56,17 +56,17 @@ knownUnixlikePackages = { ...@@ -56,17 +56,17 @@ knownUnixlikePackages = {
"sunos x64 LE": "esbuild-sunos-64" "sunos x64 LE": "esbuild-sunos-64"
} }
knownWindowsPackages = { knownWindowsPackages (const after eval) = {
"win32 arm64 LE": "esbuild-windows-arm64", "win32 arm64 LE": "esbuild-windows-arm64",
"win32 ia32 LE": "esbuild-windows-32", "win32 ia32 LE": "esbuild-windows-32",
"win32 x64 LE": "esbuild-windows-64" "win32 x64 LE": "esbuild-windows-64"
} }
os = FreeVar(require)("os") os (const after eval) = FreeVar(require)("os")
path = FreeVar(require)("path") path (const after eval) = FreeVar(require)("path")
path2 = FreeVar(require)("path") path2 (const after eval) = FreeVar(require)("path")
pkg#3 = (???*0* | knownWindowsPackages[platformKey] | knownUnixlikePackages[platformKey]) pkg#3 = (???*0* | knownWindowsPackages[platformKey] | knownUnixlikePackages[platformKey])
- *0* pkg - *0* pkg
...@@ -74,7 +74,7 @@ pkg#3 = (???*0* | knownWindowsPackages[platformKey] | knownUnixlikePackages[plat ...@@ -74,7 +74,7 @@ pkg#3 = (???*0* | knownWindowsPackages[platformKey] | knownUnixlikePackages[plat
pkg#7 = pkgAndSubpathForCurrentPlatform()["pkg"] pkg#7 = pkgAndSubpathForCurrentPlatform()["pkg"]
pkgAndSubpathForCurrentPlatform = (...) => {"pkg": pkg, "subpath": subpath} pkgAndSubpathForCurrentPlatform (const after eval) = (...) => {"pkg": pkg, "subpath": subpath}
platformKey = `${FreeVar(process)["platform"]} ${os["arch"]()} ${os["endianness"]()}` platformKey = `${FreeVar(process)["platform"]} ${os["arch"]()} ${os["endianness"]()}`
...@@ -84,4 +84,4 @@ subpath#3 = (???*0* | "esbuild.exe" | "bin/esbuild") ...@@ -84,4 +84,4 @@ subpath#3 = (???*0* | "esbuild.exe" | "bin/esbuild")
subpath#7 = pkgAndSubpathForCurrentPlatform()["subpath"] subpath#7 = pkgAndSubpathForCurrentPlatform()["subpath"]
x = args["concat"]("--service=0.14.12", "--ping") x (const after eval) = args["concat"]("--service=0.14.12", "--ping")
...@@ -2,12 +2,12 @@ a = arguments[0] ...@@ -2,12 +2,12 @@ a = arguments[0]
b = arguments[1] b = arguments[1]
c = (...) => [`${a}${x}`, a] c (const after eval) = (...) => [`${a}${x}`, a]
d = c("1", "2") d (const after eval) = c("1", "2")
e = d[0] e (const after eval) = d[0]
f = d[1] f (const after eval) = d[1]
x = b x = b
...@@ -2,10 +2,10 @@ a = arguments[0] ...@@ -2,10 +2,10 @@ a = arguments[0]
b = arguments[1] b = arguments[1]
c = (...) => [`${a}${b}`, a] c (const after eval) = (...) => [`${a}${b}`, a]
d = c("1", "2") d (const after eval) = c("1", "2")
e = d[0] e (const after eval) = d[0]
f = d[1] f (const after eval) = d[1]
buf = FreeVar(Buffer)["from"]("Hello World") buf (const after eval) = FreeVar(Buffer)["from"]("Hello World")
_ = (...) => parent _ (const after eval) = (...) => parent
i = (0 | ???*0*) i = (0 | ???*0*)
- *0* updated with update expression - *0* updated with update expression
...@@ -14,4 +14,4 @@ parent = arguments[2] ...@@ -14,4 +14,4 @@ parent = arguments[2]
path = arguments[1] path = arguments[1]
root = {} root (const after eval) = {}
a = FreeVar(require) a (const after eval) = FreeVar(require)
b = a b = a
......
x = import.meta*0*["prop"] x (const after eval) = import.meta*0*["prop"]
- *0* import.meta: The import.meta object - *0* import.meta: The import.meta object
aa = module<x2, {}>["a"] aa (const after eval) = module<x2, {}>["a"]
xx = module<x1, {}>["default"] xx (const after eval) = module<x1, {}>["default"]
yy = module<x3, {}> yy (const after eval) = module<x3, {}>
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
*arrow function 471* = (...) => undefined *arrow function 471* = (...) => undefined
HelloWorld = ???*0* HelloWorld (const after eval) = ???*0*
- *0* unsupported expression - *0* unsupported expression
⚠️ This value might have side effects ⚠️ This value might have side effects
Home = (...) => module<https://esm.sh/preact/jsx-runtime, {}>["jsx"]( Home (const after eval) = (...) => module<https://esm.sh/preact/jsx-runtime, {}>["jsx"](
"button", "button",
{"onClick": *arrow function 362*, "children": "Click me"} {"onClick": *arrow function 362*, "children": "Click me"}
) )
......
runGetClassesOrUseCache = (...) => ("value a" | "value b") runGetClassesOrUseCache (const after eval) = (...) => ("value a" | "value b")
*arrow function 19* = (...) => false *arrow function 19* (const after eval) = (...) => false
run = (...) => ("should not run" | "should run") run (const after eval) = (...) => ("should not run" | "should run")
shouldRun = *arrow function 19* shouldRun (const after eval) = *arrow function 19*
x = (true | undefined) x = (true | undefined)
a = (x && y) a (const after eval) = (x && y)
b = (x || y) b (const after eval) = (x || y)
c = (x ?? y) c (const after eval) = (x ?? y)
chain1 = (1 && 2 && 3 && FreeVar(global)) chain1 (const after eval) = (1 && 2 && 3 && FreeVar(global))
chain2 = ((1 && 2 && FreeVar(global)) || 3 || 4) chain2 (const after eval) = ((1 && 2 && FreeVar(global)) || 3 || 4)
d = !(x) d (const after eval) = !(x)
e = !(!(x)) e (const after eval) = !(!(x))
resolve1 = (1 && 2 && FreeVar(global) && 3 && 4) resolve1 (const after eval) = (1 && 2 && FreeVar(global) && 3 && 4)
resolve2 = (1 && 2 && 0 && FreeVar(global) && 4) resolve2 (const after eval) = (1 && 2 && 0 && FreeVar(global) && 4)
resolve3 = (FreeVar(global) || true) resolve3 (const after eval) = (FreeVar(global) || true)
resolve4 = (true || FreeVar(global)) resolve4 (const after eval) = (true || FreeVar(global))
resolve5 = (FreeVar(global) && false) resolve5 (const after eval) = (FreeVar(global) && false)
resolve6 = (false && FreeVar(global)) resolve6 (const after eval) = (false && FreeVar(global))
x = true x (const after eval) = true
y = false y (const after eval) = false
...@@ -74,7 +74,7 @@ i = (???*0* | 0 | (i + 16)) ...@@ -74,7 +74,7 @@ i = (???*0* | 0 | (i + 16))
len = arguments[1] len = arguments[1]
md5cmn = (...) => FreeVar(safeAdd)( md5cmn (const after eval) = (...) => FreeVar(safeAdd)(
FreeVar(bitRotateLeft)( FreeVar(bitRotateLeft)(
FreeVar(safeAdd)(FreeVar(safeAdd)(a, q), FreeVar(safeAdd)(x, t)), FreeVar(safeAdd)(FreeVar(safeAdd)(a, q), FreeVar(safeAdd)(x, t)),
s s
...@@ -82,7 +82,7 @@ md5cmn = (...) => FreeVar(safeAdd)( ...@@ -82,7 +82,7 @@ md5cmn = (...) => FreeVar(safeAdd)(
b b
) )
md5ff = (...) => md5cmn(???*0*, a, b, x, s, t) md5ff (const after eval) = (...) => md5cmn(???*0*, a, b, x, s, t)
- *0* unsupported expression - *0* unsupported expression
⚠️ This value might have side effects ⚠️ This value might have side effects
...@@ -112,7 +112,7 @@ t#5 = arguments[5] ...@@ -112,7 +112,7 @@ t#5 = arguments[5]
t#6 = arguments[6] t#6 = arguments[6]
wordsToMd5 = (...) => [a, b, c, d] wordsToMd5 (const after eval) = (...) => [a, b, c, d]
x#3 = arguments[0] x#3 = arguments[0]
......
...@@ -106,13 +106,13 @@ b#7 = ( ...@@ -106,13 +106,13 @@ b#7 = (
- *12* unsupported expression - *12* unsupported expression
⚠️ This value might have side effects ⚠️ This value might have side effects
bitRotateLeft = (...) => ???*0* bitRotateLeft (const after eval) = (...) => ???*0*
- *0* unsupported expression - *0* unsupported expression
⚠️ This value might have side effects ⚠️ This value might have side effects
bytes = (arguments[0] | new FreeVar(Array)(msg["length"])) bytes = (arguments[0] | new FreeVar(Array)(msg["length"]))
bytesToWords = (...) => output bytesToWords (const after eval) = (...) => output
c#15 = arguments[2] c#15 = arguments[2]
...@@ -272,30 +272,30 @@ lsw = (???*0* + ???*1*) ...@@ -272,30 +272,30 @@ lsw = (???*0* + ???*1*)
- *1* unsupported expression - *1* unsupported expression
⚠️ This value might have side effects ⚠️ This value might have side effects
md5 = (...) => md5ToHexEncodedArray(wordsToMd5(bytesToWords(bytes), ???*0*)) md5 (const after eval) = (...) => md5ToHexEncodedArray(wordsToMd5(bytesToWords(bytes), ???*0*))
- *0* unsupported expression - *0* unsupported expression
⚠️ This value might have side effects ⚠️ This value might have side effects
md5ToHexEncodedArray = (...) => output md5ToHexEncodedArray (const after eval) = (...) => output
md5cmn = (...) => safeAdd( md5cmn (const after eval) = (...) => safeAdd(
bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s),
b b
) )
md5ff = (...) => md5cmn(???*0*, a, b, x, s, t) md5ff (const after eval) = (...) => md5cmn(???*0*, a, b, x, s, t)
- *0* unsupported expression - *0* unsupported expression
⚠️ This value might have side effects ⚠️ This value might have side effects
md5gg = (...) => md5cmn(???*0*, a, b, x, s, t) md5gg (const after eval) = (...) => md5cmn(???*0*, a, b, x, s, t)
- *0* unsupported expression - *0* unsupported expression
⚠️ This value might have side effects ⚠️ This value might have side effects
md5hh = (...) => md5cmn(???*0*, a, b, x, s, t) md5hh (const after eval) = (...) => md5cmn(???*0*, a, b, x, s, t)
- *0* unsupported expression - *0* unsupported expression
⚠️ This value might have side effects ⚠️ This value might have side effects
md5ii = (...) => md5cmn(???*0*, a, b, x, s, t) md5ii (const after eval) = (...) => md5cmn(???*0*, a, b, x, s, t)
- *0* unsupported expression - *0* unsupported expression
⚠️ This value might have side effects ⚠️ This value might have side effects
...@@ -346,7 +346,7 @@ s#17 = arguments[5] ...@@ -346,7 +346,7 @@ s#17 = arguments[5]
s#18 = arguments[5] s#18 = arguments[5]
safeAdd = (...) => ???*0* safeAdd (const after eval) = (...) => ???*0*
- *0* unsupported expression - *0* unsupported expression
⚠️ This value might have side effects ⚠️ This value might have side effects
...@@ -360,7 +360,7 @@ t#17 = arguments[6] ...@@ -360,7 +360,7 @@ t#17 = arguments[6]
t#18 = arguments[6] t#18 = arguments[6]
wordsToMd5 = (...) => [a, b, c, d] wordsToMd5 (const after eval) = (...) => [a, b, c, d]
x#12 = arguments[0] x#12 = arguments[0]
......
array = [1, 2, 3] array (const after eval) = [1, 2, 3]
arrays = ([1, 2, 3] | [4, 5, 6]) arrays (const after eval) = ([1, 2, 3] | [4, 5, 6])
concatenated_array = array["concat"](4, 5, 6, [7, 8, 9], `hello ${item}`) concatenated_array (const after eval) = array["concat"](4, 5, 6, [7, 8, 9], `hello ${item}`)
concatenated_array_options = array["concat"]([7, 8, 9]) concatenated_array_options (const after eval) = array["concat"]([7, 8, 9])
item = array[1] item (const after eval) = array[1]
item_options = arrays[1] item_options (const after eval) = arrays[1]
pick_array1 = [[1, 2, 3]][0]["concat"]([4, 5, 6, FreeVar(unknown)]) pick_array1 (const after eval) = [[1, 2, 3]][0]["concat"]([4, 5, 6, FreeVar(unknown)])
pick_array2 = [[1, 2, 3]][0]["concat"](4, 5, 6, FreeVar(unknown)) pick_array2 (const after eval) = [[1, 2, 3]][0]["concat"](4, 5, 6, FreeVar(unknown))
Collection = FreeVar(require)(`${driver}/collection`) Collection (const after eval) = FreeVar(require)(`${driver}/collection`)
Connection = FreeVar(require)(`${driver}/connection`) Connection (const after eval) = FreeVar(require)(`${driver}/connection`)
driver = (FreeVar(global)["MONGOOSE_DRIVER_PATH"] || "./drivers/node-mongodb-native") driver (const after eval) = (FreeVar(global)["MONGOOSE_DRIVER_PATH"] || "./drivers/node-mongodb-native")
...@@ -10,16 +10,16 @@ b#5 = arguments[0] ...@@ -10,16 +10,16 @@ b#5 = arguments[0]
inner = (...) => (a + b) inner = (...) => (a + b)
outer = (...) => inner("b") outer (const after eval) = (...) => inner("b")
r = (...) => (a | (r((a + 1)) + 1)) r (const after eval) = (...) => (a | (r((a + 1)) + 1))
v1 = x(1)(2) v1 (const after eval) = x(1)(2)
v2 = r(2) v2 (const after eval) = r(2)
v3 = outer("a") v3 (const after eval) = outer("a")
x = (...) => y x (const after eval) = (...) => y
y = (...) => (a + b) y = (...) => (a + b)
*anonymous function 66* = (...) => undefined *anonymous function 66* (const after eval) = (...) => undefined
*arrow function 118* = (...) => undefined *arrow function 118* (const after eval) = (...) => undefined
*arrow function 229* = (...) => undefined *arrow function 229* (const after eval) = (...) => undefined
a = (...) => undefined a (const after eval) = (...) => undefined
b = *anonymous function 66* b (const after eval) = *anonymous function 66*
c = *arrow function 118* c (const after eval) = *arrow function 118*
d = ???*0* d (const after eval) = ???*0*
- *0* unsupported expression - *0* unsupported expression
⚠️ This value might have side effects ⚠️ This value might have side effects
e = (...) => undefined e (const after eval) = (...) => undefined
f = e f (const after eval) = e
x#3 = 1 x#3 = 1
......
asset = new FreeVar(URL)("./worker.ts", import.meta*0*["url"]) asset (const after eval) = new FreeVar(URL)("./worker.ts", import.meta*0*["url"])
- *0* import.meta: The import.meta object - *0* import.meta: The import.meta object
[
FreeVar {
var: "d1",
ast_path: [
Program(
Module,
),
Module(
Body(
3,
),
),
ModuleItem(
Stmt,
),
Stmt(
For,
),
ForStmt(
Body,
),
Stmt(
Block,
),
BlockStmt(
Stmts(
0,
),
),
Stmt(
Expr,
),
ExprStmt(
Expr,
),
Expr(
Assign,
),
AssignExpr(
Left,
),
AssignTarget(
Simple,
),
SimpleAssignTarget(
Ident,
),
BindingIdent(
Id,
),
],
span: 342..344,
},
FreeVar {
var: "e4",
ast_path: [
Program(
Module,
),
Module(
Body(
9,
),
),
ModuleItem(
ModuleDecl,
),
ModuleDecl(
ExportNamed,
),
NamedExport(
Specifiers(
0,
),
),
ExportSpecifier(
Named,
),
ExportNamedSpecifier(
Exported,
),
ModuleExportName(
Ident,
),
],
span: 814..816,
},
FreeVar {
var: "setTimeout",
ast_path: [
Program(
Module,
),
Module(
Body(
11,
),
),
ModuleItem(
Stmt,
),
Stmt(
Expr,
),
ExprStmt(
Expr,
),
Expr(
Call,
),
CallExpr(
Callee,
),
Callee(
Expr,
),
Expr(
Ident,
),
],
span: 896..906,
},
Call {
func: FreeVar(
"setTimeout",
),
args: [
Closure(
Variable(
(
"*arrow function 907*",
#0,
),
),
EffectsBlock {
effects: [],
range: Exact(
[
Program(
Module,
),
Module(
Body(
11,
),
),
ModuleItem(
Stmt,
),
Stmt(
Expr,
),
ExprStmt(
Expr,
),
Expr(
Call,
),
CallExpr(
Args(
0,
),
),
ExprOrSpread(
Expr,
),
Expr(
Arrow,
),
ArrowExpr(
Body,
),
BlockStmtOrExpr(
BlockStmt,
),
],
),
},
),
Value(
Constant(
Num(
ConstantNumber(
1.0,
),
),
),
),
],
ast_path: [
Program(
Module,
),
Module(
Body(
11,
),
),
ModuleItem(
Stmt,
),
Stmt(
Expr,
),
ExprStmt(
Expr,
),
Expr(
Call,
),
],
span: 896..964,
in_try: false,
new: false,
},
]
*arrow function 907* (const after eval) = (...) => undefined
ConstAfterEvalClass (const after eval) = ???*0*
- *0* unsupported expression
⚠️ This value might have side effects
d1 (const after eval) = 2
default_function_export_const_after_eval (const after eval) = (...) => undefined
i (const after eval) = (0 | ???*0*)
- *0* updated with update expression
⚠️ This value might have side effects
named_const_export_const_after_eval (const after eval) = 3
named_function_export_const_after_eval (const after eval) = ((...) => undefined | 2)
named_let_export_const_after_eval (const after eval) = 2
named_let_export_const_after_eval_2 (const after eval) = (???*0* | 5)
- *0* named_let_export_const_after_eval_2
⚠️ pattern without value
named_let_export_not_const_after_eval = (1 | 5)
named_let_export_not_const_after_eval_2 = (1 | 3)
[
(
"*arrow function 907*",
Function(
2,
907,
Constant(
Undefined,
),
),
),
(
"ConstAfterEvalClass",
Unknown {
original_value: None,
reason: "unsupported expression",
has_side_effects: true,
},
),
(
"d1",
Constant(
Num(
ConstantNumber(
2.0,
),
),
),
),
(
"default_function_export_const_after_eval",
Function(
2,
251,
Constant(
Undefined,
),
),
),
(
"i",
Alternatives {
total_nodes: 3,
values: [
Constant(
Num(
ConstantNumber(
0.0,
),
),
),
Unknown {
original_value: None,
reason: "updated with update expression",
has_side_effects: true,
},
],
logical_property: None,
},
),
(
"named_const_export_const_after_eval",
Constant(
Num(
ConstantNumber(
3.0,
),
),
),
),
(
"named_function_export_const_after_eval",
Alternatives {
total_nodes: 4,
values: [
Function(
2,
65,
Constant(
Undefined,
),
),
Constant(
Num(
ConstantNumber(
2.0,
),
),
),
],
logical_property: None,
},
),
(
"named_let_export_const_after_eval",
Constant(
Num(
ConstantNumber(
2.0,
),
),
),
),
(
"named_let_export_const_after_eval_2",
Alternatives {
total_nodes: 3,
values: [
Unknown {
original_value: Some(
Variable(
(
"named_let_export_const_after_eval_2",
#2,
),
),
),
reason: "pattern without value",
has_side_effects: false,
},
Constant(
Num(
ConstantNumber(
5.0,
),
),
),
],
logical_property: None,
},
),
(
"named_let_export_not_const_after_eval",
Alternatives {
total_nodes: 3,
values: [
Constant(
Num(
ConstantNumber(
1.0,
),
),
),
Constant(
Num(
ConstantNumber(
5.0,
),
),
),
],
logical_property: None,
},
),
(
"named_let_export_not_const_after_eval_2",
Alternatives {
total_nodes: 3,
values: [
Constant(
Num(
ConstantNumber(
1.0,
),
),
),
Constant(
Num(
ConstantNumber(
3.0,
),
),
),
],
logical_property: None,
},
),
]
// should be inferred as not having non-root assignments
export function named_function_export_const_after_eval() {
}
if (true) {
named_function_export_const_after_eval = 2
}
// should be inferred as not having non-root assignments
export default function default_function_export_const_after_eval() {
}
for (let i = 0; i < 10; i++) {
d1 = 2
}
// should be inferred as not having non-root assignments
export let named_let_export_const_after_eval = 2
// ditto
export const named_const_export_const_after_eval = 3
// should be inferred as not having non-root assignments
let named_let_export_const_after_eval_2
// should be inferred as having non-root assignments
let named_let_export_not_const_after_eval = 1
let named_let_export_not_const_after_eval_2 = 1
export {named_let_export_not_const_after_eval as e4, named_let_export_const_after_eval_2}
named_let_export_const_after_eval_2 = 5
setTimeout(() => {
named_let_export_not_const_after_eval = 5
}, 1);
export class ConstAfterEvalClass {
named_class_method_export_const_after_eval() {
named_let_export_not_const_after_eval_2=3
}
}
0 -> 1 free var = FreeVar(d1)
0 -> 2 free var = FreeVar(e4)
0 -> 3 free var = FreeVar(setTimeout)
0 -> 4 call = ???*0*((...) => undefined, 1)
- *0* FreeVar(setTimeout)
⚠️ unknown global
⚠️ This value might have side effects
*arrow function 907* = (...) => undefined
ConstAfterEvalClass = ???*0*
- *0* unsupported expression
⚠️ This value might have side effects
d1 = 2
default_function_export_const_after_eval = (...) => undefined
i = (0 | ???*0*)
- *0* updated with update expression
⚠️ This value might have side effects
named_const_export_const_after_eval = 3
named_function_export_const_after_eval = ((...) => undefined | 2)
named_let_export_const_after_eval = 2
named_let_export_const_after_eval_2 = (???*0* | 5)
- *0* named_let_export_const_after_eval_2
⚠️ pattern without value
named_let_export_not_const_after_eval = (1 | 5)
named_let_export_not_const_after_eval_2 = (1 | 3)
a = object["a"] a (const after eval) = object["a"]
a1 = object["a"] a1 (const after eval) = object["a"]
a2 = object["a"] a2 (const after eval) = object["a"]
a3 = object_spread["a"] a3 (const after eval) = object_spread["a"]
a4 = object["a"] a4 (const after eval) = object["a"]
a5 = unknown_spread["a"] a5 (const after eval) = unknown_spread["a"]
a6 = object2["a"] a6 (const after eval) = object2["a"]
b = object["b"] b (const after eval) = object["b"]
b1 = object["b"] b1 (const after eval) = object["b"]
b2 = object["b"] b2 (const after eval) = object["b"]
b3 = object_spread["b"] b3 (const after eval) = object_spread["b"]
b4 = object["b"] b4 (const after eval) = object["b"]
b5 = unknown_spread["b"] b5 (const after eval) = unknown_spread["b"]
b6 = object2["b"] b6 (const after eval) = object2["b"]
c = object["c"] c (const after eval) = object["c"]
c1 = object["c"] c1 (const after eval) = object["c"]
c2 = object["c"] c2 (const after eval) = object["c"]
c3 = object_spread["c"] c3 (const after eval) = object_spread["c"]
c4 = object["c"] c4 (const after eval) = object["c"]
c5 = unknown_spread["c"] c5 (const after eval) = unknown_spread["c"]
c6 = object2["c"] c6 (const after eval) = object2["c"]
d = object["d"] d (const after eval) = object["d"]
d1 = object["d"] d1 (const after eval) = object["d"]
d2 = object["d"] d2 (const after eval) = object["d"]
d3 = object_spread["d"] d3 (const after eval) = object_spread["d"]
d4 = object["d"] d4 (const after eval) = object["d"]
d6 = object2["d"] d6 (const after eval) = object2["d"]
e6 = object2["e"] e6 (const after eval) = object2["e"]
object = {"a": 1, "b": 2, "c": 3} object (const after eval) = {"a": 1, "b": 2, "c": 3}
object2 = {"a": 1, FreeVar(global): 2, "c": 3, FreeVar(global): 4, "e": 5} object2 (const after eval) = {"a": 1, FreeVar(global): 2, "c": 3, FreeVar(global): 4, "e": 5}
object_spread = {"a": 11, ...object, "b": 22} object_spread (const after eval) = {"a": 11, ...object, "b": 22}
unknown_spread = {"a": 1, ...FreeVar(global), "b": 2} unknown_spread (const after eval) = {"a": 1, ...FreeVar(global), "b": 2}
...@@ -12,7 +12,7 @@ clientComponentLoadTimes = (0 | (clientComponentLoadTimes + ???*0*)) ...@@ -12,7 +12,7 @@ clientComponentLoadTimes = (0 | (clientComponentLoadTimes + ???*0*))
- *0* unsupported expression - *0* unsupported expression
⚠️ This value might have side effects ⚠️ This value might have side effects
getClientComponentLoaderMetrics = (...) => metrics getClientComponentLoaderMetrics (const after eval) = (...) => metrics
metrics = ((clientComponentLoadTimes === 0) ? undefined : { metrics = ((clientComponentLoadTimes === 0) ? undefined : {
"clientComponentLoadTimes": clientComponentLoadTimes "clientComponentLoadTimes": clientComponentLoadTimes
...@@ -24,4 +24,4 @@ options = ???*0* ...@@ -24,4 +24,4 @@ options = ???*0*
startTime = FreeVar(performance)["now"]() startTime = FreeVar(performance)["now"]()
wrapClientComponentLoader = (...) => {"loadChunk": *arrow function 173*} wrapClientComponentLoader (const after eval) = (...) => {"loadChunk": *arrow function 173*}
O = FreeVar(Object) O (const after eval) = FreeVar(Object)
a = FreeVar(Object)["keys"](O) a (const after eval) = FreeVar(Object)["keys"](O)
b = O["keys"](FreeVar(Object)) b (const after eval) = O["keys"](FreeVar(Object))
Redis = ((typeof(FreeVar(EdgeRuntime)) === "undefined") ? FreeVar(require)("ioredis") : module<@upstash/redis, {}>["Redis"]) Redis (const after eval) = ((typeof(FreeVar(EdgeRuntime)) === "undefined") ? FreeVar(require)("ioredis") : module<@upstash/redis, {}>["Redis"])
err = ???*0* err (const after eval) = ???*0*
- *0* err - *0* err
⚠️ pattern without value ⚠️ pattern without value
errors = [] errors (const after eval) = []
path = Iterated(paths) path (const after eval) = Iterated(paths)
paths = [ paths (const after eval) = [
`../src/build/Release/sharp-${runtimePlatform}.node`, `../src/build/Release/sharp-${runtimePlatform}.node`,
"../src/build/Release/sharp-wasm32.node", "../src/build/Release/sharp-wasm32.node",
`@img/sharp-${runtimePlatform}/sharp.node`, `@img/sharp-${runtimePlatform}/sharp.node`,
"@img/sharp-wasm32/sharp.node" "@img/sharp-wasm32/sharp.node"
] ]
runtimePlatform = runtimePlatformArch() runtimePlatform (const after eval) = runtimePlatformArch()
runtimePlatformArch = FreeVar(require)("./libvips")["runtimePlatformArch"] runtimePlatformArch (const after eval) = FreeVar(require)("./libvips")["runtimePlatformArch"]
sharp = (???*0* | FreeVar(require)(path)) sharp (const after eval) = (???*0* | FreeVar(require)(path))
- *0* sharp - *0* sharp
⚠️ pattern without value ⚠️ pattern without value
*arrow function 24* = (...) => FreeVar(JSON)["stringify"]( *arrow function 24* (const after eval) = (...) => FreeVar(JSON)["stringify"](
{ {
"condition": (variable === "true"), "condition": (variable === "true"),
"buggedConditionalCheck": ((variable === "true") ? "true" : "false") "buggedConditionalCheck": ((variable === "true") ? "true" : "false")
} }
) )
BuggyArguments = *arrow function 24* BuggyArguments (const after eval) = *arrow function 24*
res = BuggyArguments({"variable": "false"}) res (const after eval) = BuggyArguments({"variable": "false"})
variable = (arguments[0]["variable"] | "true") variable = (arguments[0]["variable"] | "true")
a = FreeVar(require)("foo") a (const after eval) = FreeVar(require)("foo")
p1 = FreeVar(require)("path") p1 (const after eval) = FreeVar(require)("path")
path = FreeVar(require)("path") path (const after eval) = FreeVar(require)("path")
path_join1 = p1["join"] path_join1 (const after eval) = p1["join"]
path_join2 = module<path, {}>["default"]["join"] path_join2 (const after eval) = module<path, {}>["default"]["join"]
path_join3 = module<path, {}>["join"] path_join3 (const after eval) = module<path, {}>["join"]
path_join4 = await(FreeVar(import)("path"))["join"] path_join4 (const after eval) = await(FreeVar(import)("path"))["join"]
z1_joined = path["join"]("foo", "bar") z1_joined (const after eval) = path["join"]("foo", "bar")
z2_joined = path["join"]("foo/", "bar") z2_joined (const after eval) = path["join"]("foo/", "bar")
z3_joined = path["join"]("foo", "/bar") z3_joined (const after eval) = path["join"]("foo", "/bar")
z4_joined = path["join"]("foo/", "/bar") z4_joined (const after eval) = path["join"]("foo/", "/bar")
z5_joined = path["join"]("foo", "bar", "..", "baz", FreeVar(global), "..", "foo") z5_joined (const after eval) = path["join"]("foo", "bar", "..", "baz", FreeVar(global), "..", "foo")
arrPatternBool = (true | false) arrPatternBool (const after eval) = (true | false)
nestedPatternBool = ({"inner": [true]}["inner"][0] | {"inner": [false]}["inner"][0]) nestedPatternBool (const after eval) = ({"inner": [true]}["inner"][0] | {"inner": [false]}["inner"][0])
objPatternBool = ({"objPatternBool": true}["objPatternBool"] | {"objPatternBool": false}["objPatternBool"]) objPatternBool (const after eval) = ({"objPatternBool": true}["objPatternBool"] | {"objPatternBool": false}["objPatternBool"])
singleAssignBool = {"singleAssignBool": true}["singleAssignBool"] singleAssignBool (const after eval) = {"singleAssignBool": true}["singleAssignBool"]
...@@ -140,7 +140,7 @@ ...@@ -140,7 +140,7 @@
*anonymous function 5936* = (...) => {"type": "sort_expression", "expression": expression, "order": order} *anonymous function 5936* = (...) => {"type": "sort_expression", "expression": expression, "order": order}
*anonymous function 625* = (...) => `Expected ${describeExpected(expected)} but ${describeFound(found)} found.` *anonymous function 625* (const after eval) = (...) => `Expected ${describeExpected(expected)} but ${describeFound(found)} found.`
*anonymous function 6287* = (...) => {"type": "scalar_function_expression", "name": name, "arguments": args, "udf": true} *anonymous function 6287* = (...) => {"type": "scalar_function_expression", "name": name, "arguments": args, "udf": true}
...@@ -483,7 +483,7 @@ parts = arguments[0] ...@@ -483,7 +483,7 @@ parts = arguments[0]
peg$FAILED = {} peg$FAILED = {}
peg$SyntaxError = (...) => undefined peg$SyntaxError (const after eval) = (...) => undefined
peg$anyExpectation = (...) => {"type": "any"} peg$anyExpectation = (...) => {"type": "any"}
...@@ -1083,7 +1083,7 @@ peg$maxFailPos = (0 | peg$currPos) ...@@ -1083,7 +1083,7 @@ peg$maxFailPos = (0 | peg$currPos)
peg$otherExpectation = (...) => {"type": "other", "description": description} peg$otherExpectation = (...) => {"type": "other", "description": description}
peg$parse = (...) => (peg$result | undefined) peg$parse (const after eval) = (...) => (peg$result | undefined)
peg$parse_ = (...) => s0 peg$parse_ = (...) => s0
...@@ -1364,7 +1364,7 @@ peg$startRuleFunction = (peg$parsesql | peg$startRuleFunctions[options["startRul ...@@ -1364,7 +1364,7 @@ peg$startRuleFunction = (peg$parsesql | peg$startRuleFunctions[options["startRul
peg$startRuleFunctions = {"sql": peg$parsesql} peg$startRuleFunctions = {"sql": peg$parsesql}
peg$subclass = (...) => undefined peg$subclass (const after eval) = (...) => undefined
pos = arguments[0] pos = arguments[0]
......
arch = FreeVar(require)("os")["arch"] arch (const after eval) = FreeVar(require)("os")["arch"]
binding1 = FreeVar(require)( binding1 (const after eval) = FreeVar(require)(
`esbuild-${FreeVar(process)["arch"]}-${platform()}-${endianness()}` `esbuild-${FreeVar(process)["arch"]}-${platform()}-${endianness()}`
) )
binding2 = FreeVar(require)(`esbuild-${arch()}-${platform()}-${endianness()}`) binding2 (const after eval) = FreeVar(require)(`esbuild-${arch()}-${platform()}-${endianness()}`)
binding3 = FreeVar(require)( binding3 (const after eval) = FreeVar(require)(
`esbuild-${arch()}-${FreeVar(process)["platform"]}-${endianness()}` `esbuild-${arch()}-${FreeVar(process)["platform"]}-${endianness()}`
) )
binding4 = FreeVar(require)( binding4 (const after eval) = FreeVar(require)(
`esbuild-${FreeVar(process)["arch"]}-${FreeVar(process)["platform"]}-${endianness()}` `esbuild-${FreeVar(process)["arch"]}-${FreeVar(process)["platform"]}-${endianness()}`
) )
binding5 = FreeVar(require)( binding5 (const after eval) = FreeVar(require)(
`esbuild-${p["arch"]}-${p["platform"]}-${endianness()}` `esbuild-${p["arch"]}-${p["platform"]}-${endianness()}`
) )
binding6 = FreeVar(require)( binding6 (const after eval) = FreeVar(require)(
`esbuild-${p["arch"]}-${processPlatform}-${endianness()}` `esbuild-${p["arch"]}-${processPlatform}-${endianness()}`
) )
endianness = FreeVar(require)("os")["endianness"] endianness (const after eval) = FreeVar(require)("os")["endianness"]
p = FreeVar(process) p (const after eval) = FreeVar(process)
platform = FreeVar(require)("os")["platform"] platform (const after eval) = FreeVar(require)("os")["platform"]
processPlatform = FreeVar(require)("process")["platform"] processPlatform (const after eval) = FreeVar(require)("process")["platform"]
a = context["resolve"]("./a") a (const after eval) = context["resolve"]("./a")
context = FreeVar(require)["context"]("./test", false, /\.test\.js$/) context (const after eval) = FreeVar(require)["context"]("./test", false, /\.test\.js$/)
importAll = (...) => r["keys"]()["map"](r) importAll (const after eval) = (...) => r["keys"]()["map"](r)
items = importAll(context) items (const after eval) = importAll(context)
r = arguments[0] r = arguments[0]
x = (1 | ???*0*) x (const after eval) = (1 | ???*0*)
- *0* updated with update expression - *0* updated with update expression
⚠️ This value might have side effects ⚠️ This value might have side effects
y = ???*0* y (const after eval) = ???*0*
- *0* 2 - *0* 2
⚠️ sequence with side effects ⚠️ sequence with side effects
⚠️ This value might have side effects ⚠️ This value might have side effects
e = ???*0* e (const after eval) = ???*0*
- *0* e - *0* e
⚠️ pattern without value ⚠️ pattern without value
pkg = (???*0* | FreeVar(require)("packages/not-found") | FreeVar(require)("packages/found")) pkg (const after eval) = (???*0* | FreeVar(require)("packages/not-found") | FreeVar(require)("packages/found"))
- *0* pkg - *0* pkg
⚠️ pattern without value ⚠️ pattern without value
exported_t_r = FreeVar(require)("exported_t_r") exported_t_r (const after eval) = FreeVar(require)("exported_t_r")
t_i = await(FreeVar(import)("t_i")) t_i (const after eval) = await(FreeVar(import)("t_i"))
t_r = ( t_r (const after eval) = (
| FreeVar(require)("w_i_f") | FreeVar(require)("w_i_f")
| FreeVar(require)("t_i_f") | FreeVar(require)("t_i_f")
| FreeVar(require)("t_r_t") | FreeVar(require)("t_r_t")
| FreeVar(require)("t_r_f") | FreeVar(require)("t_r_f")
) )
w_i = await(FreeVar(import)("w_i")) w_i (const after eval) = await(FreeVar(import)("w_i"))
w_r = (FreeVar(require)("w_r_t") | FreeVar(require)("w_r_f")) w_r (const after eval) = (FreeVar(require)("w_r_t") | FreeVar(require)("w_r_f"))
A = (...) => undefined A (const after eval) = (...) => undefined
B = (...) => undefined B (const after eval) = (...) => undefined
C = (...) => undefined C (const after eval) = (...) => undefined
v = arguments[0] v = arguments[0]
*arrow function 567* = (...) => undefined *arrow function 567* = (...) => undefined
a = (...) => undefined a (const after eval) = (...) => undefined
b = (...) => undefined b (const after eval) = (...) => undefined
c = (...) => undefined c (const after eval) = (...) => undefined
d = (...) => undefined d (const after eval) = (...) => undefined
e#16 = ???*0* e#16 = ???*0*
- *0* e - *0* e
⚠️ pattern without value ⚠️ pattern without value
e#2 = (...) => undefined e#2 (const after eval) = (...) => undefined
f = (...) => undefined f (const after eval) = (...) => undefined
g = (...) => undefined g (const after eval) = (...) => undefined
h = (...) => undefined h (const after eval) = (...) => undefined
x#10 = ???*0* x#10 = ???*0*
- *0* for-in variable currently not analyzed - *0* for-in variable currently not analyzed
......
workerUrl = new FreeVar(URL)("./worker.ts", import.meta*0*["url"]) workerUrl (const after eval) = new FreeVar(URL)("./worker.ts", import.meta*0*["url"])
- *0* import.meta: The import.meta object - *0* import.meta: The import.meta object
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment