Skip to content

Commit

Permalink
Fixed build in master (#977)
Browse files Browse the repository at this point in the history
  • Loading branch information
Razican authored Dec 18, 2020
1 parent 5c98676 commit b058b2d
Show file tree
Hide file tree
Showing 49 changed files with 397 additions and 360 deletions.
44 changes: 17 additions & 27 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions boa/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ edition = "2018"

[features]
profiler = ["measureme", "once_cell"]
deser = []

# Enable Boa's WHATWG console object implementation.
console = []

[dependencies]
gc = { version = "0.3.6", features = ["derive"] }
serde = { version = "1.0.118", features = ["derive"] }
serde_json = "1.0.60"
rand = "0.7.3"
num-traits = "0.2.14"
Expand All @@ -31,7 +33,6 @@ ryu-js = "0.2.1"
chrono = "0.4.19"

# Optional Dependencies
serde = { version = "1.0.118", features = ["derive"], optional = true }
measureme = { version = "9.0.0", optional = true }
once_cell = { version = "1.5.2", optional = true }

Expand All @@ -50,14 +51,11 @@ bench = false
[[bench]]
name = "parser"
harness = false
required-features = ["serde"]

[[bench]]
name = "exec"
harness = false
required-features = ["serde"]

[[bench]]
name = "full"
harness = false
required-features = ["serde"]
4 changes: 2 additions & 2 deletions boa/src/builtins/bigint/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use crate::{
BoaProfiler, Context, Result,
};

#[cfg(feature = "serde")]
#[cfg(feature = "deser")]
use serde::{Deserialize, Serialize};

pub mod conversions;
Expand All @@ -36,7 +36,7 @@ pub use operations::*;
mod tests;

/// `BigInt` implementation.
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "deser", derive(Serialize, Deserialize))]
#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord, Default)]
pub struct BigInt(num_bigint::BigInt);

Expand Down
4 changes: 2 additions & 2 deletions boa/src/syntax/ast/constant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use crate::{
};
use std::fmt::{Display, Formatter, Result};

#[cfg(feature = "serde")]
#[cfg(feature = "deser")]
use serde::{Deserialize, Serialize};

/// Literals represent values in JavaScript.
Expand All @@ -26,7 +26,7 @@ use serde::{Deserialize, Serialize};
///
/// [spec]: https://tc39.es/ecma262/#sec-primary-expression-literals
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Grammar_and_types#Literals
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "deser", derive(Serialize, Deserialize))]
#[derive(Clone, Debug, Trace, Finalize, PartialEq)]
pub enum Const {
/// A string literal is zero or more characters enclosed in double (`"`) or single (`'`) quotation marks.
Expand Down
4 changes: 2 additions & 2 deletions boa/src/syntax/ast/keyword.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use crate::syntax::ast::op::{BinOp, CompOp};
use std::{convert::TryInto, error, fmt, str::FromStr};

#[cfg(feature = "serde")]
#[cfg(feature = "deser")]
use serde::{Deserialize, Serialize};

/// Keywords are tokens that have special meaning in JavaScript.
Expand All @@ -23,7 +23,7 @@ use serde::{Deserialize, Serialize};
///
/// [spec]: https://www.ecma-international.org/ecma-262/#sec-keywords
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#Keywords
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "deser", derive(Serialize, Deserialize))]
#[derive(Clone, Copy, PartialEq, Debug)]
pub enum Keyword {
/// The `await` keyword.
Expand Down
6 changes: 3 additions & 3 deletions boa/src/syntax/ast/node/array/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::{
};
use std::fmt;

#[cfg(feature = "serde")]
#[cfg(feature = "deser")]
use serde::{Deserialize, Serialize};

/// An array is an ordered collection of data (either primitive or object depending upon the
Expand All @@ -28,10 +28,10 @@ use serde::{Deserialize, Serialize};
///
/// [spec]: https://tc39.es/ecma262/#prod-ArrayLiteral
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "deser", derive(Serialize, Deserialize))]
#[derive(Clone, Debug, Trace, Finalize, PartialEq)]
pub struct ArrayDecl {
#[cfg_attr(feature = "serde", serde(flatten))]
#[cfg_attr(feature = "deser", serde(flatten))]
arr: Box<[Node]>,
}

Expand Down
4 changes: 2 additions & 2 deletions boa/src/syntax/ast/node/await_expr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::{exec::Executable, BoaProfiler, Context, Result, Value};
use gc::{Finalize, Trace};
use std::fmt;

#[cfg(feature = "serde")]
#[cfg(feature = "deser")]
use serde::{Deserialize, Serialize};

/// An await expression is used within an async function to pause execution and wait for a
Expand All @@ -17,7 +17,7 @@ use serde::{Deserialize, Serialize};
///
/// [spec]: https://tc39.es/ecma262/#prod-AwaitExpression
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "deser", derive(Serialize, Deserialize))]
#[derive(Clone, Debug, Trace, Finalize, PartialEq)]
pub struct AwaitExpr {
expr: Box<Node>,
Expand Down
8 changes: 4 additions & 4 deletions boa/src/syntax/ast/node/block/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::{
};
use std::fmt;

#[cfg(feature = "serde")]
#[cfg(feature = "deser")]
use serde::{Deserialize, Serialize};

/// A `block` statement (or compound statement in other languages) is used to group zero or
Expand All @@ -28,11 +28,11 @@ use serde::{Deserialize, Serialize};
///
/// [spec]: https://tc39.es/ecma262/#prod-BlockStatement
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/block
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(transparent))]
#[cfg_attr(feature = "deser", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "deser", serde(transparent))]
#[derive(Clone, Debug, Trace, Finalize, PartialEq)]
pub struct Block {
#[cfg_attr(feature = "serde", serde(flatten))]
#[cfg_attr(feature = "deser", serde(flatten))]
statements: StatementList,
}

Expand Down
4 changes: 2 additions & 2 deletions boa/src/syntax/ast/node/break_node/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::{
};
use std::fmt;

#[cfg(feature = "serde")]
#[cfg(feature = "deser")]
use serde::{Deserialize, Serialize};

#[cfg(test)]
Expand All @@ -27,7 +27,7 @@ mod tests;
///
/// [spec]: https://tc39.es/ecma262/#prod-BreakStatement
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/break
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "deser", derive(Serialize, Deserialize))]
#[derive(Clone, Debug, Trace, Finalize, PartialEq)]
pub struct Break {
label: Option<Box<str>>,
Expand Down
4 changes: 2 additions & 2 deletions boa/src/syntax/ast/node/call/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::{
};
use std::fmt;

#[cfg(feature = "serde")]
#[cfg(feature = "deser")]
use serde::{Deserialize, Serialize};

/// Calling the function actually performs the specified actions with the indicated parameters.
Expand All @@ -25,7 +25,7 @@ use serde::{Deserialize, Serialize};
///
/// [spec]: https://tc39.es/ecma262/#prod-CallExpression
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Functions#Calling_functions
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "deser", derive(Serialize, Deserialize))]
#[derive(Clone, Debug, Trace, Finalize, PartialEq)]
pub struct Call {
expr: Box<Node>,
Expand Down
4 changes: 2 additions & 2 deletions boa/src/syntax/ast/node/conditional/conditional_op/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::{
};
use std::fmt;

#[cfg(feature = "serde")]
#[cfg(feature = "deser")]
use serde::{Deserialize, Serialize};

/// The `conditional` (ternary) operator is the only JavaScript operator that takes three
Expand All @@ -23,7 +23,7 @@ use serde::{Deserialize, Serialize};
///
/// [spec]: https://tc39.es/ecma262/#prod-ConditionalExpression
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Grammar_and_types#Literals
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "deser", derive(Serialize, Deserialize))]
#[derive(Clone, Debug, Trace, Finalize, PartialEq)]
pub struct ConditionalOp {
condition: Box<Node>,
Expand Down
4 changes: 2 additions & 2 deletions boa/src/syntax/ast/node/conditional/if_node/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::{
};
use std::fmt;

#[cfg(feature = "serde")]
#[cfg(feature = "deser")]
use serde::{Deserialize, Serialize};

/// The `if` statement executes a statement if a specified condition is [`truthy`][truthy]. If
Expand All @@ -25,7 +25,7 @@ use serde::{Deserialize, Serialize};
/// [truthy]: https://developer.mozilla.org/en-US/docs/Glossary/truthy
/// [falsy]: https://developer.mozilla.org/en-US/docs/Glossary/falsy
/// [expression]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators#Expressions
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "deser", derive(Serialize, Deserialize))]
#[derive(Clone, Debug, Trace, Finalize, PartialEq)]
pub struct If {
cond: Box<Node>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::{
};
use std::fmt;

#[cfg(feature = "serde")]
#[cfg(feature = "deser")]
use serde::{Deserialize, Serialize};

/// An arrow function expression is a syntactically compact alternative to a regular function
Expand All @@ -23,7 +23,7 @@ use serde::{Deserialize, Serialize};
///
/// [spec]: https://tc39.es/ecma262/#prod-ArrowFunction
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "deser", derive(Serialize, Deserialize))]
#[derive(Clone, Debug, Trace, Finalize, PartialEq)]
pub struct ArrowFunctionDecl {
params: Box<[FormalParameter]>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::{
use gc::{Finalize, Trace};
use std::fmt;

#[cfg(feature = "serde")]
#[cfg(feature = "deser")]
use serde::{Deserialize, Serialize};

/// An async function is used to specify an action (or series of actions) to perform asynchronously.
Expand All @@ -19,7 +19,7 @@ use serde::{Deserialize, Serialize};
///
/// [spec]: https://tc39.es/ecma262/#sec-async-function-prototype-properties
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "deser", derive(Serialize, Deserialize))]
#[derive(Clone, Debug, Trace, Finalize, PartialEq)]
pub struct AsyncFunctionDecl {
name: Option<Box<str>>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::{
use gc::{Finalize, Trace};
use std::fmt;

#[cfg(feature = "serde")]
#[cfg(feature = "deser")]
use serde::{Deserialize, Serialize};

/// An async function expression is very similar to an async function declaration except used within
Expand All @@ -20,7 +20,7 @@ use serde::{Deserialize, Serialize};
///
/// [spec]: https://tc39.es/ecma262/#prod-AsyncFunctionExpression
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/async_function
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "deser", derive(Serialize, Deserialize))]
#[derive(Clone, Debug, Trace, Finalize, PartialEq)]
pub struct AsyncFunctionExpr {
name: Option<Box<str>>,
Expand Down
Loading

0 comments on commit b058b2d

Please sign in to comment.