Skip to content

Commit

Permalink
Rebase against master
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Williams committed Mar 26, 2020
1 parent 63b8db3 commit 326a13e
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 20 deletions.
39 changes: 21 additions & 18 deletions Cargo.lock

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

6 changes: 6 additions & 0 deletions boa/src/syntax/ast/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ use crate::syntax::ast::{
use gc_derive::{Finalize, Trace};
use std::{collections::btree_map::BTreeMap, fmt};

#[cfg(feature = "serde-ast")]
use serde::{Deserialize, Serialize};
#[cfg_attr(feature = "serde-ast", derive(Serialize, Deserialize))]
#[derive(Clone, Debug, Trace, Finalize, PartialEq)]
/// A Javascript AST Node.
pub enum Node {
Expand Down Expand Up @@ -320,6 +323,7 @@ fn join_nodes(f: &mut fmt::Formatter<'_>, nodes: &[Node]) -> fmt::Result {
///}
///```
/// For more information, please check <https://tc39.es/ecma262/#prod-FormalParameter>
#[cfg_attr(feature = "serde-ast", derive(Serialize, Deserialize))]
#[derive(Clone, Debug, PartialEq, Trace, Finalize)]
pub struct FormalParameter {
pub name: String,
Expand All @@ -340,6 +344,7 @@ impl FormalParameter {
}

// TODO: Support all features: https://tc39.github.io/ecma262/#prod-PropertyDefinition
#[cfg_attr(feature = "serde-ast", derive(Serialize, Deserialize))]
#[derive(Clone, Debug, PartialEq, Trace, Finalize)]
pub enum PropertyDefinition {
IdentifierReference(String),
Expand All @@ -348,6 +353,7 @@ pub enum PropertyDefinition {
SpreadObject(Node),
}

#[cfg_attr(feature = "serde-ast", derive(Serialize, Deserialize))]
#[derive(Clone, Debug, PartialEq, Trace, Finalize)]
pub enum MethodDefinitionKind {
Get,
Expand Down
4 changes: 2 additions & 2 deletions boa_cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use boa::builtins::console::log;
use boa::serde_json;
use boa::syntax::ast::{expr::Expr, token::Token};
use boa::syntax::ast::{node::Node, token::Token};
use boa::{exec::Executor, forward_val, realm::Realm};
use std::io::{self, Write};
use std::{fs::read_to_string, path::PathBuf};
Expand Down Expand Up @@ -91,7 +91,7 @@ fn lex_source(src: &str) -> Result<Vec<Token>, String> {
///
/// Returns a error of type String with a message,
/// if the token stream has a parsing error.
fn parse_tokens(tokens: Vec<Token>) -> Result<Expr, String> {
fn parse_tokens(tokens: Vec<Token>) -> Result<Node, String> {
use boa::syntax::parser::Parser;

Parser::new(tokens)
Expand Down

0 comments on commit 326a13e

Please sign in to comment.