Skip to content

Commit

Permalink
Fixed compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
Razican committed Nov 27, 2022
1 parent 27c899f commit 120a49f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion boa_engine/src/context/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,7 @@ impl Context {
/// Compile the module AST into a `CodeBlock` ready to be executed by the VM.
pub fn compile_module(&mut self, statement_list: &ModuleItemList) -> JsResult<Gc<CodeBlock>> {
let _timer = Profiler::global().start_event("Module compilation", "Main");

let mut compiler = ByteCompiler::new(Sym::MAIN, true, false, self);
compiler.create_module_decls(statement_list, false);
compiler.compile_module_item_list(statement_list, false)?;
Expand All @@ -522,6 +523,7 @@ impl Context {
/// Compile the script AST into a `CodeBlock` ready to be executed by the VM.
pub fn compile_script(&mut self, statement_list: &StatementList) -> JsResult<Gc<CodeBlock>> {
let _timer = Profiler::global().start_event("Script compilation", "Main");

let mut compiler = ByteCompiler::new(Sym::MAIN, statement_list.strict(), false, self);
compiler.create_script_decls(statement_list, false);
compiler.compile_statement_list(statement_list, true, false)?;
Expand All @@ -534,7 +536,8 @@ impl Context {
&mut self,
statement_list: &StatementList,
) -> JsResult<Gc<CodeBlock>> {
let _timer = Profiler::global().start_event("Compilation", "Main");
let _timer = Profiler::global().start_event("JSON parse compilation", "Main");

let mut compiler = ByteCompiler::new(Sym::MAIN, statement_list.strict(), true, self);
compiler.create_script_decls(statement_list, false);
compiler.compile_statement_list(statement_list, true, false)?;
Expand All @@ -549,6 +552,7 @@ impl Context {
strict: bool,
) -> JsResult<Gc<CodeBlock>> {
let _timer = Profiler::global().start_event("Compilation", "Main");

let mut compiler = ByteCompiler::new(Sym::MAIN, statement_list.strict(), false, self);
compiler.compile_statement_list_with_new_declarative(statement_list, true, strict)?;
Ok(Gc::new(compiler.finish()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ use boa_ast::{
Expression, Keyword, Punctuator,
};
use boa_interner::{Interner, Sym};
use boa_macros::utf16;
use boa_profiler::Profiler;
use std::io::Read;

Expand Down

0 comments on commit 120a49f

Please sign in to comment.