Skip to content

Commit

Permalink
Add documentation
Browse files Browse the repository at this point in the history
Rename some fields for clarity

Add some performance improvements
  • Loading branch information
raskad committed Aug 8, 2021
1 parent b5114a3 commit f800db8
Show file tree
Hide file tree
Showing 8 changed files with 215 additions and 56 deletions.
6 changes: 3 additions & 3 deletions boa/src/bytecompiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ impl ByteCompiler {
Node::VarDeclList(list) => {
for decl in list.as_ref() {
match decl {
Declaration::Identifier(ident, _) => {
Declaration::Identifier { ident, .. } => {
let index = self.get_or_insert_name(ident.as_ref());
self.emit(Opcode::DefVar, &[index]);

Expand All @@ -615,7 +615,7 @@ impl ByteCompiler {
Node::LetDeclList(list) => {
for decl in list.as_ref() {
match decl {
Declaration::Identifier(ident, _) => {
Declaration::Identifier { ident, .. } => {
let index = self.get_or_insert_name(ident.as_ref());
self.emit(Opcode::DefLet, &[index]);

Expand All @@ -641,7 +641,7 @@ impl ByteCompiler {
Node::ConstDeclList(list) => {
for decl in list.as_ref() {
match decl {
Declaration::Identifier(ident, _) => {
Declaration::Identifier { ident, .. } => {
let index = self.get_or_insert_name(ident.as_ref());
self.emit(Opcode::DefConst, &[index]);

Expand Down
9 changes: 6 additions & 3 deletions boa/src/object/gcobject.rs
Original file line number Diff line number Diff line change
Expand Up @@ -923,7 +923,9 @@ impl GcObject {
}

// 4. Let from be ! ToObject(source).
let from = source.to_object(context)?;
let from = source
.to_object(context)
.expect("function ToObject should never complete abruptly here");

// 5. Let keys be ? from.[[OwnPropertyKeys]]().
// 6. For each element nextKey of keys, do
Expand All @@ -937,7 +939,8 @@ impl GcObject {
// i. If SameValue(e, nextKey) is true, then
if *e == key {
// 1. Set excluded to true.
excluded = true
excluded = true;
break;
}
}
// c. If excluded is false, then
Expand All @@ -956,7 +959,7 @@ impl GcObject {
key,
DataDescriptor::new(prop_value, Attribute::all()),
context,
)?;
).expect("function CreateDataPropertyOrThrow should never complete abruptly here");
}
}
}
Expand Down
Loading

0 comments on commit f800db8

Please sign in to comment.