From cc54e10ef4de69a1179420284ecef88faa61c347 Mon Sep 17 00:00:00 2001 From: Robert Masen Date: Sun, 11 Jun 2023 10:47:52 -0500 Subject: [PATCH] update to resast 0.6.0-alpha.5 --- Cargo.toml | 4 ++-- src/formal_params.rs | 12 ++++++------ src/lexical_names.rs | 12 ++++++------ src/lhs.rs | 4 ++-- src/spanned/mod.rs | 16 ++++++++-------- 5 files changed, 24 insertions(+), 24 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 316ddca..b53c961 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ressa" -version = "0.9.0-alpha.2" +version = "0.9.0-alpha.3" authors = ["Robert Masen "] repository = "https://github.com/rusty-ecma/RESSA" description = "An ECMAscript parser" @@ -14,7 +14,7 @@ edition = "2021" hash-chain = "0.3" log = "0.4" ress = "0.11" -resast = "0.6.0-alpha.3" +resast = "0.6.0-alpha.5" res-regex = "0.1" tracing = "0.1" diff --git a/src/formal_params.rs b/src/formal_params.rs index 577e7d2..4b5a0e3 100644 --- a/src/formal_params.rs +++ b/src/formal_params.rs @@ -56,8 +56,8 @@ pub fn update_with_expr<'a>( log::trace!("update_with_expr {:?} {:?}", expr, set); match expr { resast::spanned::expr::Expr::Ident(id) => { - if !set.insert(id.slice.source.0.clone().into()) { - return Err(id.slice.source.0.clone()); + if !set.insert(id.slice.source.clone().into()) { + return Err(id.slice.source.clone()); } } resast::spanned::expr::Expr::Assign(AssignExpr { left, .. }) => match left { @@ -91,8 +91,8 @@ pub fn update_with_pat<'a>( log::trace!("update_with_pat {:?} {:?}", pat, set); match pat { Pat::Ident(id) => { - if !set.insert(id.slice.source.0.clone()) { - return Err(id.slice.source.0.clone()); + if !set.insert(id.slice.source.clone()) { + return Err(id.slice.source.clone()); } } Pat::Array(arr) => { @@ -182,8 +182,8 @@ fn update_with_lit<'a>( ) -> Result<(), Cow<'a, str>> { log::trace!("update_with_lit {:?}, {:?}", lit, set); if let Lit::String(s) = lit { - if !set.insert(s.content.source.0.clone()) { - return Err(s.content.source.0.clone()); + if !set.insert(s.content.source.clone()) { + return Err(s.content.source.clone()); } } Ok(()) diff --git a/src/lexical_names.rs b/src/lexical_names.rs index 3864eb0..cafc1c0 100644 --- a/src/lexical_names.rs +++ b/src/lexical_names.rs @@ -173,7 +173,7 @@ impl<'a> DuplicateNameDetector<'a> { match pat { Pat::Ident(ref i) => { log::trace!("add_pat ident {:?}", i.slice.source); - self.declare(i.slice.source.0.clone(), kind, pos) + self.declare(i.slice.source.clone(), kind, pos) } Pat::Array(ref a) => { for part in &a.elements { @@ -231,7 +231,7 @@ impl<'a> DuplicateNameDetector<'a> { ) -> Res<()> { log::trace!("declare_literal_ident {:?} {:?} {:?}", lit, kind, pos); match lit { - Lit::String(s) => self.declare(s.content.source.0.clone(), kind, pos), + Lit::String(s) => self.declare(s.content.source.clone(), kind, pos), _ => Err(Error::RestrictedIdent(pos)), } } @@ -244,7 +244,7 @@ impl<'a> DuplicateNameDetector<'a> { log::trace!("declare_expr {:?} {:?} {:?}", expr, kind, pos); if let Expr::Ident(ref i) = expr { log::trace!("add_expr ident {:?}", i.slice.source); - self.declare(i.slice.source.0.clone(), kind, pos) + self.declare(i.slice.source.clone(), kind, pos) } else { Ok(()) } @@ -331,14 +331,14 @@ impl<'a> DuplicateNameDetector<'a> { pos: Position, ) -> Res<()> { log::trace!("add_export_spec {:?} {:?}", spec, pos); - self.add_export_ident(&spec.local.slice.source.0.clone(), pos)?; - self.undefined_module_export_guard(spec.local.slice.source.0.clone()); + self.add_export_ident(&spec.local.slice.source.clone(), pos)?; + self.undefined_module_export_guard(spec.local.slice.source.clone()); Ok(()) } pub fn removed_undefined_export(&mut self, id: &Ident>) { log::trace!("removed_undefined_export {:?}", id); - self.undefined_module_exports.remove(&id.slice.source.0); + self.undefined_module_exports.remove(&id.slice.source); } pub fn add_export_ident(&mut self, id: &Cow<'a, str>, pos: Position) -> Res<()> { diff --git a/src/lhs.rs b/src/lhs.rs index debf8be..2eac9ce 100644 --- a/src/lhs.rs +++ b/src/lhs.rs @@ -276,7 +276,7 @@ fn check_loop_left_expr<'a>( log::debug!("check_loop_left_expr"); match expr { Expr::Ident(ident) => { - if !set.insert(ident.slice.source.0.clone()) { + if !set.insert(ident.slice.source.clone()) { Err(Error::InvalidLHS(pos)) } else { Ok(()) @@ -294,7 +294,7 @@ fn check_loop_left_pat<'a>( log::debug!("check_loop_left_pat"); match pat { Pat::Ident(ident) => { - if !set.insert(ident.slice.source.0.clone()) { + if !set.insert(ident.slice.source.clone()) { Err(Error::InvalidLHS(pos)) } else { Ok(()) diff --git a/src/spanned/mod.rs b/src/spanned/mod.rs index 501d1d5..4f6e808 100644 --- a/src/spanned/mod.rs +++ b/src/spanned/mod.rs @@ -659,7 +659,7 @@ where let keyword = self.position_from(&keyword).into(); let alias = self.parse_var_ident(false)?; self.context.lexical_names.declare( - alias.slice.source.0.clone(), + alias.slice.source.clone(), DeclKind::Lex(true), start, )?; @@ -672,7 +672,7 @@ where }) } else { self.context.lexical_names.declare( - imported.slice.source.0.clone(), + imported.slice.source.clone(), DeclKind::Lex(true), start, )?; @@ -697,7 +697,7 @@ where let start = self.look_ahead_position; let ident = self.parse_ident_name()?; self.context.lexical_names.declare( - ident.slice.source.0.clone(), + ident.slice.source.clone(), DeclKind::Lex(true), start, )?; @@ -713,7 +713,7 @@ where let start = self.look_ahead_position; let id = self.parse_ident_name()?; self.context.lexical_names.declare( - id.slice.source.0.clone(), + id.slice.source.clone(), DeclKind::Lex(true), start, )?; @@ -932,7 +932,7 @@ where if let Some(id) = &func.id { self.context .lexical_names - .add_export_ident(&id.slice.source.0.clone(), start)?; + .add_export_ident(&id.slice.source.clone(), start)?; } Ok(Decl::Func(func)) } @@ -944,7 +944,7 @@ where if let Some(id) = &class.id { self.context .lexical_names - .add_export_ident(&id.slice.source.0.clone(), start)?; + .add_export_ident(&id.slice.source.clone(), start)?; } Ok(Decl::Class(class)) } @@ -2704,7 +2704,7 @@ where }; self.context .lexical_names - .declare(id.slice.source.0.clone(), kind, start)?; + .declare(id.slice.source.clone(), kind, start)?; } Some(id) } @@ -2888,7 +2888,7 @@ where if check_id { if let Some(ref i) = id { self.context.lexical_names.declare( - i.slice.source.0.clone(), + i.slice.source.clone(), lexical_names::DeclKind::Lex(self.context.is_module), start, )?;