Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 39 additions & 38 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 12 additions & 12 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -87,19 +87,19 @@ multiple_crate_versions = "allow"

[workspace.dependencies]
# External oxc crates from crates.io
oxc_allocator = "0.159"
oxc_ast = "0.159"
oxc_ast_visit = "0.159"
oxc_diagnostics = "0.159"
oxc_napi = "0.159"
oxc_parser = "0.159"
oxc_semantic = "0.159"
oxc_span = "0.159"
oxc_syntax = "0.159"
oxc_allocator = "0.160"
oxc_ast = "0.160"
oxc_ast_visit = "0.160"
oxc_diagnostics = "0.160"
oxc_napi = "0.160"
oxc_parser = "0.160"
oxc_semantic = "0.160"
oxc_span = "0.160"
oxc_syntax = "0.160"
oxc_sourcemap = "9.0.0"
oxc_str = "0.159"
oxc_transformer = "0.159"
oxc_codegen = "0.159"
oxc_str = "0.160"
oxc_transformer = "0.160"
oxc_codegen = "0.160"

# Internal
oxc_angular_compiler = { path = "crates/oxc_angular_compiler" }
Expand Down
6 changes: 3 additions & 3 deletions crates/oxc_angular_compiler/src/browser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,15 +163,15 @@ impl<'a> VisitMut<'a> for SplitDecoratedStaticFields<'a> {
let ClassElement::PropertyDefinition(prop) = &mut element else { unreachable!() };
let this = Expression::new_this_expression(SPAN, &ast);
let target = match &prop.key {
PropertyKey::StaticIdentifier(id) if !prop.computed => {
PropertyKey::StaticIdentifier(id) => {
let name = IdentifierName::new(id.span, id.name, &ast);
AssignmentTarget::new_static_member_expression(SPAN, this, name, false, &ast)
}
PropertyKey::StringLiteral(lit) if !prop.computed => {
PropertyKey::StaticStringLiteral(lit) => {
let key = Expression::StringLiteral(lit.clone_in(allocator));
AssignmentTarget::new_computed_member_expression(SPAN, this, key, false, &ast)
}
PropertyKey::NumericLiteral(lit) if !prop.computed => {
PropertyKey::StaticNumericLiteral(lit) => {
let key = Expression::NumericLiteral(lit.clone_in(allocator));
AssignmentTarget::new_computed_member_expression(SPAN, this, key, false, &ast)
}
Expand Down
8 changes: 6 additions & 2 deletions crates/oxc_angular_compiler/src/class_metadata/builders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1696,7 +1696,9 @@ fn get_decorator_name<'a>(decorator: &Decorator<'a>) -> Option<&'a str> {
fn get_property_key_name<'a>(key: &PropertyKey<'a>) -> Option<Ident<'a>> {
match key {
PropertyKey::StaticIdentifier(id) => Some(id.name.into()),
PropertyKey::StringLiteral(lit) => lit.value.as_str().map(Ident::from),
PropertyKey::StaticStringLiteral(lit) | PropertyKey::StringLiteral(lit) => {
lit.value.as_str().map(Ident::from)
}
_ => None,
}
}
Expand All @@ -1716,7 +1718,9 @@ fn member_key_name<'a>(
let quoted = |value: oxc_str::JSStr<'a>| Some((js_str_to_ident(value, allocator), true));
match key {
PropertyKey::StaticIdentifier(id) => Some((id.name.into(), false)),
PropertyKey::StringLiteral(lit) => quoted(lit.value),
PropertyKey::StaticStringLiteral(lit) | PropertyKey::StringLiteral(lit) => {
quoted(lit.value)
}
PropertyKey::TemplateLiteral(tpl) if tpl.expressions.is_empty() => {
tpl.quasis.first().and_then(|q| q.value.cooked.and_then(quoted))
}
Expand Down
17 changes: 10 additions & 7 deletions crates/oxc_angular_compiler/src/component/decorator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ pub fn extract_component_metadata<'a>(
{
// A string key with a lone surrogate (`'\uD800'`) has no `&str`
// form and names no option, so it is ignored like any unknown key.
if matches!(&prop.key, PropertyKey::StringLiteral(lit) if lit.value.has_lone_surrogate())
if matches!(&prop.key, PropertyKey::StaticStringLiteral(lit) | PropertyKey::StringLiteral(lit) if lit.value.has_lone_surrogate())
{
continue;
}
Expand Down Expand Up @@ -129,7 +129,7 @@ pub fn extract_component_metadata<'a>(
// ngtsc's `reflectObjectLiteral` drops computed keys and
// folds duplicate `styles` entries with `Map.set` — the
// last one is the only one `parseDirectiveStyles` sees.
if prop.computed {
if prop.key.is_computed() {
continue;
}
// Anything that isn't styles is an error `styles_error` reports.
Expand Down Expand Up @@ -173,7 +173,7 @@ pub fn extract_component_metadata<'a>(
// `host_metadata_error` doesn't see this property either —
// an invalid one must not be applied here where it would
// be dropped silently.
if !prop.computed {
if !prop.key.is_computed() {
metadata.host =
extract_host_metadata(allocator, &prop.value, source_text, consts);
}
Expand Down Expand Up @@ -385,7 +385,9 @@ fn get_property_key_name<'a>(
) -> Option<Ident<'a>> {
match key {
PropertyKey::StaticIdentifier(id) => Some(id.name.clone().into()),
PropertyKey::StringLiteral(lit) => lit.value.as_str().map(Ident::from),
PropertyKey::StaticStringLiteral(lit) | PropertyKey::StringLiteral(lit) => {
lit.value.as_str().map(Ident::from)
}
// Computed identifier reference: `[FOO]: bar` — resolve against same-file consts.
PropertyKey::Identifier(id) => consts.get(id.name.as_str()).cloned(),
_ => None,
Expand Down Expand Up @@ -452,7 +454,7 @@ pub fn extract_component_resource_urls_of<'a>(
if let ObjectPropertyKind::ObjectProperty(prop) = prop
&& is_metadata_property(prop)
{
if matches!(&prop.key, PropertyKey::StringLiteral(lit) if lit.value.has_lone_surrogate())
if matches!(&prop.key, PropertyKey::StaticStringLiteral(lit) | PropertyKey::StringLiteral(lit) if lit.value.has_lone_surrogate())
{
continue;
}
Expand Down Expand Up @@ -530,9 +532,10 @@ fn read_deferred_imports<'a>(
for property in &object.properties {
let ObjectPropertyKind::ObjectProperty(property) = property else { continue };
let block = match &property.key {
_ if property.computed => continue,
_ if property.key.is_computed() => continue,
PropertyKey::StaticIdentifier(id) => id.name,
PropertyKey::StringLiteral(literal) => match literal.value.as_str() {
PropertyKey::StaticStringLiteral(literal)
| PropertyKey::StringLiteral(literal) => match literal.value.as_str() {
Some(name) => Ident::from(name),
None => continue,
},
Expand Down
6 changes: 4 additions & 2 deletions crates/oxc_angular_compiler/src/component/hmr_fingerprint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,15 @@ fn collect_excluded_ranges(
if property.kind != PropertyKind::Init
|| property.method
|| property.shorthand
|| property.computed
|| property.key.is_computed()
{
continue;
}
let name = match &property.key {
PropertyKey::StaticIdentifier(id) => Some(id.name.as_str()),
PropertyKey::StringLiteral(lit) => lit.value.as_str(),
PropertyKey::StaticStringLiteral(lit) | PropertyKey::StringLiteral(lit) => {
lit.value.as_str()
}
_ => None,
};
// `template` is a string; `styles` is a string or an array of them.
Expand Down
Loading
Loading