mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 04:08:41 +00:00
refactor(semantic)!: remove SymbolFlags::Export (#7414)
close: #7338 close: #7344 The `SymbolFlags::Export` is Initially used to solve `ExportSpecifier` that is not `IdentifierReference` that causes we cannot determine whether a Binding is not used everywhere by `Semantic`. Since #3820 this problem is solved, so we don't need `SymbolFlags::Export` no longer. Also, removing this can help us easier to pass the `Semantic` check in `Transformer`
This commit is contained in:
parent
c90537f1f0
commit
27b2268a6c
29 changed files with 331 additions and 2057 deletions
|
|
@ -564,32 +564,6 @@ impl<'a> SemanticBuilder<'a> {
|
|||
pub(crate) fn add_redeclare_variable(&mut self, symbol_id: SymbolId, span: Span) {
|
||||
self.symbols.add_redeclaration(symbol_id, span);
|
||||
}
|
||||
|
||||
fn add_export_flag_to_export_identifiers(&mut self, program: &Program<'a>) {
|
||||
for stmt in &program.body {
|
||||
if let Statement::ExportDefaultDeclaration(decl) = stmt {
|
||||
if let ExportDefaultDeclarationKind::Identifier(ident) = &decl.declaration {
|
||||
self.add_export_flag_to_identifier(ident.name.as_str());
|
||||
}
|
||||
}
|
||||
if let Statement::ExportNamedDeclaration(decl) = stmt {
|
||||
for specifier in &decl.specifiers {
|
||||
if specifier.export_kind.is_value() {
|
||||
if let Some(name) = specifier.local.identifier_name() {
|
||||
self.add_export_flag_to_identifier(name.as_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Flag the symbol bound to an identifier in the current scope as exported.
|
||||
fn add_export_flag_to_identifier(&mut self, name: &str) {
|
||||
if let Some(symbol_id) = self.scope.get_binding(self.current_scope_id, name) {
|
||||
self.symbols.union_flag(symbol_id, SymbolFlags::Export);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Visit<'a> for SemanticBuilder<'a> {
|
||||
|
|
@ -1870,19 +1844,7 @@ impl<'a> SemanticBuilder<'a> {
|
|||
/* cfg */
|
||||
|
||||
match kind {
|
||||
AstKind::ExportDefaultDeclaration(decl) => {
|
||||
// Only if the declaration has an ID, we mark it as an export
|
||||
if match &decl.declaration {
|
||||
ExportDefaultDeclarationKind::FunctionDeclaration(func) => func.id.is_some(),
|
||||
ExportDefaultDeclarationKind::ClassDeclaration(class) => class.id.is_some(),
|
||||
ExportDefaultDeclarationKind::TSInterfaceDeclaration(_) => true,
|
||||
_ => false,
|
||||
} {
|
||||
self.current_symbol_flags |= SymbolFlags::Export;
|
||||
}
|
||||
}
|
||||
AstKind::ExportNamedDeclaration(decl) => {
|
||||
self.current_symbol_flags |= SymbolFlags::Export;
|
||||
if decl.export_kind.is_type() {
|
||||
self.current_reference_flags = ReferenceFlags::Type;
|
||||
}
|
||||
|
|
@ -1959,7 +1921,6 @@ impl<'a> SemanticBuilder<'a> {
|
|||
.get(module_declaration.id.name().as_str())
|
||||
.copied();
|
||||
self.namespace_stack.push(symbol_id);
|
||||
self.current_symbol_flags -= SymbolFlags::Export;
|
||||
}
|
||||
AstKind::TSTypeAliasDeclaration(type_alias_declaration) => {
|
||||
type_alias_declaration.bind(self);
|
||||
|
|
@ -2048,16 +2009,10 @@ impl<'a> SemanticBuilder<'a> {
|
|||
#[allow(clippy::single_match)]
|
||||
fn leave_kind(&mut self, kind: AstKind<'a>) {
|
||||
match kind {
|
||||
AstKind::Program(program) => {
|
||||
self.add_export_flag_to_export_identifiers(program);
|
||||
}
|
||||
AstKind::Class(_) => {
|
||||
self.current_node_flags -= NodeFlags::Class;
|
||||
self.class_table_builder.pop_class();
|
||||
}
|
||||
AstKind::BindingIdentifier(_) => {
|
||||
self.current_symbol_flags -= SymbolFlags::Export;
|
||||
}
|
||||
AstKind::ExportSpecifier(_) => {
|
||||
if !self.current_reference_flags.is_type_only() {
|
||||
self.current_reference_flags = ReferenceFlags::empty();
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
---
|
||||
source: crates/oxc_semantic/tests/main.rs
|
||||
input_file: crates/oxc_semantic/tests/fixtures/oxc/type-declarations/signatures/property-with-type-import.ts
|
||||
snapshot_kind: text
|
||||
---
|
||||
[
|
||||
{
|
||||
|
|
@ -73,7 +72,7 @@ snapshot_kind: text
|
|||
]
|
||||
},
|
||||
{
|
||||
"flags": "SymbolFlags(Export | Interface)",
|
||||
"flags": "SymbolFlags(Interface)",
|
||||
"id": 2,
|
||||
"name": "A",
|
||||
"node": "TSInterfaceDeclaration",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
---
|
||||
source: crates/oxc_semantic/tests/main.rs
|
||||
input_file: crates/oxc_semantic/tests/fixtures/typescript-eslint/export/default-type.ts
|
||||
snapshot_kind: text
|
||||
---
|
||||
[
|
||||
{
|
||||
|
|
@ -19,7 +18,7 @@ snapshot_kind: text
|
|||
"node": "Program",
|
||||
"symbols": [
|
||||
{
|
||||
"flags": "SymbolFlags(BlockScopedVariable | ConstVariable | Export | TypeAlias)",
|
||||
"flags": "SymbolFlags(BlockScopedVariable | ConstVariable | TypeAlias)",
|
||||
"id": 0,
|
||||
"name": "T",
|
||||
"node": "VariableDeclarator(T)",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
---
|
||||
source: crates/oxc_semantic/tests/main.rs
|
||||
input_file: crates/oxc_semantic/tests/fixtures/typescript-eslint/export/default1.ts
|
||||
snapshot_kind: text
|
||||
---
|
||||
[
|
||||
{
|
||||
|
|
@ -19,7 +18,7 @@ snapshot_kind: text
|
|||
"node": "Program",
|
||||
"symbols": [
|
||||
{
|
||||
"flags": "SymbolFlags(BlockScopedVariable | Export | Function)",
|
||||
"flags": "SymbolFlags(BlockScopedVariable | Function)",
|
||||
"id": 0,
|
||||
"name": "f",
|
||||
"node": "Function(f)",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
---
|
||||
source: crates/oxc_semantic/tests/main.rs
|
||||
input_file: crates/oxc_semantic/tests/fixtures/typescript-eslint/export/default2.ts
|
||||
snapshot_kind: text
|
||||
---
|
||||
[
|
||||
{
|
||||
|
|
@ -11,7 +10,7 @@ snapshot_kind: text
|
|||
"node": "Program",
|
||||
"symbols": [
|
||||
{
|
||||
"flags": "SymbolFlags(BlockScopedVariable | ConstVariable | Export)",
|
||||
"flags": "SymbolFlags(BlockScopedVariable | ConstVariable)",
|
||||
"id": 0,
|
||||
"name": "a",
|
||||
"node": "VariableDeclarator(a)",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
---
|
||||
source: crates/oxc_semantic/tests/main.rs
|
||||
input_file: crates/oxc_semantic/tests/fixtures/typescript-eslint/export/named-dual.ts
|
||||
snapshot_kind: text
|
||||
---
|
||||
[
|
||||
{
|
||||
|
|
@ -19,7 +18,7 @@ snapshot_kind: text
|
|||
"node": "Program",
|
||||
"symbols": [
|
||||
{
|
||||
"flags": "SymbolFlags(BlockScopedVariable | ConstVariable | Export | TypeAlias)",
|
||||
"flags": "SymbolFlags(BlockScopedVariable | ConstVariable | TypeAlias)",
|
||||
"id": 0,
|
||||
"name": "T",
|
||||
"node": "VariableDeclarator(T)",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
---
|
||||
source: crates/oxc_semantic/tests/main.rs
|
||||
input_file: crates/oxc_semantic/tests/fixtures/typescript-eslint/export/named-type1.ts
|
||||
snapshot_kind: text
|
||||
---
|
||||
[
|
||||
{
|
||||
|
|
@ -19,7 +18,7 @@ snapshot_kind: text
|
|||
"node": "Program",
|
||||
"symbols": [
|
||||
{
|
||||
"flags": "SymbolFlags(Export | TypeAlias)",
|
||||
"flags": "SymbolFlags(TypeAlias)",
|
||||
"id": 0,
|
||||
"name": "X",
|
||||
"node": "TSTypeAliasDeclaration",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
---
|
||||
source: crates/oxc_semantic/tests/main.rs
|
||||
input_file: crates/oxc_semantic/tests/fixtures/typescript-eslint/export/named1.ts
|
||||
snapshot_kind: text
|
||||
---
|
||||
[
|
||||
{
|
||||
|
|
@ -11,7 +10,7 @@ snapshot_kind: text
|
|||
"node": "Program",
|
||||
"symbols": [
|
||||
{
|
||||
"flags": "SymbolFlags(BlockScopedVariable | ConstVariable | Export)",
|
||||
"flags": "SymbolFlags(BlockScopedVariable | ConstVariable)",
|
||||
"id": 0,
|
||||
"name": "x",
|
||||
"node": "VariableDeclarator(x)",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
---
|
||||
source: crates/oxc_semantic/tests/main.rs
|
||||
input_file: crates/oxc_semantic/tests/fixtures/typescript-eslint/export/named2-type.ts
|
||||
snapshot_kind: text
|
||||
---
|
||||
[
|
||||
{
|
||||
|
|
@ -19,7 +18,7 @@ snapshot_kind: text
|
|||
"node": "Program",
|
||||
"symbols": [
|
||||
{
|
||||
"flags": "SymbolFlags(Export | TypeAlias)",
|
||||
"flags": "SymbolFlags(TypeAlias)",
|
||||
"id": 0,
|
||||
"name": "A",
|
||||
"node": "TSTypeAliasDeclaration",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
---
|
||||
source: crates/oxc_semantic/tests/main.rs
|
||||
input_file: crates/oxc_semantic/tests/fixtures/typescript-eslint/export/named2.ts
|
||||
snapshot_kind: text
|
||||
---
|
||||
[
|
||||
{
|
||||
|
|
@ -11,7 +10,7 @@ snapshot_kind: text
|
|||
"node": "Program",
|
||||
"symbols": [
|
||||
{
|
||||
"flags": "SymbolFlags(BlockScopedVariable | ConstVariable | Export)",
|
||||
"flags": "SymbolFlags(BlockScopedVariable | ConstVariable)",
|
||||
"id": 0,
|
||||
"name": "a",
|
||||
"node": "VariableDeclarator(a)",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
---
|
||||
source: crates/oxc_semantic/tests/main.rs
|
||||
input_file: crates/oxc_semantic/tests/fixtures/typescript-eslint/export/named3-type.ts
|
||||
snapshot_kind: text
|
||||
---
|
||||
[
|
||||
{
|
||||
|
|
@ -19,7 +18,7 @@ snapshot_kind: text
|
|||
"node": "Program",
|
||||
"symbols": [
|
||||
{
|
||||
"flags": "SymbolFlags(Export | TypeAlias)",
|
||||
"flags": "SymbolFlags(TypeAlias)",
|
||||
"id": 0,
|
||||
"name": "V",
|
||||
"node": "TSTypeAliasDeclaration",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
---
|
||||
source: crates/oxc_semantic/tests/main.rs
|
||||
input_file: crates/oxc_semantic/tests/fixtures/typescript-eslint/export/named3.ts
|
||||
snapshot_kind: text
|
||||
---
|
||||
[
|
||||
{
|
||||
|
|
@ -11,7 +10,7 @@ snapshot_kind: text
|
|||
"node": "Program",
|
||||
"symbols": [
|
||||
{
|
||||
"flags": "SymbolFlags(BlockScopedVariable | ConstVariable | Export)",
|
||||
"flags": "SymbolFlags(BlockScopedVariable | ConstVariable)",
|
||||
"id": 0,
|
||||
"name": "v",
|
||||
"node": "VariableDeclarator(v)",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
---
|
||||
source: crates/oxc_semantic/tests/main.rs
|
||||
input_file: crates/oxc_semantic/tests/fixtures/typescript-eslint/export/type.ts
|
||||
snapshot_kind: text
|
||||
---
|
||||
[
|
||||
{
|
||||
|
|
@ -19,7 +18,7 @@ snapshot_kind: text
|
|||
"node": "Program",
|
||||
"symbols": [
|
||||
{
|
||||
"flags": "SymbolFlags(BlockScopedVariable | ConstVariable | Export | TypeAlias)",
|
||||
"flags": "SymbolFlags(BlockScopedVariable | ConstVariable | TypeAlias)",
|
||||
"id": 0,
|
||||
"name": "T",
|
||||
"node": "VariableDeclarator(T)",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
---
|
||||
source: crates/oxc_semantic/tests/main.rs
|
||||
input_file: crates/oxc_semantic/tests/fixtures/typescript-eslint/ts-module/declaration-merging/class-namespace.ts
|
||||
snapshot_kind: text
|
||||
---
|
||||
[
|
||||
{
|
||||
|
|
@ -20,7 +19,7 @@ snapshot_kind: text
|
|||
"node": "TSModuleDeclaration(Foo)",
|
||||
"symbols": [
|
||||
{
|
||||
"flags": "SymbolFlags(BlockScopedVariable | ConstVariable | Export)",
|
||||
"flags": "SymbolFlags(BlockScopedVariable | ConstVariable)",
|
||||
"id": 1,
|
||||
"name": "x",
|
||||
"node": "VariableDeclarator(x)",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
---
|
||||
source: crates/oxc_semantic/tests/main.rs
|
||||
input_file: crates/oxc_semantic/tests/fixtures/typescript-eslint/ts-module/declaration-merging/function-namespace.ts
|
||||
snapshot_kind: text
|
||||
---
|
||||
[
|
||||
{
|
||||
|
|
@ -20,7 +19,7 @@ snapshot_kind: text
|
|||
"node": "TSModuleDeclaration(Foo)",
|
||||
"symbols": [
|
||||
{
|
||||
"flags": "SymbolFlags(BlockScopedVariable | ConstVariable | Export)",
|
||||
"flags": "SymbolFlags(BlockScopedVariable | ConstVariable)",
|
||||
"id": 1,
|
||||
"name": "x",
|
||||
"node": "VariableDeclarator(x)",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
---
|
||||
source: crates/oxc_semantic/tests/main.rs
|
||||
input_file: crates/oxc_semantic/tests/fixtures/typescript-eslint/ts-module/external-ref.ts
|
||||
snapshot_kind: text
|
||||
---
|
||||
[
|
||||
{
|
||||
|
|
@ -13,7 +12,7 @@ snapshot_kind: text
|
|||
"node": "TSModuleDeclaration(Foo)",
|
||||
"symbols": [
|
||||
{
|
||||
"flags": "SymbolFlags(BlockScopedVariable | ConstVariable | Export)",
|
||||
"flags": "SymbolFlags(BlockScopedVariable | ConstVariable)",
|
||||
"id": 1,
|
||||
"name": "x",
|
||||
"node": "VariableDeclarator(x)",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
---
|
||||
source: crates/oxc_semantic/tests/main.rs
|
||||
input_file: crates/oxc_semantic/tests/fixtures/typescript-eslint/ts-module/name-shadowed-in-body.ts
|
||||
snapshot_kind: text
|
||||
---
|
||||
[
|
||||
{
|
||||
|
|
@ -13,7 +12,7 @@ snapshot_kind: text
|
|||
"node": "TSModuleDeclaration(Foo)",
|
||||
"symbols": [
|
||||
{
|
||||
"flags": "SymbolFlags(BlockScopedVariable | ConstVariable | Export)",
|
||||
"flags": "SymbolFlags(BlockScopedVariable | ConstVariable)",
|
||||
"id": 1,
|
||||
"name": "Foo",
|
||||
"node": "VariableDeclarator(Foo)",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
---
|
||||
source: crates/oxc_semantic/tests/main.rs
|
||||
input_file: crates/oxc_semantic/tests/fixtures/typescript-eslint/ts-module/namespace.ts
|
||||
snapshot_kind: text
|
||||
---
|
||||
[
|
||||
{
|
||||
|
|
@ -13,7 +12,7 @@ snapshot_kind: text
|
|||
"node": "TSModuleDeclaration(Foo)",
|
||||
"symbols": [
|
||||
{
|
||||
"flags": "SymbolFlags(BlockScopedVariable | ConstVariable | Export)",
|
||||
"flags": "SymbolFlags(BlockScopedVariable | ConstVariable)",
|
||||
"id": 1,
|
||||
"name": "x",
|
||||
"node": "VariableDeclarator(x)",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
---
|
||||
source: crates/oxc_semantic/tests/main.rs
|
||||
input_file: crates/oxc_semantic/tests/fixtures/typescript-eslint/ts-module/self-ref.ts
|
||||
snapshot_kind: text
|
||||
---
|
||||
[
|
||||
{
|
||||
|
|
@ -13,7 +12,7 @@ snapshot_kind: text
|
|||
"node": "TSModuleDeclaration(Foo)",
|
||||
"symbols": [
|
||||
{
|
||||
"flags": "SymbolFlags(BlockScopedVariable | ConstVariable | Export)",
|
||||
"flags": "SymbolFlags(BlockScopedVariable | ConstVariable)",
|
||||
"id": 1,
|
||||
"name": "x",
|
||||
"node": "VariableDeclarator(x)",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
---
|
||||
source: crates/oxc_semantic/tests/main.rs
|
||||
input_file: crates/oxc_semantic/tests/fixtures/typescript-eslint/type-declaration/interface-heritage2.ts
|
||||
snapshot_kind: text
|
||||
---
|
||||
[
|
||||
{
|
||||
|
|
@ -28,7 +27,7 @@ snapshot_kind: text
|
|||
"node": "TSModuleDeclaration(Member)",
|
||||
"symbols": [
|
||||
{
|
||||
"flags": "SymbolFlags(Export | TypeAlias)",
|
||||
"flags": "SymbolFlags(TypeAlias)",
|
||||
"id": 2,
|
||||
"name": "unreferenced",
|
||||
"node": "TSTypeAliasDeclaration",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
---
|
||||
source: crates/oxc_semantic/tests/main.rs
|
||||
input_file: crates/oxc_semantic/tests/fixtures/typescript-eslint/type-declaration/type-query-with-parameters.ts
|
||||
snapshot_kind: text
|
||||
---
|
||||
[
|
||||
{
|
||||
|
|
@ -84,7 +83,7 @@ snapshot_kind: text
|
|||
]
|
||||
},
|
||||
{
|
||||
"flags": "SymbolFlags(Export | TypeAlias)",
|
||||
"flags": "SymbolFlags(TypeAlias)",
|
||||
"id": 3,
|
||||
"name": "Foo",
|
||||
"node": "TSTypeAliasDeclaration",
|
||||
|
|
|
|||
|
|
@ -1,243 +1,7 @@
|
|||
use oxc_semantic::{SemanticBuilderReturn, SymbolFlags};
|
||||
use oxc_semantic::SymbolFlags;
|
||||
|
||||
use crate::util::SemanticTester;
|
||||
|
||||
#[test]
|
||||
fn test_exports() {
|
||||
let test = SemanticTester::js(
|
||||
"
|
||||
function foo(a, b) {
|
||||
let c = a + b;
|
||||
return c / 2
|
||||
}
|
||||
|
||||
export class ExportModifier {
|
||||
constructor(x) {
|
||||
this.x = x;
|
||||
}
|
||||
}
|
||||
|
||||
const defaultExport = 1;
|
||||
|
||||
export { foo };
|
||||
export default defaultExport;
|
||||
",
|
||||
);
|
||||
|
||||
test.has_some_symbol("foo").is_exported().test();
|
||||
test.has_some_symbol("defaultExport").is_exported().test();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_exported_named_function() {
|
||||
let test = SemanticTester::js(
|
||||
"
|
||||
export function foo(a) {
|
||||
let x = 1;
|
||||
}
|
||||
",
|
||||
);
|
||||
test.has_some_symbol("foo").is_exported().test();
|
||||
for name in &["a", "x"] {
|
||||
test.has_some_symbol(name).is_not_exported().test();
|
||||
}
|
||||
|
||||
SemanticTester::ts("export function foo<T>(a: T) { a.length }")
|
||||
.has_some_symbol("T")
|
||||
.is_not_exported()
|
||||
.test();
|
||||
|
||||
SemanticTester::tsx(
|
||||
"
|
||||
import React from 'react';
|
||||
export const Counter: React.FC<{ count: number }> = ({ count }) => (
|
||||
<div>{count}</div>
|
||||
)
|
||||
",
|
||||
)
|
||||
.has_some_symbol("Counter")
|
||||
.is_exported()
|
||||
.contains_flags(
|
||||
SymbolFlags::ConstVariable
|
||||
.union(SymbolFlags::BlockScopedVariable)
|
||||
.union(SymbolFlags::Export),
|
||||
)
|
||||
.test();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_exported_default_function() {
|
||||
let test = SemanticTester::js(
|
||||
"
|
||||
export default function foo(a) {
|
||||
let x = 1;
|
||||
}
|
||||
",
|
||||
);
|
||||
for name in &["a", "x"] {
|
||||
test.has_some_symbol(name).is_not_exported().test();
|
||||
}
|
||||
|
||||
let test = SemanticTester::ts("export default function <T extends string>(a: T) { a.length }");
|
||||
test.has_some_symbol("a").is_not_exported().test();
|
||||
test.has_some_symbol("T").is_not_exported().test();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_exported_named_class() {
|
||||
let test = SemanticTester::ts(
|
||||
"
|
||||
export class Foo<T> {
|
||||
constructor(a) {
|
||||
this.a = a;
|
||||
}
|
||||
|
||||
bar() {
|
||||
return this.a;
|
||||
}
|
||||
}
|
||||
",
|
||||
);
|
||||
|
||||
test.has_class("Foo");
|
||||
test.has_some_symbol("Foo").is_exported().test();
|
||||
// NOTE: bar() is not a symbol. Should it be?
|
||||
for name in &["a", "T"] {
|
||||
test.has_some_symbol(name).is_not_exported().test();
|
||||
}
|
||||
|
||||
SemanticTester::ts(
|
||||
"
|
||||
class Foo {};
|
||||
export { Foo }
|
||||
",
|
||||
)
|
||||
.has_some_symbol("Foo")
|
||||
.is_exported()
|
||||
.test();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_exported_default_class() {
|
||||
let test = SemanticTester::ts(
|
||||
"
|
||||
export default class Foo<T> {
|
||||
constructor(a) {
|
||||
this.a = a;
|
||||
}
|
||||
}
|
||||
",
|
||||
);
|
||||
|
||||
test.has_class("Foo");
|
||||
test.has_some_symbol("a").is_not_exported().test();
|
||||
test.has_some_symbol("T").is_not_exported().test();
|
||||
}
|
||||
|
||||
// FIXME
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn test_exported_enum() {
|
||||
let test = SemanticTester::ts(
|
||||
"
|
||||
export enum Foo {
|
||||
A = 1,
|
||||
B,
|
||||
}
|
||||
",
|
||||
);
|
||||
test.has_some_symbol("Foo").is_exported().contains_flags(SymbolFlags::RegularEnum).test();
|
||||
test.has_some_symbol("A").is_not_exported().contains_flags(SymbolFlags::EnumMember).test();
|
||||
test.has_some_symbol("B").is_not_exported().contains_flags(SymbolFlags::EnumMember).test();
|
||||
}
|
||||
|
||||
// FIXME
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn test_exported_interface() {
|
||||
let test = SemanticTester::ts(
|
||||
"
|
||||
export interface Foo<T> {
|
||||
a: T;
|
||||
}
|
||||
",
|
||||
);
|
||||
test.has_root_symbol("Foo").is_exported().contains_flags(SymbolFlags::Interface).test();
|
||||
test.has_some_symbol("a").is_not_exported().test();
|
||||
test.has_some_symbol("T").is_not_exported().test();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_exports_in_namespace() {
|
||||
let test = SemanticTester::ts(
|
||||
"
|
||||
export const x = 1;
|
||||
namespace N {
|
||||
function foo() {
|
||||
return 1
|
||||
}
|
||||
export function bar() {
|
||||
return foo();
|
||||
}
|
||||
export const x = 2
|
||||
}
|
||||
",
|
||||
);
|
||||
test.has_some_symbol("bar").is_exported().test();
|
||||
let semantic = test.build();
|
||||
assert!(!semantic.module_record().exported_bindings.contains_key("bar"));
|
||||
|
||||
// namespace exported, member is not
|
||||
let sources =
|
||||
["export namespace N { function foo() {} } ", "export namespace N { const foo = 1 } "];
|
||||
for src in sources {
|
||||
let test = SemanticTester::ts(src);
|
||||
test.has_some_symbol("N").contains_flags(SymbolFlags::NameSpaceModule).is_exported().test();
|
||||
test.has_some_symbol("foo").is_not_exported().test();
|
||||
}
|
||||
|
||||
// namespace and member are both exported
|
||||
let sources = [
|
||||
"export namespace N { export function foo() {} } ",
|
||||
"export namespace N { export const foo = 1 } ",
|
||||
];
|
||||
for src in sources {
|
||||
let test = SemanticTester::ts(src);
|
||||
test.has_some_symbol("N").contains_flags(SymbolFlags::NameSpaceModule).is_exported().test();
|
||||
test.has_some_symbol("foo").is_exported().test();
|
||||
}
|
||||
|
||||
// namespace is not exported, but member is
|
||||
let sources =
|
||||
["namespace N { export function foo() {} } ", "namespace N { export const foo = 1 } "];
|
||||
for src in sources {
|
||||
let test = SemanticTester::ts(src);
|
||||
test.has_some_symbol("N")
|
||||
.contains_flags(SymbolFlags::NameSpaceModule)
|
||||
.is_not_exported()
|
||||
.test();
|
||||
test.has_some_symbol("foo").is_exported().test();
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_export_in_invalid_scope() {
|
||||
let test = SemanticTester::js(
|
||||
"
|
||||
function foo() {
|
||||
export const x = 1;
|
||||
}",
|
||||
)
|
||||
.expect_errors(true);
|
||||
test.has_some_symbol("x").contains_flags(SymbolFlags::Export).test();
|
||||
let SemanticBuilderReturn { semantic, errors } = test.build_with_errors();
|
||||
assert!(
|
||||
!errors.is_empty(),
|
||||
"expected an export within a function to produce a check error, but no errors were produced"
|
||||
);
|
||||
assert!(semantic.module_record().exported_bindings.is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_import_assignment() {
|
||||
SemanticTester::ts("import Foo = require('./foo')")
|
||||
|
|
|
|||
|
|
@ -6,9 +6,8 @@ use crate::util::SemanticTester;
|
|||
fn test_class_simple() {
|
||||
SemanticTester::js("export class Foo {};")
|
||||
.has_root_symbol("Foo")
|
||||
.contains_flags(SymbolFlags::Class | SymbolFlags::Export)
|
||||
.contains_flags(SymbolFlags::Class)
|
||||
.has_number_of_references(0)
|
||||
.is_exported()
|
||||
.test();
|
||||
|
||||
SemanticTester::js("class Foo {}; let f = new Foo()")
|
||||
|
|
@ -124,44 +123,6 @@ fn test_types_simple() {
|
|||
.test();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_export_flag() {
|
||||
let tester = SemanticTester::js(
|
||||
"
|
||||
const a = 1;
|
||||
export { a, b as d };
|
||||
class b {}
|
||||
export default c;
|
||||
function c() {}
|
||||
",
|
||||
);
|
||||
|
||||
tester.has_root_symbol("a").is_exported().test();
|
||||
tester.has_root_symbol("b").is_exported().test();
|
||||
tester.has_root_symbol("c").is_exported().test();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_export_default_flag() {
|
||||
let tester = SemanticTester::ts(
|
||||
"
|
||||
export default function func() {}
|
||||
export default class cls {}
|
||||
export default interface face {}
|
||||
|
||||
export default (function funcExpr() {});
|
||||
export default (function(param) {});
|
||||
",
|
||||
);
|
||||
|
||||
tester.has_root_symbol("func").is_exported().test();
|
||||
tester.has_root_symbol("cls").is_exported().test();
|
||||
tester.has_root_symbol("face").is_exported().test();
|
||||
|
||||
tester.has_symbol("funcExpr").is_not_exported().test();
|
||||
tester.has_symbol("param").is_not_exported().test();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_multiple_ts_type_alias_declaration() {
|
||||
let tester = SemanticTester::ts(
|
||||
|
|
|
|||
|
|
@ -201,54 +201,6 @@ impl<'a> SymbolTester<'a> {
|
|||
self
|
||||
}
|
||||
|
||||
/// Check that this symbol is exported.
|
||||
///
|
||||
/// Export status is checked using the symbol's [`SymbolFlags`], not by
|
||||
/// checking the [`oxc_semantic::ModuleRecord`].
|
||||
///
|
||||
/// For the inverse of this assertion, use [`SymbolTester::is_not_exported`].
|
||||
#[allow(clippy::wrong_self_convention)]
|
||||
pub fn is_exported(mut self) -> Self {
|
||||
self.test_result = match self.test_result {
|
||||
Ok(symbol_id) => {
|
||||
let binding = self.target_symbol_name.clone();
|
||||
if self.semantic.symbols().get_flags(symbol_id).is_export() {
|
||||
Ok(symbol_id)
|
||||
} else {
|
||||
Err(OxcDiagnostic::error(format!(
|
||||
"Expected {binding} to be exported with SymbolFlags::Export"
|
||||
)))
|
||||
}
|
||||
}
|
||||
e => e,
|
||||
};
|
||||
self
|
||||
}
|
||||
|
||||
/// Check that this symbol is not exported.
|
||||
///
|
||||
/// Export status is checked using the symbol's [`SymbolFlags`], not by
|
||||
/// checking the [`oxc_semantic::ModuleRecord`].
|
||||
///
|
||||
/// For the inverse of this assertion, use [`SymbolTester::is_exported`].
|
||||
#[allow(clippy::wrong_self_convention)]
|
||||
pub fn is_not_exported(mut self) -> Self {
|
||||
self.test_result = match self.test_result {
|
||||
Ok(symbol_id) => {
|
||||
let binding = self.target_symbol_name.clone();
|
||||
if self.semantic.symbols().get_flags(symbol_id).contains(SymbolFlags::Export) {
|
||||
Err(OxcDiagnostic::error(format!(
|
||||
"Expected {binding} to not be exported. Symbol has export flag."
|
||||
)))
|
||||
} else {
|
||||
Ok(symbol_id)
|
||||
}
|
||||
}
|
||||
e => e,
|
||||
};
|
||||
self
|
||||
}
|
||||
|
||||
#[allow(clippy::wrong_self_convention)]
|
||||
pub fn is_in_scope(mut self, expected_flags: ScopeFlags) -> Self {
|
||||
let target_name: &str = self.target_symbol_name.as_ref();
|
||||
|
|
|
|||
|
|
@ -76,29 +76,27 @@ bitflags! {
|
|||
const BlockScopedVariable = 1 << 1;
|
||||
/// A const variable (const)
|
||||
const ConstVariable = 1 << 2;
|
||||
/// Is this symbol inside an export declaration
|
||||
const Export = 1 << 4;
|
||||
const Class = 1 << 5;
|
||||
const Class = 1 << 3;
|
||||
/// `try {} catch(catch_variable) {}`
|
||||
const CatchVariable = 1 << 6;
|
||||
const CatchVariable = 1 << 4;
|
||||
/// A function declaration or expression
|
||||
const Function = 1 << 7;
|
||||
const Function = 1 << 5;
|
||||
/// Imported ESM binding
|
||||
const Import = 1 << 8;
|
||||
const Import = 1 << 6;
|
||||
/// Imported ESM type-only binding
|
||||
const TypeImport = 1 << 9;
|
||||
const TypeImport = 1 << 7;
|
||||
// Type specific symbol flags
|
||||
const TypeAlias = 1 << 10;
|
||||
const Interface = 1 << 11;
|
||||
const RegularEnum = 1 << 12;
|
||||
const ConstEnum = 1 << 13;
|
||||
const EnumMember = 1 << 14;
|
||||
const TypeLiteral = 1 << 15;
|
||||
const TypeParameter = 1 << 16;
|
||||
const NameSpaceModule = 1 << 17;
|
||||
const ValueModule = 1 << 18;
|
||||
const TypeAlias = 1 << 8;
|
||||
const Interface = 1 << 9;
|
||||
const RegularEnum = 1 << 10;
|
||||
const ConstEnum = 1 << 11;
|
||||
const EnumMember = 1 << 12;
|
||||
const TypeLiteral = 1 << 13;
|
||||
const TypeParameter = 1 << 14;
|
||||
const NameSpaceModule = 1 << 15;
|
||||
const ValueModule = 1 << 16;
|
||||
// In a dts file or there is a declare flag
|
||||
const Ambient = 1 << 19;
|
||||
const Ambient = 1 << 17;
|
||||
|
||||
const Enum = Self::ConstEnum.bits() | Self::RegularEnum.bits();
|
||||
const Variable = Self::FunctionScopedVariable.bits() | Self::BlockScopedVariable.bits();
|
||||
|
|
@ -199,11 +197,6 @@ impl SymbolFlags {
|
|||
self.contains(Self::FunctionScopedVariable)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn is_export(&self) -> bool {
|
||||
self.contains(Self::Export)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn is_import(&self) -> bool {
|
||||
self.intersects(Self::Import | Self::TypeImport)
|
||||
|
|
|
|||
|
|
@ -711,16 +711,16 @@ semantic error: Scope flags mismatch:
|
|||
after transform: ScopeId(1): ScopeFlags(StrictMode)
|
||||
rebuilt : ScopeId(1): ScopeFlags(StrictMode | Function)
|
||||
Symbol flags mismatch for "E":
|
||||
after transform: SymbolId(0): SymbolFlags(Export | RegularEnum)
|
||||
rebuilt : SymbolId(0): SymbolFlags(BlockScopedVariable | Export)
|
||||
after transform: SymbolId(0): SymbolFlags(RegularEnum)
|
||||
rebuilt : SymbolId(0): SymbolFlags(BlockScopedVariable)
|
||||
|
||||
tasks/coverage/babel/packages/babel-parser/test/fixtures/typescript/enum/export-const/input.ts
|
||||
semantic error: Scope flags mismatch:
|
||||
after transform: ScopeId(1): ScopeFlags(StrictMode)
|
||||
rebuilt : ScopeId(1): ScopeFlags(StrictMode | Function)
|
||||
Symbol flags mismatch for "E":
|
||||
after transform: SymbolId(0): SymbolFlags(Export | ConstEnum)
|
||||
rebuilt : SymbolId(0): SymbolFlags(BlockScopedVariable | Export)
|
||||
after transform: SymbolId(0): SymbolFlags(ConstEnum)
|
||||
rebuilt : SymbolId(0): SymbolFlags(BlockScopedVariable)
|
||||
|
||||
tasks/coverage/babel/packages/babel-parser/test/fixtures/typescript/enum/export-declare-const/input.ts
|
||||
semantic error: Bindings mismatch:
|
||||
|
|
@ -838,8 +838,8 @@ Scope flags mismatch:
|
|||
after transform: ScopeId(3): ScopeFlags(StrictMode)
|
||||
rebuilt : ScopeId(3): ScopeFlags(StrictMode | Function)
|
||||
Symbol flags mismatch for "D":
|
||||
after transform: SymbolId(3): SymbolFlags(Export | RegularEnum)
|
||||
rebuilt : SymbolId(3): SymbolFlags(BlockScopedVariable | Export)
|
||||
after transform: SymbolId(3): SymbolFlags(RegularEnum)
|
||||
rebuilt : SymbolId(3): SymbolFlags(BlockScopedVariable)
|
||||
|
||||
tasks/coverage/babel/packages/babel-parser/test/fixtures/typescript/export/nested-same-name/input.ts
|
||||
semantic error: Missing SymbolId: "N"
|
||||
|
|
@ -853,9 +853,6 @@ rebuilt : ScopeId(0): [SymbolId(0), SymbolId(1)]
|
|||
Binding symbols mismatch:
|
||||
after transform: ScopeId(1): [SymbolId(2), SymbolId(3)]
|
||||
rebuilt : ScopeId(1): [SymbolId(2), SymbolId(3)]
|
||||
Symbol flags mismatch for "x":
|
||||
after transform: SymbolId(2): SymbolFlags(BlockScopedVariable | ConstVariable | Export)
|
||||
rebuilt : SymbolId(3): SymbolFlags(BlockScopedVariable | ConstVariable)
|
||||
|
||||
tasks/coverage/babel/packages/babel-parser/test/fixtures/typescript/function/annotated/input.ts
|
||||
semantic error: Bindings mismatch:
|
||||
|
|
@ -1491,8 +1488,8 @@ Scope flags mismatch:
|
|||
after transform: ScopeId(2): ScopeFlags(StrictMode)
|
||||
rebuilt : ScopeId(1): ScopeFlags(StrictMode | Function)
|
||||
Symbol flags mismatch for "E":
|
||||
after transform: SymbolId(1): SymbolFlags(Export | RegularEnum)
|
||||
rebuilt : SymbolId(0): SymbolFlags(BlockScopedVariable | Export)
|
||||
after transform: SymbolId(1): SymbolFlags(RegularEnum)
|
||||
rebuilt : SymbolId(0): SymbolFlags(BlockScopedVariable)
|
||||
|
||||
tasks/coverage/babel/packages/babel-parser/test/fixtures/typescript/regression/issue-7742/input.ts
|
||||
semantic error: Bindings mismatch:
|
||||
|
|
@ -1621,16 +1618,16 @@ semantic error: Scope flags mismatch:
|
|||
after transform: ScopeId(1): ScopeFlags(StrictMode)
|
||||
rebuilt : ScopeId(1): ScopeFlags(StrictMode | Function)
|
||||
Symbol flags mismatch for "Test":
|
||||
after transform: SymbolId(0): SymbolFlags(Export | RegularEnum)
|
||||
rebuilt : SymbolId(0): SymbolFlags(FunctionScopedVariable | Export)
|
||||
after transform: SymbolId(0): SymbolFlags(RegularEnum)
|
||||
rebuilt : SymbolId(0): SymbolFlags(FunctionScopedVariable)
|
||||
|
||||
tasks/coverage/babel/packages/babel-parser/test/fixtures/typescript/scope/export-enum-before/input.ts
|
||||
semantic error: Scope flags mismatch:
|
||||
after transform: ScopeId(1): ScopeFlags(StrictMode)
|
||||
rebuilt : ScopeId(1): ScopeFlags(StrictMode | Function)
|
||||
Symbol flags mismatch for "Test":
|
||||
after transform: SymbolId(0): SymbolFlags(Export | RegularEnum)
|
||||
rebuilt : SymbolId(0): SymbolFlags(FunctionScopedVariable | Export)
|
||||
after transform: SymbolId(0): SymbolFlags(RegularEnum)
|
||||
rebuilt : SymbolId(0): SymbolFlags(FunctionScopedVariable)
|
||||
|
||||
tasks/coverage/babel/packages/babel-parser/test/fixtures/typescript/scope/export-func-in-declare-module/input.ts
|
||||
semantic error: Bindings mismatch:
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -601,8 +601,8 @@ Scope flags mismatch:
|
|||
after transform: ScopeId(2): ScopeFlags(StrictMode)
|
||||
rebuilt : ScopeId(2): ScopeFlags(StrictMode | Function)
|
||||
Symbol flags mismatch for "E":
|
||||
after transform: SymbolId(0): SymbolFlags(Export | RegularEnum)
|
||||
rebuilt : SymbolId(0): SymbolFlags(BlockScopedVariable | Export)
|
||||
after transform: SymbolId(0): SymbolFlags(RegularEnum)
|
||||
rebuilt : SymbolId(0): SymbolFlags(BlockScopedVariable)
|
||||
Symbol redeclarations mismatch for "E":
|
||||
after transform: SymbolId(0): [Span { start: 40, end: 41 }]
|
||||
rebuilt : SymbolId(0): []
|
||||
|
|
@ -738,8 +738,8 @@ Scope children mismatch:
|
|||
after transform: ScopeId(0): [ScopeId(1), ScopeId(3)]
|
||||
rebuilt : ScopeId(0): [ScopeId(1)]
|
||||
Symbol flags mismatch for "N":
|
||||
after transform: SymbolId(0): SymbolFlags(Export | Class | NameSpaceModule | Ambient)
|
||||
rebuilt : SymbolId(0): SymbolFlags(Export | Class)
|
||||
after transform: SymbolId(0): SymbolFlags(Class | NameSpaceModule | Ambient)
|
||||
rebuilt : SymbolId(0): SymbolFlags(Class)
|
||||
Symbol reference IDs mismatch for "N":
|
||||
after transform: SymbolId(0): [ReferenceId(0), ReferenceId(2)]
|
||||
rebuilt : SymbolId(0): [ReferenceId(1)]
|
||||
|
|
@ -768,7 +768,7 @@ Scope flags mismatch:
|
|||
after transform: ScopeId(1): ScopeFlags(StrictMode)
|
||||
rebuilt : ScopeId(1): ScopeFlags(StrictMode | Function)
|
||||
Symbol flags mismatch for "None":
|
||||
after transform: SymbolId(0): SymbolFlags(Export | ConstEnum)
|
||||
after transform: SymbolId(0): SymbolFlags(ConstEnum)
|
||||
rebuilt : SymbolId(0): SymbolFlags(FunctionScopedVariable)
|
||||
Symbol reference IDs mismatch for "None":
|
||||
after transform: SymbolId(0): [ReferenceId(0), ReferenceId(2)]
|
||||
|
|
@ -1068,9 +1068,6 @@ rebuilt : SymbolId(0): [ReferenceId(1), ReferenceId(2)]
|
|||
Symbol redeclarations mismatch for "A":
|
||||
after transform: SymbolId(0): [Span { start: 22, end: 23 }]
|
||||
rebuilt : SymbolId(0): []
|
||||
Symbol flags mismatch for "B":
|
||||
after transform: SymbolId(1): SymbolFlags(BlockScopedVariable | ConstVariable | Export)
|
||||
rebuilt : SymbolId(2): SymbolFlags(BlockScopedVariable | ConstVariable)
|
||||
|
||||
* namespace/clobber-enum/input.ts
|
||||
Missing SymbolId: "_A"
|
||||
|
|
@ -1095,9 +1092,6 @@ rebuilt : SymbolId(0): [ReferenceId(3), ReferenceId(5), ReferenceId(6)]
|
|||
Symbol redeclarations mismatch for "A":
|
||||
after transform: SymbolId(0): [Span { start: 30, end: 31 }]
|
||||
rebuilt : SymbolId(0): []
|
||||
Symbol flags mismatch for "B":
|
||||
after transform: SymbolId(2): SymbolFlags(BlockScopedVariable | ConstVariable | Export)
|
||||
rebuilt : SymbolId(3): SymbolFlags(BlockScopedVariable | ConstVariable)
|
||||
|
||||
* namespace/clobber-export/input.ts
|
||||
Missing SymbolId: "_N"
|
||||
|
|
@ -1107,8 +1101,8 @@ Binding symbols mismatch:
|
|||
after transform: ScopeId(2): [SymbolId(1), SymbolId(2)]
|
||||
rebuilt : ScopeId(2): [SymbolId(1), SymbolId(2)]
|
||||
Symbol flags mismatch for "N":
|
||||
after transform: SymbolId(0): SymbolFlags(Export | Class | NameSpaceModule | ValueModule)
|
||||
rebuilt : SymbolId(0): SymbolFlags(Export | Class)
|
||||
after transform: SymbolId(0): SymbolFlags(Class | NameSpaceModule | ValueModule)
|
||||
rebuilt : SymbolId(0): SymbolFlags(Class)
|
||||
Symbol reference IDs mismatch for "N":
|
||||
after transform: SymbolId(0): [ReferenceId(0)]
|
||||
rebuilt : SymbolId(0): [ReferenceId(0), ReferenceId(1), ReferenceId(2)]
|
||||
|
|
@ -1545,15 +1539,9 @@ rebuilt : ScopeId(2): [SymbolId(3), SymbolId(4)]
|
|||
Binding symbols mismatch:
|
||||
after transform: ScopeId(4): [SymbolId(4), SymbolId(7)]
|
||||
rebuilt : ScopeId(4): [SymbolId(6), SymbolId(7)]
|
||||
Symbol flags mismatch for "foo":
|
||||
after transform: SymbolId(2): SymbolFlags(Export | Class)
|
||||
rebuilt : SymbolId(4): SymbolFlags(Class)
|
||||
Symbol reference IDs mismatch for "foo":
|
||||
after transform: SymbolId(2): []
|
||||
rebuilt : SymbolId(4): [ReferenceId(1)]
|
||||
Symbol flags mismatch for "foo":
|
||||
after transform: SymbolId(4): SymbolFlags(Export | Class)
|
||||
rebuilt : SymbolId(7): SymbolFlags(Class)
|
||||
Symbol reference IDs mismatch for "foo":
|
||||
after transform: SymbolId(4): []
|
||||
rebuilt : SymbolId(7): [ReferenceId(7)]
|
||||
|
|
@ -1591,15 +1579,9 @@ rebuilt : ScopeId(2): [SymbolId(3), SymbolId(4)]
|
|||
Binding symbols mismatch:
|
||||
after transform: ScopeId(4): [SymbolId(4), SymbolId(7)]
|
||||
rebuilt : ScopeId(4): [SymbolId(6), SymbolId(7)]
|
||||
Symbol flags mismatch for "foo":
|
||||
after transform: SymbolId(2): SymbolFlags(Export | Class)
|
||||
rebuilt : SymbolId(4): SymbolFlags(Class)
|
||||
Symbol reference IDs mismatch for "foo":
|
||||
after transform: SymbolId(2): []
|
||||
rebuilt : SymbolId(4): [ReferenceId(1)]
|
||||
Symbol flags mismatch for "foo":
|
||||
after transform: SymbolId(4): SymbolFlags(Export | Class)
|
||||
rebuilt : SymbolId(7): SymbolFlags(Class)
|
||||
Symbol reference IDs mismatch for "foo":
|
||||
after transform: SymbolId(4): []
|
||||
rebuilt : SymbolId(7): [ReferenceId(7)]
|
||||
|
|
@ -1717,15 +1699,9 @@ rebuilt : SymbolId(0): [ReferenceId(33), ReferenceId(34)]
|
|||
Symbol redeclarations mismatch for "A":
|
||||
after transform: SymbolId(0): [Span { start: 22, end: 23 }]
|
||||
rebuilt : SymbolId(0): []
|
||||
Symbol flags mismatch for "G":
|
||||
after transform: SymbolId(2): SymbolFlags(Export | Class)
|
||||
rebuilt : SymbolId(4): SymbolFlags(Class)
|
||||
Symbol reference IDs mismatch for "G":
|
||||
after transform: SymbolId(2): []
|
||||
rebuilt : SymbolId(4): [ReferenceId(1)]
|
||||
Symbol flags mismatch for "E":
|
||||
after transform: SymbolId(3): SymbolFlags(BlockScopedVariable | ConstVariable | Export)
|
||||
rebuilt : SymbolId(5): SymbolFlags(BlockScopedVariable | ConstVariable)
|
||||
Symbol flags mismatch for "M":
|
||||
after transform: SymbolId(4): SymbolFlags(BlockScopedVariable | Function | NameSpaceModule | ValueModule)
|
||||
rebuilt : SymbolId(6): SymbolFlags(FunctionScopedVariable)
|
||||
|
|
@ -1735,11 +1711,8 @@ rebuilt : SymbolId(6): [ReferenceId(9), ReferenceId(10)]
|
|||
Symbol redeclarations mismatch for "M":
|
||||
after transform: SymbolId(4): [Span { start: 129, end: 130 }]
|
||||
rebuilt : SymbolId(6): []
|
||||
Symbol flags mismatch for "N":
|
||||
after transform: SymbolId(5): SymbolFlags(BlockScopedVariable | ConstVariable | Export)
|
||||
rebuilt : SymbolId(8): SymbolFlags(BlockScopedVariable | ConstVariable)
|
||||
Symbol flags mismatch for "D":
|
||||
after transform: SymbolId(6): SymbolFlags(BlockScopedVariable | Export | Function | NameSpaceModule | ValueModule)
|
||||
after transform: SymbolId(6): SymbolFlags(BlockScopedVariable | Function | NameSpaceModule | ValueModule)
|
||||
rebuilt : SymbolId(9): SymbolFlags(FunctionScopedVariable)
|
||||
Symbol reference IDs mismatch for "D":
|
||||
after transform: SymbolId(6): []
|
||||
|
|
@ -1748,7 +1721,7 @@ Symbol redeclarations mismatch for "D":
|
|||
after transform: SymbolId(6): [Span { start: 207, end: 208 }]
|
||||
rebuilt : SymbolId(9): []
|
||||
Symbol flags mismatch for "H":
|
||||
after transform: SymbolId(8): SymbolFlags(Export | RegularEnum)
|
||||
after transform: SymbolId(8): SymbolFlags(RegularEnum)
|
||||
rebuilt : SymbolId(12): SymbolFlags(BlockScopedVariable)
|
||||
Symbol reference IDs mismatch for "H":
|
||||
after transform: SymbolId(8): []
|
||||
|
|
@ -1792,7 +1765,7 @@ Scope flags mismatch:
|
|||
after transform: ScopeId(4): ScopeFlags(StrictMode)
|
||||
rebuilt : ScopeId(2): ScopeFlags(StrictMode | Function)
|
||||
Symbol flags mismatch for "G":
|
||||
after transform: SymbolId(3): SymbolFlags(Export | RegularEnum)
|
||||
after transform: SymbolId(3): SymbolFlags(RegularEnum)
|
||||
rebuilt : SymbolId(2): SymbolFlags(BlockScopedVariable)
|
||||
Symbol reference IDs mismatch for "G":
|
||||
after transform: SymbolId(3): []
|
||||
|
|
@ -1854,12 +1827,6 @@ rebuilt : ScopeId(5): [SymbolId(10), SymbolId(11)]
|
|||
Binding symbols mismatch:
|
||||
after transform: ScopeId(6): [SymbolId(7), SymbolId(13)]
|
||||
rebuilt : ScopeId(6): [SymbolId(12), SymbolId(13)]
|
||||
Symbol flags mismatch for "Z":
|
||||
after transform: SymbolId(2): SymbolFlags(BlockScopedVariable | ConstVariable | Export)
|
||||
rebuilt : SymbolId(4): SymbolFlags(BlockScopedVariable | ConstVariable)
|
||||
Symbol flags mismatch for "X":
|
||||
after transform: SymbolId(7): SymbolFlags(BlockScopedVariable | ConstVariable | Export)
|
||||
rebuilt : SymbolId(13): SymbolFlags(BlockScopedVariable | ConstVariable)
|
||||
|
||||
* namespace/same-name/input.ts
|
||||
Missing SymbolId: "N"
|
||||
|
|
@ -1914,19 +1881,16 @@ Scope flags mismatch:
|
|||
after transform: ScopeId(8): ScopeFlags(StrictMode)
|
||||
rebuilt : ScopeId(8): ScopeFlags(StrictMode | Function)
|
||||
Symbol flags mismatch for "_N3":
|
||||
after transform: SymbolId(4): SymbolFlags(BlockScopedVariable | Export | Function)
|
||||
after transform: SymbolId(4): SymbolFlags(BlockScopedVariable | Function)
|
||||
rebuilt : SymbolId(7): SymbolFlags(FunctionScopedVariable)
|
||||
Symbol reference IDs mismatch for "_N3":
|
||||
after transform: SymbolId(4): []
|
||||
rebuilt : SymbolId(7): [ReferenceId(3)]
|
||||
Symbol flags mismatch for "_N5":
|
||||
after transform: SymbolId(5): SymbolFlags(Export | Class)
|
||||
rebuilt : SymbolId(9): SymbolFlags(Class)
|
||||
Symbol reference IDs mismatch for "_N5":
|
||||
after transform: SymbolId(5): []
|
||||
rebuilt : SymbolId(9): [ReferenceId(9)]
|
||||
Symbol flags mismatch for "_N":
|
||||
after transform: SymbolId(6): SymbolFlags(Export | RegularEnum)
|
||||
after transform: SymbolId(6): SymbolFlags(RegularEnum)
|
||||
rebuilt : SymbolId(11): SymbolFlags(BlockScopedVariable)
|
||||
Symbol reference IDs mismatch for "_N":
|
||||
after transform: SymbolId(6): []
|
||||
|
|
|
|||
|
|
@ -1,12 +1,13 @@
|
|||
commit: d20b314c
|
||||
|
||||
Passed: 89/100
|
||||
Passed: 90/100
|
||||
|
||||
# All Passed:
|
||||
* babel-plugin-transform-class-static-block
|
||||
* babel-plugin-transform-nullish-coalescing-operator
|
||||
* babel-plugin-transform-optional-catch-binding
|
||||
* babel-plugin-transform-async-generator-functions
|
||||
* babel-plugin-transform-object-rest-spread
|
||||
* babel-plugin-transform-async-to-generator
|
||||
* babel-plugin-transform-exponentiation-operator
|
||||
* babel-plugin-transform-arrow-functions
|
||||
|
|
@ -15,13 +16,6 @@ Passed: 89/100
|
|||
* regexp
|
||||
|
||||
|
||||
# babel-plugin-transform-object-rest-spread (4/5)
|
||||
* object-rest/export/input.js
|
||||
Symbol flags mismatch for "b0":
|
||||
after transform: SymbolId(1): SymbolFlags(BlockScopedVariable | Export)
|
||||
rebuilt : SymbolId(2): SymbolFlags(BlockScopedVariable)
|
||||
|
||||
|
||||
# babel-plugin-transform-typescript (2/9)
|
||||
* class-property-definition/input.ts
|
||||
Unresolved references mismatch:
|
||||
|
|
@ -117,12 +111,9 @@ rebuilt : ScopeId(3): [SymbolId(6), SymbolId(7)]
|
|||
Scope flags mismatch:
|
||||
after transform: ScopeId(5): ScopeFlags(StrictMode | Function)
|
||||
rebuilt : ScopeId(3): ScopeFlags(Function)
|
||||
Symbol flags mismatch for "Q":
|
||||
after transform: SymbolId(8): SymbolFlags(BlockScopedVariable | ConstVariable | Export)
|
||||
rebuilt : SymbolId(7): SymbolFlags(BlockScopedVariable | ConstVariable)
|
||||
Symbol flags mismatch for "T":
|
||||
after transform: SymbolId(9): SymbolFlags(FunctionScopedVariable | Export | TypeAlias)
|
||||
rebuilt : SymbolId(8): SymbolFlags(FunctionScopedVariable | Export)
|
||||
after transform: SymbolId(9): SymbolFlags(FunctionScopedVariable | TypeAlias)
|
||||
rebuilt : SymbolId(8): SymbolFlags(FunctionScopedVariable)
|
||||
Symbol span mismatch for "T":
|
||||
after transform: SymbolId(9): Span { start: 205, end: 206 }
|
||||
rebuilt : SymbolId(8): Span { start: 226, end: 227 }
|
||||
|
|
@ -141,8 +132,8 @@ Scope children mismatch:
|
|||
after transform: ScopeId(0): [ScopeId(1), ScopeId(2)]
|
||||
rebuilt : ScopeId(0): []
|
||||
Symbol flags mismatch for "A":
|
||||
after transform: SymbolId(0): SymbolFlags(BlockScopedVariable | ConstVariable | Export | Import)
|
||||
rebuilt : SymbolId(0): SymbolFlags(BlockScopedVariable | ConstVariable | Export)
|
||||
after transform: SymbolId(0): SymbolFlags(BlockScopedVariable | ConstVariable | Import)
|
||||
rebuilt : SymbolId(0): SymbolFlags(BlockScopedVariable | ConstVariable)
|
||||
Symbol span mismatch for "A":
|
||||
after transform: SymbolId(0): Span { start: 57, end: 58 }
|
||||
rebuilt : SymbolId(0): Span { start: 79, end: 83 }
|
||||
|
|
@ -153,14 +144,14 @@ Symbol redeclarations mismatch for "A":
|
|||
after transform: SymbolId(0): [Span { start: 79, end: 83 }]
|
||||
rebuilt : SymbolId(0): []
|
||||
Symbol flags mismatch for "T":
|
||||
after transform: SymbolId(1): SymbolFlags(Export | Import | TypeAlias)
|
||||
rebuilt : SymbolId(1): SymbolFlags(Export | Import)
|
||||
after transform: SymbolId(1): SymbolFlags(Import | TypeAlias)
|
||||
rebuilt : SymbolId(1): SymbolFlags(Import)
|
||||
Symbol redeclarations mismatch for "T":
|
||||
after transform: SymbolId(1): [Span { start: 170, end: 171 }]
|
||||
rebuilt : SymbolId(1): []
|
||||
Symbol flags mismatch for "B":
|
||||
after transform: SymbolId(2): SymbolFlags(BlockScopedVariable | ConstVariable | Export | Import | TypeAlias)
|
||||
rebuilt : SymbolId(2): SymbolFlags(BlockScopedVariable | ConstVariable | Export)
|
||||
after transform: SymbolId(2): SymbolFlags(BlockScopedVariable | ConstVariable | Import | TypeAlias)
|
||||
rebuilt : SymbolId(2): SymbolFlags(BlockScopedVariable | ConstVariable)
|
||||
Symbol span mismatch for "B":
|
||||
after transform: SymbolId(2): Span { start: 267, end: 268 }
|
||||
rebuilt : SymbolId(2): Span { start: 289, end: 293 }
|
||||
|
|
|
|||
Loading…
Reference in a new issue