Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,11 @@ export default function() {}
/* #__NO_SIDE_EFFECTS__ */ export const c2 = () => {}, c3 = () => {}

----------
export var v0 = /* @__NO_SIDE_EFFECTS__ */ function() {}, v1 = function() {};
export let l0 = /* @__NO_SIDE_EFFECTS__ */ function() {}, l1 = function() {};
export var v0 = function() {}, v1 = function() {};
export let l0 = function() {}, l1 = function() {};
export const c0 = /* @__NO_SIDE_EFFECTS__ */ function() {}, c1 = function() {};
export var v2 = /* @__NO_SIDE_EFFECTS__ */ () => {}, v3 = () => {};
export let l2 = /* @__NO_SIDE_EFFECTS__ */ () => {}, l3 = () => {};
export var v2 = () => {}, v3 = () => {};
export let l2 = () => {}, l3 = () => {};
export const c2 = /* @__NO_SIDE_EFFECTS__ */ () => {}, c3 = () => {};

########## 8
Expand All @@ -172,11 +172,11 @@ export const c2 = /* @__NO_SIDE_EFFECTS__ */ () => {}, c3 = () => {};
/* #__NO_SIDE_EFFECTS__ */ const c2 = () => {}, c3 = () => {}

----------
var v0 = /* @__NO_SIDE_EFFECTS__ */ function() {}, v1 = function() {};
let l0 = /* @__NO_SIDE_EFFECTS__ */ function() {}, l1 = function() {};
var v0 = function() {}, v1 = function() {};
let l0 = function() {}, l1 = function() {};
const c0 = /* @__NO_SIDE_EFFECTS__ */ function() {}, c1 = function() {};
var v2 = /* @__NO_SIDE_EFFECTS__ */ () => {}, v3 = () => {};
let l2 = /* @__NO_SIDE_EFFECTS__ */ () => {}, l3 = () => {};
var v2 = () => {}, v3 = () => {};
let l2 = () => {}, l3 = () => {};
const c2 = /* @__NO_SIDE_EFFECTS__ */ () => {}, c3 = () => {};

########## 9
Expand Down
4 changes: 2 additions & 2 deletions crates/oxc_parser/src/js/statement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,15 +161,15 @@ impl<'a> ParserImpl<'a> {
Some(Declaration::FunctionDeclaration(func)) => {
func.pure = true;
}
Some(Declaration::VariableDeclaration(var_decl)) => {
Some(Declaration::VariableDeclaration(var_decl)) if var_decl.kind.is_const() => {
if let Some(Some(expr)) = var_decl.declarations.first_mut().map(|d| &mut d.init)
{
Self::set_pure_on_function_expr(expr);
}
}
_ => {}
},
Statement::VariableDeclaration(var_decl) => {
Statement::VariableDeclaration(var_decl) if var_decl.kind.is_const() => {
if let Some(Some(expr)) = var_decl.declarations.first_mut().map(|d| &mut d.init) {
Self::set_pure_on_function_expr(expr);
}
Expand Down
Loading