refactor(ast, parser)!: remove NumericLiteral::new method (#6787)

This commit is contained in:
overlookmotel 2024-10-23 03:36:31 +00:00
parent aeaa27a618
commit a1ca964560
2 changed files with 1 additions and 7 deletions

View file

@ -10,7 +10,6 @@ use std::{
use oxc_allocator::CloneIn; use oxc_allocator::CloneIn;
use oxc_regular_expression::ast::Pattern; use oxc_regular_expression::ast::Pattern;
use oxc_span::{cmp::ContentEq, hash::ContentHash, Atom, Span}; use oxc_span::{cmp::ContentEq, hash::ContentHash, Atom, Span};
use oxc_syntax::number::NumberBase;
use crate::ast::*; use crate::ast::*;
@ -59,11 +58,6 @@ impl fmt::Display for NullLiteral {
} }
impl<'a> NumericLiteral<'a> { impl<'a> NumericLiteral<'a> {
/// Create a numeric literal representing the given `value`.
pub fn new(span: Span, value: f64, raw: &'a str, base: NumberBase) -> Self {
Self { span, value, raw, base }
}
/// port from [closure compiler](https://github.com/google/closure-compiler/blob/a4c880032fba961f7a6c06ef99daa3641810bfdd/src/com/google/javascript/jscomp/base/JSCompDoubles.java#L113) /// port from [closure compiler](https://github.com/google/closure-compiler/blob/a4c880032fba961f7a6c06ef99daa3641810bfdd/src/com/google/javascript/jscomp/base/JSCompDoubles.java#L113)
/// ///
/// <https://262.ecma-international.org/5.1/#sec-9.5> /// <https://262.ecma-international.org/5.1/#sec-9.5>

View file

@ -321,7 +321,7 @@ impl<'a> ParserImpl<'a> {
_ => return Err(self.unexpected()), _ => return Err(self.unexpected()),
}; };
self.bump_any(); self.bump_any();
Ok(NumericLiteral::new(self.end_span(span), value, src, base)) Ok(self.ast.numeric_literal(self.end_span(span), value, src, base))
} }
pub(crate) fn parse_literal_bigint(&mut self) -> Result<BigIntLiteral<'a>> { pub(crate) fn parse_literal_bigint(&mut self) -> Result<BigIntLiteral<'a>> {