Skip to content

Commit 752a5a0

Browse files
ClaudeBrooooooklyn
andauthored
fix: update code for oxc 0.123 API changes (Atom -> Ident)
Agent-Logs-Url: https://github.com/voidzero-dev/oxc-angular-compiler/sessions/e30e0210-0bc0-4fde-89cf-53e615179571 Co-authored-by: Brooooooklyn <3468483+Brooooooklyn@users.noreply.github.com>
1 parent fa87ec0 commit 752a5a0

108 files changed

Lines changed: 1936 additions & 1936 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

crates/angular_conformance/src/extractor/util.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ impl SpecExtractor {
5454
let parts: Vec<&str> = lit
5555
.quasis
5656
.iter()
57-
.filter_map(|q| q.value.cooked.as_ref().map(oxc_span::Atom::as_str))
57+
.filter_map(|q| q.value.cooked.as_ref().map(oxc_span::Str::as_str))
5858
.collect();
5959
Some(parts.join(""))
6060
}
@@ -138,10 +138,10 @@ impl SpecExtractor {
138138
Some(serde_json::Value::String(lit.value.to_string()))
139139
}
140140
Expression::NumericLiteral(lit) => {
141-
serde_json::Number::from_f64(lit.value).map(serde_json::Value::Number)
141+
serde_json::Number::from_f64(lit.value.into()).map(serde_json::Value::Number)
142142
}
143143
Expression::NullLiteral(_) => Some(serde_json::Value::Null),
144-
Expression::BooleanLiteral(lit) => Some(serde_json::Value::Bool(lit.value)),
144+
Expression::BooleanLiteral(lit) => Some(serde_json::Value::Bool(lit.value.into())),
145145
Expression::ArrayExpression(arr) => {
146146
let mut values = Vec::new();
147147
for element in &arr.elements {

crates/angular_conformance/src/subsystems/html_whitespace.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ impl WhitespaceRemovingHumanizer {
384384
for token in tokens {
385385
match token.token_type {
386386
InterpolatedTokenType::Text => {
387-
let text = token.parts.first().map_or("", oxc_span::Atom::as_str);
387+
let text = token.parts.first().map_or("", oxc_span::Ident::as_str);
388388
let processed = process_whitespace(text);
389389
result.push(vec![processed]);
390390
}

crates/oxc_angular_compiler/src/ast/expression.rs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
//! - No bitwise operators
1212
1313
use oxc_allocator::{Allocator, Box, Vec};
14-
use oxc_span::{Atom, Span};
14+
use oxc_span::{Ident, Span};
1515

1616
/// A span within the expression source.
1717
#[derive(Debug, Clone, Copy)]
@@ -594,7 +594,7 @@ pub struct PropertyRead<'a> {
594594
/// The receiver expression.
595595
pub receiver: AngularExpression<'a>,
596596
/// The property name.
597-
pub name: Atom<'a>,
597+
pub name: Ident<'a>,
598598
}
599599

600600
/// A safe property read expression: `receiver?.property`.
@@ -609,7 +609,7 @@ pub struct SafePropertyRead<'a> {
609609
/// The receiver expression.
610610
pub receiver: AngularExpression<'a>,
611611
/// The property name.
612-
pub name: Atom<'a>,
612+
pub name: Ident<'a>,
613613
}
614614

615615
/// A keyed read expression: `receiver[key]`.
@@ -659,7 +659,7 @@ pub struct BindingPipe<'a> {
659659
/// The expression being piped.
660660
pub exp: AngularExpression<'a>,
661661
/// The pipe name.
662-
pub name: Atom<'a>,
662+
pub name: Ident<'a>,
663663
/// The pipe arguments.
664664
pub args: Vec<'a, AngularExpression<'a>>,
665665
/// The type of pipe reference.
@@ -670,7 +670,7 @@ pub struct BindingPipe<'a> {
670670
#[derive(Debug, Clone)]
671671
pub enum LiteralValue<'a> {
672672
/// A string literal.
673-
String(Atom<'a>),
673+
String(Ident<'a>),
674674
/// A number literal.
675675
Number(f64),
676676
/// A boolean literal.
@@ -718,7 +718,7 @@ pub struct SpreadElement<'a> {
718718
#[derive(Debug)]
719719
pub struct ArrowFunctionParameter<'a> {
720720
/// The parameter name.
721-
pub name: Atom<'a>,
721+
pub name: Ident<'a>,
722722
/// The span of this parameter.
723723
pub span: ParseSpan,
724724
/// The absolute source span.
@@ -751,7 +751,7 @@ pub enum LiteralMapKey<'a> {
751751
#[derive(Debug)]
752752
pub struct LiteralMapPropertyKey<'a> {
753753
/// The key string.
754-
pub key: Atom<'a>,
754+
pub key: Ident<'a>,
755755
/// Whether the key is quoted.
756756
pub quoted: bool,
757757
/// Whether this is a shorthand initialization.
@@ -788,7 +788,7 @@ pub struct Interpolation<'a> {
788788
/// The absolute source span.
789789
pub source_span: AbsoluteSourceSpan,
790790
/// The static string parts.
791-
pub strings: Vec<'a, Atom<'a>>,
791+
pub strings: Vec<'a, Ident<'a>>,
792792
/// The dynamic expression parts.
793793
pub expressions: Vec<'a, AngularExpression<'a>>,
794794
}
@@ -1062,7 +1062,7 @@ pub struct TemplateLiteralElement<'a> {
10621062
/// The absolute source span.
10631063
pub source_span: AbsoluteSourceSpan,
10641064
/// The text content.
1065-
pub text: Atom<'a>,
1065+
pub text: Ident<'a>,
10661066
}
10671067

10681068
/// A parenthesized expression.
@@ -1084,9 +1084,9 @@ pub struct RegularExpressionLiteral<'a> {
10841084
/// The absolute source span.
10851085
pub source_span: AbsoluteSourceSpan,
10861086
/// The regex pattern.
1087-
pub body: Atom<'a>,
1087+
pub body: Ident<'a>,
10881088
/// The regex flags.
1089-
pub flags: Option<Atom<'a>>,
1089+
pub flags: Option<Ident<'a>>,
10901090
}
10911091

10921092
// ============================================================================
@@ -1128,7 +1128,7 @@ pub struct ExpressionBinding<'a> {
11281128
#[derive(Debug, Clone)]
11291129
pub struct TemplateBindingIdentifier<'a> {
11301130
/// The source text.
1131-
pub source: Atom<'a>,
1131+
pub source: Ident<'a>,
11321132
/// The span.
11331133
pub span: AbsoluteSourceSpan,
11341134
}
@@ -1139,9 +1139,9 @@ pub struct ASTWithSource<'a> {
11391139
/// The AST.
11401140
pub ast: AngularExpression<'a>,
11411141
/// The original source.
1142-
pub source: Option<Atom<'a>>,
1142+
pub source: Option<Ident<'a>>,
11431143
/// The source location.
1144-
pub location: Atom<'a>,
1144+
pub location: Ident<'a>,
11451145
/// The absolute offset in the template.
11461146
pub absolute_offset: u32,
11471147
// Note: Errors are collected separately in the parser/transformer context
@@ -1210,7 +1210,7 @@ pub enum BindingType {
12101210
#[derive(Debug)]
12111211
pub struct ParsedProperty<'a> {
12121212
/// The property name.
1213-
pub name: Atom<'a>,
1213+
pub name: Ident<'a>,
12141214
/// The binding expression.
12151215
pub expression: ASTWithSource<'a>,
12161216
/// The type of property binding.
@@ -1247,11 +1247,11 @@ impl<'a> ParsedProperty<'a> {
12471247
#[derive(Debug)]
12481248
pub struct ParsedEvent<'a> {
12491249
/// The event name.
1250-
pub name: Atom<'a>,
1250+
pub name: Ident<'a>,
12511251
/// The event target or animation phase.
12521252
/// For regular events: "window", "document", "body", or None.
12531253
/// For legacy animation events: the animation phase.
1254-
pub target_or_phase: Option<Atom<'a>>,
1254+
pub target_or_phase: Option<Ident<'a>>,
12551255
/// The type of event binding.
12561256
pub event_type: ParsedEventType,
12571257
/// The handler expression.

crates/oxc_angular_compiler/src/ast/html.rs

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
//! ported from Angular's `ml_parser/ast.ts`.
55
66
use oxc_allocator::{Box, Vec};
7-
use oxc_span::{Atom, Span};
7+
use oxc_span::{Ident, Span};
88

99
use super::expression::AngularExpression;
1010

@@ -31,7 +31,7 @@ pub struct InterpolatedToken<'a> {
3131
/// The token type.
3232
pub token_type: InterpolatedTokenType,
3333
/// The token parts (structure depends on token type).
34-
pub parts: Vec<'a, Atom<'a>>,
34+
pub parts: Vec<'a, Ident<'a>>,
3535
/// The source span.
3636
pub span: Span,
3737
}
@@ -83,7 +83,7 @@ impl<'a> HtmlNode<'a> {
8383
#[derive(Debug)]
8484
pub struct HtmlText<'a> {
8585
/// The decoded text value (entities resolved, interpolations joined).
86-
pub value: Atom<'a>,
86+
pub value: Ident<'a>,
8787
/// The source span (after stripping leading trivia).
8888
pub span: Span,
8989
/// The full start offset before stripping leading trivia (for source maps).
@@ -100,13 +100,13 @@ pub struct HtmlElement<'a> {
100100
/// The element tag name.
101101
/// For regular elements: the tag name (e.g., "div", ":svg:rect").
102102
/// For selectorless components: the component name (e.g., "MyComp").
103-
pub name: Atom<'a>,
103+
pub name: Ident<'a>,
104104
/// For selectorless components: the namespace prefix (e.g., "svg" in `<ng-component:MyComp:svg:rect>`).
105105
/// None for regular elements or selectorless components without namespace.
106-
pub component_prefix: Option<Atom<'a>>,
106+
pub component_prefix: Option<Ident<'a>>,
107107
/// For selectorless components: the HTML tag name (e.g., "rect" in `<ng-component:MyComp:svg:rect>`).
108108
/// None for regular elements or selectorless components without tag name.
109-
pub component_tag_name: Option<Atom<'a>>,
109+
pub component_tag_name: Option<Ident<'a>>,
110110
/// The element attributes.
111111
pub attrs: Vec<'a, HtmlAttribute<'a>>,
112112
/// Selectorless directives (e.g., @Dir, @Dir(attr="value")).
@@ -133,12 +133,12 @@ pub struct HtmlElement<'a> {
133133
#[derive(Debug)]
134134
pub struct HtmlComponent<'a> {
135135
/// The component class name (e.g., "MyComp").
136-
pub component_name: Atom<'a>,
136+
pub component_name: Ident<'a>,
137137
/// The HTML tag name (e.g., "button" in `<MyComp:button>`).
138138
/// None for component-only syntax like `<MyComp>`.
139-
pub tag_name: Option<Atom<'a>>,
139+
pub tag_name: Option<Ident<'a>>,
140140
/// The full qualified name (e.g., "MyComp:svg:rect").
141-
pub full_name: Atom<'a>,
141+
pub full_name: Ident<'a>,
142142
/// The element attributes.
143143
pub attrs: Vec<'a, HtmlAttribute<'a>>,
144144
/// Selectorless directives (e.g., @Dir).
@@ -159,7 +159,7 @@ pub struct HtmlComponent<'a> {
159159
#[derive(Debug)]
160160
pub struct HtmlDirective<'a> {
161161
/// The directive name (without the @ prefix).
162-
pub name: Atom<'a>,
162+
pub name: Ident<'a>,
163163
/// The directive attributes (inside parentheses, if any).
164164
pub attrs: Vec<'a, HtmlAttribute<'a>>,
165165
/// The source span for the entire directive.
@@ -176,9 +176,9 @@ pub struct HtmlDirective<'a> {
176176
#[derive(Debug)]
177177
pub struct HtmlAttribute<'a> {
178178
/// The attribute name.
179-
pub name: Atom<'a>,
179+
pub name: Ident<'a>,
180180
/// The decoded attribute value (entities resolved, interpolations joined).
181-
pub value: Atom<'a>,
181+
pub value: Ident<'a>,
182182
/// The source span.
183183
pub span: Span,
184184
/// The name span.
@@ -194,7 +194,7 @@ pub struct HtmlAttribute<'a> {
194194
#[derive(Debug)]
195195
pub struct HtmlComment<'a> {
196196
/// The comment value.
197-
pub value: Atom<'a>,
197+
pub value: Ident<'a>,
198198
/// The source span.
199199
pub span: Span,
200200
}
@@ -203,9 +203,9 @@ pub struct HtmlComment<'a> {
203203
#[derive(Debug)]
204204
pub struct HtmlExpansion<'a> {
205205
/// The switch value.
206-
pub switch_value: Atom<'a>,
206+
pub switch_value: Ident<'a>,
207207
/// The expansion type (e.g., "plural", "select").
208-
pub expansion_type: Atom<'a>,
208+
pub expansion_type: Ident<'a>,
209209
/// The expansion cases.
210210
pub cases: Vec<'a, HtmlExpansionCase<'a>>,
211211
/// The source span.
@@ -222,7 +222,7 @@ pub struct HtmlExpansion<'a> {
222222
#[derive(Debug)]
223223
pub struct HtmlExpansionCase<'a> {
224224
/// The case value (e.g., "one", "other").
225-
pub value: Atom<'a>,
225+
pub value: Ident<'a>,
226226
/// The expansion nodes.
227227
pub expansion: Vec<'a, HtmlNode<'a>>,
228228
/// The source span.
@@ -268,7 +268,7 @@ pub struct HtmlBlock<'a> {
268268
/// The block type.
269269
pub block_type: BlockType,
270270
/// The block name.
271-
pub name: Atom<'a>,
271+
pub name: Ident<'a>,
272272
/// The block parameters.
273273
pub parameters: Vec<'a, HtmlBlockParameter<'a>>,
274274
/// The child nodes.
@@ -291,7 +291,7 @@ pub struct HtmlBlock<'a> {
291291
#[derive(Debug)]
292292
pub struct HtmlBlockParameter<'a> {
293293
/// The raw expression text (e.g., "minimum 500ms", "track item.id").
294-
pub expression: Atom<'a>,
294+
pub expression: Ident<'a>,
295295
/// The source span.
296296
pub span: Span,
297297
}
@@ -300,7 +300,7 @@ pub struct HtmlBlockParameter<'a> {
300300
#[derive(Debug)]
301301
pub struct HtmlLetDeclaration<'a> {
302302
/// The variable name.
303-
pub name: Atom<'a>,
303+
pub name: Ident<'a>,
304304
/// The value expression.
305305
pub value: AngularExpression<'a>,
306306
/// The source span.
@@ -506,7 +506,7 @@ mod tests {
506506

507507
// Create a simple tree: root element with two child elements
508508
let child1 = HtmlElement {
509-
name: Atom::from("span"),
509+
name: Ident::from("span"),
510510
component_prefix: None,
511511
component_tag_name: None,
512512
attrs: Vec::new_in(&allocator),
@@ -520,7 +520,7 @@ mod tests {
520520
};
521521

522522
let child2 = HtmlElement {
523-
name: Atom::from("p"),
523+
name: Ident::from("p"),
524524
component_prefix: None,
525525
component_tag_name: None,
526526
attrs: Vec::new_in(&allocator),
@@ -538,7 +538,7 @@ mod tests {
538538
children.push(HtmlNode::Element(Box::new_in(child2, &allocator)));
539539

540540
let root = HtmlElement {
541-
name: Atom::from("div"),
541+
name: Ident::from("div"),
542542
component_prefix: None,
543543
component_tag_name: None,
544544
attrs: Vec::new_in(&allocator),
@@ -565,7 +565,7 @@ mod tests {
565565
let allocator = Allocator::default();
566566

567567
let text = HtmlText {
568-
value: Atom::from("Hello"),
568+
value: Ident::from("Hello"),
569569
span: Span::default(),
570570
full_start: None,
571571
tokens: Vec::new_in(&allocator),

0 commit comments

Comments
 (0)