mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
refactor(paresr): move some structs to js module (#3341)
This commit is contained in:
parent
9ced605487
commit
6b3d019631
6 changed files with 33 additions and 35 deletions
|
|
@ -5,23 +5,7 @@ use oxc_span::{GetSpan, Span};
|
|||
|
||||
use crate::{diagnostics, lexer::Kind, ParserImpl, StatementContext};
|
||||
|
||||
#[derive(Clone, Debug, Copy, Eq, PartialEq)]
|
||||
pub enum VariableDeclarationParent {
|
||||
For,
|
||||
Statement,
|
||||
Clause,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Copy, Eq, PartialEq)]
|
||||
pub struct VariableDeclarationContext {
|
||||
pub parent: VariableDeclarationParent,
|
||||
}
|
||||
|
||||
impl VariableDeclarationContext {
|
||||
pub(crate) fn new(parent: VariableDeclarationParent) -> Self {
|
||||
Self { parent }
|
||||
}
|
||||
}
|
||||
use super::{VariableDeclarationContext, VariableDeclarationParent};
|
||||
|
||||
impl<'a> ParserImpl<'a> {
|
||||
pub(crate) fn parse_let(&mut self, stmt_ctx: StatementContext) -> Result<Statement<'a>> {
|
||||
|
|
|
|||
|
|
@ -5,16 +5,9 @@ use oxc_ast::ast::*;
|
|||
use oxc_diagnostics::Result;
|
||||
use oxc_span::Span;
|
||||
|
||||
use super::list::FormalParameterList;
|
||||
use crate::{diagnostics, lexer::Kind, list::SeparatedList, Context, ParserImpl, StatementContext};
|
||||
|
||||
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
|
||||
pub enum FunctionKind {
|
||||
Declaration { single_statement: bool },
|
||||
Expression,
|
||||
DefaultExport,
|
||||
TSDeclaration,
|
||||
}
|
||||
use super::{list::FormalParameterList, FunctionKind};
|
||||
|
||||
impl FunctionKind {
|
||||
pub(crate) fn is_id_required(self) -> bool {
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@ pub mod list;
|
|||
mod arrow;
|
||||
mod binding;
|
||||
mod class;
|
||||
pub mod declaration;
|
||||
mod declaration;
|
||||
mod expression;
|
||||
pub mod function;
|
||||
mod function;
|
||||
mod module;
|
||||
mod object;
|
||||
mod operator;
|
||||
|
|
@ -22,3 +22,29 @@ pub enum Tristate {
|
|||
False,
|
||||
Maybe,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
|
||||
pub enum FunctionKind {
|
||||
Declaration { single_statement: bool },
|
||||
Expression,
|
||||
DefaultExport,
|
||||
TSDeclaration,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Copy, Eq, PartialEq)]
|
||||
pub enum VariableDeclarationParent {
|
||||
For,
|
||||
Statement,
|
||||
Clause,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Copy, Eq, PartialEq)]
|
||||
pub struct VariableDeclarationContext {
|
||||
pub parent: VariableDeclarationParent,
|
||||
}
|
||||
|
||||
impl VariableDeclarationContext {
|
||||
pub(crate) fn new(parent: VariableDeclarationParent) -> Self {
|
||||
Self { parent }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ use oxc_diagnostics::Result;
|
|||
use oxc_span::Span;
|
||||
|
||||
use super::{
|
||||
function::FunctionKind,
|
||||
list::{AssertEntries, ExportNamedSpecifiers, ImportSpecifierList},
|
||||
FunctionKind,
|
||||
};
|
||||
use crate::{diagnostics, lexer::Kind, list::SeparatedList, Context, ParserImpl};
|
||||
|
||||
|
|
|
|||
|
|
@ -4,9 +4,7 @@ use oxc_diagnostics::Result;
|
|||
use oxc_span::{Atom, GetSpan, Span};
|
||||
|
||||
use super::{
|
||||
declaration::{VariableDeclarationContext, VariableDeclarationParent},
|
||||
grammar::CoverGrammar,
|
||||
list::SwitchCases,
|
||||
grammar::CoverGrammar, list::SwitchCases, VariableDeclarationContext, VariableDeclarationParent,
|
||||
};
|
||||
use crate::{diagnostics, lexer::Kind, list::NormalList, Context, ParserImpl, StatementContext};
|
||||
|
||||
|
|
|
|||
|
|
@ -8,10 +8,7 @@ use super::{
|
|||
types::ModifierFlags,
|
||||
};
|
||||
use crate::{
|
||||
js::{
|
||||
declaration::{VariableDeclarationContext, VariableDeclarationParent},
|
||||
function::FunctionKind,
|
||||
},
|
||||
js::{FunctionKind, VariableDeclarationContext, VariableDeclarationParent},
|
||||
lexer::Kind,
|
||||
list::{NormalList, SeparatedList},
|
||||
ParserImpl, StatementContext,
|
||||
|
|
|
|||
Loading…
Reference in a new issue