Skip to content

Commit

Permalink
compilation fix
Browse files Browse the repository at this point in the history
  • Loading branch information
HalidOdat committed Jul 26, 2021
1 parent d19a396 commit 7cdbeb7
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
1 change: 1 addition & 0 deletions boa/src/builtins/function/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ impl Function {
context: &mut Context,
local_env: &Environment,
) {
use crate::builtins::Array;
// Create array of values
let array = Array::new_array(context);
Array::add_to_array_object(&array, &args_list.get(index..).unwrap_or_default(), context)
Expand Down
1 change: 1 addition & 0 deletions boa/src/bytecompiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,7 @@ impl ByteCompiler {
self.compile_expr(field.obj(), true);
self.emit(Opcode::Dup, &[]);
self.compile_expr(field.field(), true);
self.emit(Opcode::Swap, &[]);
self.emit(Opcode::GetPropertyByValue, &[]);
}
expr => {
Expand Down
17 changes: 10 additions & 7 deletions boa/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -721,16 +721,19 @@ impl Context {
compiler.compile_statement_list(&statement_list, true);
let code_block = compiler.finish();

let prev = self.vm.frame.take();
self.vm.frame = Some(Box::new(CallFrame {
prev,
let environment = self.get_current_environment().clone();
let fp = self.vm.stack.len();
let global_object = self.global_object().into();

self.vm.push_frame(CallFrame {
prev: None,
code: Gc::new(code_block),
this: self.global_object().into(),
this: global_object,
pc: 0,
fp: self.vm.stack.len(),
fp,
exit_on_return: true,
environment: self.get_current_environment().clone(),
}));
environment,
});
let result = self.run();

// The main_timer needs to be dropped before the BoaProfiler is.
Expand Down
7 changes: 4 additions & 3 deletions boa/src/object/gcobject.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ impl GcObject {
for (i, param) in params.iter().enumerate() {
// Rest Parameters
if param.is_rest_param() {
function.add_rest_param(param, i, args, context, &local_env);
Function::add_rest_param(param, i, args, context, &local_env);
break;
}

Expand All @@ -259,8 +259,9 @@ impl GcObject {
Some(value) => value,
};

function
.add_arguments_to_environment(param, value, &local_env, context);
Function::add_arguments_to_environment(
param, value, &local_env, context,
);
}

if has_parameter_expressions {
Expand Down

0 comments on commit 7cdbeb7

Please sign in to comment.