Skip to content
Open
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
13 changes: 8 additions & 5 deletions core/engine/src/bytecompiler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -988,10 +988,12 @@ impl<'ctx> ByteCompiler<'ctx> {
let ic_index = self.ic.len() as u32;

let name_index = self.get_or_insert_name(ident);
let Constant::String(ref name) = self.constants[name_index as usize].clone() else {
let Constant::String(name) = &self.constants[name_index as usize] else {
unreachable!("there should be a string at index")
};
self.ic.push(InlineCache::new(name.clone()));
let is_length = *name == StaticJsStrings::LENGTH;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm do you really need to introduce this? doesnt look necessary if you dont override name below.

let name = name.clone();
self.ic.push(InlineCache::new(name));

if let Some(receiver) = receiver {
self.bytecode.emit_get_property_by_name_with_this(
Expand All @@ -1000,7 +1002,7 @@ impl<'ctx> ByteCompiler<'ctx> {
value.variable(),
ic_index.into(),
);
} else if name == &StaticJsStrings::LENGTH {
} else if is_length {
self.bytecode.emit_get_length_property(
dst.variable(),
value.variable(),
Expand All @@ -1025,10 +1027,11 @@ impl<'ctx> ByteCompiler<'ctx> {
let ic_index = self.ic.len() as u32;

let name_index = self.get_or_insert_name(ident);
let Constant::String(ref name) = self.constants[name_index as usize].clone() else {
let Constant::String(name) = &self.constants[name_index as usize] else {
unreachable!("there should be a string at index")
};
self.ic.push(InlineCache::new(name.clone()));
let name = name.clone();
self.ic.push(InlineCache::new(name));

if let Some(receiver) = receiver {
self.bytecode.emit_set_property_by_name_with_this(
Expand Down
Loading