Skip to content

Commit

Permalink
Fixed compile errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Razican committed Nov 27, 2022
1 parent a5698d1 commit fe39f08
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 47 deletions.
4 changes: 2 additions & 2 deletions boa_cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,8 @@ fn generate_flowgraph(
format: FlowgraphFormat,
direction: Option<FlowgraphDirection>,
) -> JsResult<String> {
let ast = context.parse(src)?;
let code = context.compile(&ast)?;
let ast = context.parse_script(src)?;
let code = context.compile_script(&ast)?;

let direction = match direction {
Some(FlowgraphDirection::TopToBottom) | None => Direction::TopToBottom,
Expand Down
26 changes: 10 additions & 16 deletions boa_engine/src/bytecompiler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -871,10 +871,7 @@ impl<'b> ByteCompiler<'b> {
Ok(())
}

<<<<<<< HEAD
/// Compile a [`StatementList`].
=======
/// Compiles a module item list.
/// Compiles a [`ModuleItemList`].
#[inline]
pub fn compile_module_item_list(
&mut self,
Expand All @@ -887,8 +884,7 @@ impl<'b> ByteCompiler<'b> {
Ok(())
}

/// Compiles a statement list.
>>>>>>> d6d956a26f (Started with the module system)
/// Compile a [`StatementList`].
#[inline]
pub fn compile_statement_list(
&mut self,
Expand Down Expand Up @@ -1853,11 +1849,9 @@ impl<'b> ByteCompiler<'b> {
Ok(())
}

<<<<<<< HEAD
/// Compile a [`StatementListItem`].
=======
/// Compiles a single module item.
/// Compiles a [`ModuleItem`].
#[inline]
#[allow(unused_variables, clippy::missing_panics_doc)] // Unimplemented
pub fn compile_module_item(
&mut self,
item: &ModuleItem,
Expand All @@ -1872,8 +1866,7 @@ impl<'b> ByteCompiler<'b> {
}
}

/// Compiles a single statement list item.
>>>>>>> d6d956a26f (Started with the module system)
/// Compile a [`StatementListItem`].
#[inline]
fn compile_stmt_list_item(
&mut self,
Expand Down Expand Up @@ -3101,7 +3094,7 @@ impl<'b> ByteCompiler<'b> {
configurable_globals: bool,
) {
for node in stmt_list.items() {
self.create_decls_from_module_list_item(node, configurable_globals);
self.create_decls_from_module_item(node, configurable_globals);
}
}

Expand Down Expand Up @@ -3271,9 +3264,10 @@ impl<'b> ByteCompiler<'b> {
}
}

/// Creates the declarations from a module list item.
/// Creates the declarations from a [`ModuleItem`].
#[inline]
pub(crate) fn create_decls_from_module_list_item(
#[allow(unused_variables)] // Unimplemented
pub(crate) fn create_decls_from_module_item(
&mut self,
item: &ModuleItem,
configurable_globals: bool,
Expand All @@ -3287,7 +3281,7 @@ impl<'b> ByteCompiler<'b> {
}
}

/// Creates the declarations from a statement list item.
/// Creates the declarations from a [`StatementListItem`].
#[inline]
pub(crate) fn create_decls_from_stmt_list_item(
&mut self,
Expand Down
17 changes: 0 additions & 17 deletions boa_engine/src/context/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,23 +179,6 @@ impl Context {
parser.parse_script(&mut self.interner)
}

/// Parse the given source text with eval specific handling.
pub(crate) fn parse_eval<S>(
&mut self,
src: S,
direct: bool,
strict: bool,
) -> Result<StatementList, ParseError>
where
S: AsRef<[u8]>,
{
let mut parser = Parser::new(src.as_ref());
if strict {
parser.set_strict();
}
parser.parse_eval(direct, &mut self.interner)
}

/// `Call ( F, V [ , argumentsList ] )`
///
/// The abstract operation `Call` takes arguments `F` (an ECMAScript language value) and `V`
Expand Down
6 changes: 3 additions & 3 deletions boa_parser/src/parser/statement/declaration/export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ where

match tok.kind() {
TokenKind::Keyword((Keyword::Class, _)) => {
let class_declaration =
ClassDeclaration::new(false, true, true).parse(cursor, interner)?;
todo!("Class")
ClassDeclaration::new(false, true, true)
.parse(cursor, interner)
.map(boa_ast::declaration::ExportDeclaration::DefaultClassDeclaration)?
}
_ => todo!("default export parsing"),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use boa_ast::{
function::{self, Class, FormalParameterList, Function},
operations::{contains, contains_arguments, has_direct_super, ContainsSymbol},
property::{ClassElementName, MethodDefinition},
Declaration, Expression, Keyword, Punctuator,
Expression, Keyword, Punctuator,
};
use boa_interner::{Interner, Sym};
use rustc_hash::{FxHashMap, FxHashSet};
Expand Down Expand Up @@ -62,7 +62,7 @@ impl<R> TokenParser<R> for ClassDeclaration
where
R: Read,
{
type Output = Declaration;
type Output = Class;

fn parse(self, cursor: &mut Cursor<R>, interner: &mut Interner) -> ParseResult<Self::Output> {
cursor.expect((Keyword::Class, false), "class declaration", interner)?;
Expand All @@ -87,9 +87,7 @@ where
};
cursor.set_strict_mode(strict);

Ok(Declaration::Class(
ClassTail::new(name, self.allow_yield, self.allow_await).parse(cursor, interner)?,
))
ClassTail::new(name, self.allow_yield, self.allow_await).parse(cursor, interner)
}
}

Expand Down
3 changes: 1 addition & 2 deletions boa_tester/src/exec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
mod js262;

use super::{
use crate::{
read::ErrorType, Harness, Outcome, Phase, SuiteResult, Test, TestFlags, TestOutcomeResult,
TestResult, TestSuite,
};
use crate::read::ErrorType;
use boa_engine::{
builtins::JsArgs, object::FunctionBuilder, property::Attribute, Context, JsNativeErrorKind,
JsResult, JsValue,
Expand Down
4 changes: 2 additions & 2 deletions boa_tester/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -408,9 +408,9 @@ impl Test {
self.ignored = true;
}

/// checks if this is a module test.
/// Checks if this is a module test.
#[inline]
fn is_module(&self) -> bool {
const fn is_module(&self) -> bool {
self.flags.contains(TestFlags::MODULE)
}
}
Expand Down

0 comments on commit fe39f08

Please sign in to comment.