Skip to content

Commit

Permalink
Reverted kind(), might have caused some performance regressions in th…
Browse files Browse the repository at this point in the history
…e parser
  • Loading branch information
Razican committed May 14, 2020
1 parent e0d6b85 commit b55e450
Show file tree
Hide file tree
Showing 30 changed files with 265 additions and 350 deletions.
1 change: 0 additions & 1 deletion boa/src/syntax/ast/node/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ use std::{
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};

/// A Javascript AST Node.
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(Clone, Debug, Trace, Finalize, PartialEq)]
pub enum Node {
Expand Down
16 changes: 2 additions & 14 deletions boa/src/syntax/ast/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, PartialEq)]
pub struct Token {
/// The token kind, which contains the actual data of the token.
kind: TokenKind,
pub(crate) kind: TokenKind,
/// The token position in the original source code.
span: Span,
}
Expand All @@ -32,6 +32,7 @@ impl Token {
Self { kind, span }
}

/// Gets the kind of the token.
pub fn kind(&self) -> &TokenKind {
&self.kind
}
Expand All @@ -48,19 +49,6 @@ impl Display for Token {
}
}

/// A continuous sequence of tokens.
pub struct VecToken(Vec<Token>);

impl Debug for VecToken {
fn fmt(&self, f: &mut Formatter<'_>) -> Result {
let mut buffer = String::new();
for token in &self.0 {
buffer.push_str(&token.to_string());
}
write!(f, "{}", buffer)
}
}

/// Represents the type differenct types of numeric literals.
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(Clone, Copy, PartialEq, Debug)]
Expand Down
Loading

0 comments on commit b55e450

Please sign in to comment.