Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "pull changes from oxc-project/oxc" #2

Merged
merged 28 commits into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
e48392a
Revert "chore(deps): update dependency @codemirror/autocomplete to v6…
a-rustacean Mar 4, 2024
1f1d1e6
Revert "chore(deps): update dependency @types/node to v20.11.24 (#2585)"
a-rustacean Mar 4, 2024
07125c3
Revert "fix(parser): parse empty method declaration as TSEmptyBodyFun…
a-rustacean Mar 4, 2024
f1bbfdc
Revert "feat(napi/parser): expose `preserveParans` option (#2582)"
a-rustacean Mar 4, 2024
a219430
Revert "fix(ast): support TSIndexSignature.readonly (#2579)"
a-rustacean Mar 4, 2024
b3ed378
Revert "feat(codegen): add sourcemap (#2565)"
a-rustacean Mar 4, 2024
4ecc275
Revert "fix(ast): support FormalParameter.override (#2577)"
a-rustacean Mar 4, 2024
965ac56
Revert "fix(ast): change TSMappedType.type_annotation from TSTypeAnno…
a-rustacean Mar 4, 2024
ea4d126
Revert "fix(parser): TSConditionalType span start (#2570)"
a-rustacean Mar 4, 2024
7d2a34f
Revert "fix(oxc_language_server): use config path at init (#2569)"
a-rustacean Mar 4, 2024
c5672fa
Revert "fix(parser): set span end for TSEnumDeclaration (#2573)"
a-rustacean Mar 4, 2024
156b92d
Revert "fix(parser): don't parse null as a literal type (#2572)"
a-rustacean Mar 4, 2024
12fdb26
Revert "fix(oxc_language_server): serialize with camelCase (#2568)"
a-rustacean Mar 4, 2024
d143952
Revert "fix(ast): rename serialized fields to camel case (#2566)"
a-rustacean Mar 4, 2024
62fe057
Revert "perf(parser): lex JSXText with memchr (#2558)"
a-rustacean Mar 4, 2024
9ba1920
Revert "fix(linter): fix getter return rule false positives in TypeSc…
a-rustacean Mar 4, 2024
f85bfb0
Revert "refactor(parser): `byte_search` macro evaluate to matched byt…
a-rustacean Mar 4, 2024
f4eabf8
Revert "refactor(parser): small efficiencies in `byte_search` macro u…
a-rustacean Mar 4, 2024
cda35c3
Revert "refactor(ast) improve ExportDefaultDeclarationKind's is_types…
a-rustacean Mar 4, 2024
2077a64
Revert "refactor(parser): remove start params for `byte_search` macro…
a-rustacean Mar 4, 2024
c81fad5
Revert "feat(transformer/typescript): support transform constructor m…
a-rustacean Mar 4, 2024
a9b82ce
Revert "fix(semantic): jsx reference with an incorrect node id (#2546)"
a-rustacean Mar 4, 2024
7be0a87
Revert "refactor(parser): simplify `byte_search` macro (#2552)"
a-rustacean Mar 4, 2024
5f9418a
Revert "feat(tasks/transformer): enable typescript when the typescrip…
a-rustacean Mar 4, 2024
3a7142d
Revert "fix(ast): missing visit JSXElementName enum (#2547)"
a-rustacean Mar 4, 2024
3aa76a2
Revert "refactor(parser): remove unsafe code in lexer (#2549)"
a-rustacean Mar 4, 2024
d848dad
Revert "refactor(semantic/jsdoc): Misc fixes for JSDoc related things…
a-rustacean Mar 4, 2024
a778a92
Revert "feat(linter/import): partial support namespace check (#2538)"
a-rustacean Mar 4, 2024
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
5 changes: 3 additions & 2 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
- '**/*.rs'
- 'Cargo.lock'
- '.github/workflows/benchmark.yml'
- '!crates/oxc_codegen'
push:
branches:
- main
Expand All @@ -16,6 +17,7 @@ on:
- '**/*.rs'
- 'Cargo.lock'
- '.github/workflows/benchmark.yml'
- '!crates/oxc_codegen'

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
Expand Down Expand Up @@ -48,15 +50,14 @@ jobs:
RUSTFLAGS: "-C debuginfo=2 -C strip=none -g --cfg codspeed"
shell: bash
run: |
cargo build --release -p oxc_benchmark --features codspeed --bench lexer --bench parser --bench transformer --bench semantic --bench linter --bench minifier --bench codegen_sourcemap
cargo build --release -p oxc_benchmark --features codspeed --bench lexer --bench parser --bench transformer --bench semantic --bench linter --bench minifier
mkdir -p target/codspeed/oxc_benchmark/
mv target/release/deps/lexer-* target/codspeed/oxc_benchmark
mv target/release/deps/parser-* target/codspeed/oxc_benchmark
mv target/release/deps/transformer-* target/codspeed/oxc_benchmark
mv target/release/deps/semantic-* target/codspeed/oxc_benchmark
mv target/release/deps/linter-* target/codspeed/oxc_benchmark
mv target/release/deps/minifier-* target/codspeed/oxc_benchmark
mv target/release/deps/codegen_sourcemap-* target/codspeed/oxc_benchmark
rm -rf target/codspeed/oxc_benchmark/*.d

- name: Run benchmark
Expand Down
83 changes: 3 additions & 80 deletions Cargo.lock

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

23 changes: 14 additions & 9 deletions crates/oxc_ast/src/ast/js.rs
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ pub struct ThisExpression {

/// <https://tc39.es/ecma262/#prod-ArrayLiteral>
#[derive(Debug, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize), serde(tag = "type", rename_all = "camelCase"))]
#[cfg_attr(feature = "serde", derive(Serialize), serde(tag = "type"))]
#[cfg_attr(all(feature = "serde", feature = "wasm"), derive(tsify::Tsify))]
pub struct ArrayExpression<'a> {
#[cfg_attr(feature = "serde", serde(flatten))]
Expand Down Expand Up @@ -414,7 +414,7 @@ impl<'a> ArrayExpressionElement<'a> {

/// Object Expression
#[derive(Debug, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize), serde(tag = "type", rename_all = "camelCase"))]
#[cfg_attr(feature = "serde", derive(Serialize), serde(tag = "type"))]
#[cfg_attr(all(feature = "serde", feature = "wasm"), derive(tsify::Tsify))]
pub struct ObjectExpression<'a> {
#[cfg_attr(feature = "serde", serde(flatten))]
Expand Down Expand Up @@ -968,7 +968,7 @@ pub enum AssignmentTargetPattern<'a> {
}

#[derive(Debug, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize), serde(tag = "type", rename_all = "camelCase"))]
#[cfg_attr(feature = "serde", derive(Serialize), serde(tag = "type"))]
#[cfg_attr(all(feature = "serde", feature = "wasm"), derive(tsify::Tsify))]
pub struct ArrayAssignmentTarget<'a> {
#[cfg_attr(feature = "serde", serde(flatten))]
Expand Down Expand Up @@ -1770,8 +1770,6 @@ pub enum FunctionType {
FunctionDeclaration,
FunctionExpression,
TSDeclareFunction,
/// <https://github.com/typescript-eslint/typescript-eslint/pull/1289>
TSEmptyBodyFunctionExpression,
}

/// <https://tc39.es/ecma262/#prod-FormalParameters>
Expand Down Expand Up @@ -1801,7 +1799,6 @@ pub struct FormalParameter<'a> {
pub pattern: BindingPattern<'a>,
pub accessibility: Option<TSAccessibility>,
pub readonly: bool,
pub r#override: bool,
pub decorators: Vec<'a, Decorator<'a>>,
}

Expand Down Expand Up @@ -2410,11 +2407,19 @@ impl<'a> ExportDefaultDeclarationKind<'a> {
#[inline]
pub fn is_typescript_syntax(&self) -> bool {
match self {
ExportDefaultDeclarationKind::FunctionDeclaration(func) => func.is_typescript_syntax(),
ExportDefaultDeclarationKind::ClassDeclaration(class) => class.is_typescript_syntax(),
ExportDefaultDeclarationKind::FunctionDeclaration(func)
if func.is_typescript_syntax() =>
{
true
}
ExportDefaultDeclarationKind::ClassDeclaration(class)
if class.is_typescript_syntax() =>
{
true
}
ExportDefaultDeclarationKind::TSInterfaceDeclaration(_)
| ExportDefaultDeclarationKind::TSEnumDeclaration(_) => true,
ExportDefaultDeclarationKind::Expression(_) => false,
_ => false,
}
}
}
Expand Down
14 changes: 1 addition & 13 deletions crates/oxc_ast/src/ast/ts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,17 +137,6 @@ impl<'a> TSType<'a> {
pub fn is_const_type_reference(&self) -> bool {
matches!(self, TSType::TSTypeReference(reference) if reference.type_name.is_const())
}

/// Check if type maybe `undefined`
pub fn is_maybe_undefined(&self) -> bool {
match self {
TSType::TSUndefinedKeyword(_) => true,
TSType::TSUnionType(un) => {
un.types.iter().any(|t| matches!(t, TSType::TSUndefinedKeyword(_)))
}
_ => false,
}
}
}

/// `SomeType extends OtherType ? TrueType : FalseType;`
Expand Down Expand Up @@ -582,7 +571,6 @@ pub struct TSIndexSignature<'a> {
pub span: Span,
pub parameters: Vec<'a, Box<'a, TSIndexSignatureName<'a>>>,
pub type_annotation: Box<'a, TSTypeAnnotation<'a>>,
pub readonly: bool,
}

#[derive(Debug, Hash)]
Expand Down Expand Up @@ -837,7 +825,7 @@ pub struct TSMappedType<'a> {
pub span: Span,
pub type_parameter: Box<'a, TSTypeParameter<'a>>,
pub name_type: Option<TSType<'a>>,
pub type_annotation: Option<TSType<'a>>,
pub type_annotation: Option<Box<'a, TSTypeAnnotation<'a>>>,
pub optional: TSMappedTypeModifierOperator,
pub readonly: TSMappedTypeModifierOperator,
}
Expand Down
7 changes: 2 additions & 5 deletions crates/oxc_ast/src/ast_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -796,10 +796,9 @@ impl<'a> AstBuilder<'a> {
pattern: BindingPattern<'a>,
accessibility: Option<TSAccessibility>,
readonly: bool,
r#override: bool,
decorators: Vec<'a, Decorator<'a>>,
) -> FormalParameter<'a> {
FormalParameter { span, pattern, accessibility, readonly, r#override, decorators }
FormalParameter { span, pattern, accessibility, readonly, decorators }
}

pub fn ts_this_parameter(
Expand Down Expand Up @@ -1365,13 +1364,11 @@ impl<'a> AstBuilder<'a> {
span: Span,
parameters: Vec<'a, Box<'a, TSIndexSignatureName<'a>>>,
type_annotation: Box<'a, TSTypeAnnotation<'a>>,
readonly: bool,
) -> TSSignature<'a> {
TSSignature::TSIndexSignature(self.alloc(TSIndexSignature {
span,
parameters,
type_annotation,
readonly,
}))
}

Expand Down Expand Up @@ -1670,7 +1667,7 @@ impl<'a> AstBuilder<'a> {
span: Span,
type_parameter: Box<'a, TSTypeParameter<'a>>,
name_type: Option<TSType<'a>>,
type_annotation: Option<TSType<'a>>,
type_annotation: Option<Box<'a, TSTypeAnnotation<'a>>>,
optional: TSMappedTypeModifierOperator,
readonly: TSMappedTypeModifierOperator,
) -> TSType<'a> {
Expand Down
7 changes: 1 addition & 6 deletions crates/oxc_ast/src/visit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1044,11 +1044,6 @@ pub trait Visit<'a>: Sized {
fn visit_jsx_element_name(&mut self, name: &JSXElementName<'a>) {
let kind = AstKind::JSXElementName(self.alloc(name));
self.enter_node(kind);
match name {
JSXElementName::Identifier(ident) => self.visit_jsx_identifier(ident),
JSXElementName::NamespacedName(expr) => self.visit_jsx_namespaced_name(expr),
JSXElementName::MemberExpression(expr) => self.visit_jsx_member_expression(expr),
}
self.leave_node(kind);
}

Expand Down Expand Up @@ -1668,7 +1663,7 @@ pub trait Visit<'a>: Sized {
self.visit_ts_type(name);
}
if let Some(type_annotation) = &ty.type_annotation {
self.visit_ts_type(type_annotation);
self.visit_ts_type_annotation(type_annotation);
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_ast/src/visit_mut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1667,7 +1667,7 @@ pub trait VisitMut<'a>: Sized {
self.visit_ts_type(name);
}
if let Some(type_annotation) = &mut ty.type_annotation {
self.visit_ts_type(type_annotation);
self.visit_ts_type_annotation(type_annotation);
}
}

Expand Down
5 changes: 2 additions & 3 deletions crates/oxc_codegen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ oxc_ast = { workspace = true }
oxc_span = { workspace = true }
oxc_allocator = { workspace = true }
oxc_syntax = { workspace = true }
sourcemap = { version = "7.0.1" }
bitflags = { workspace = true }

bitflags = { workspace = true }

[dev-dependencies]
oxc_parser = { workspace = true }
base64 = "0.21.7"
Loading
Loading