mirror of
https://github.com/swc-project/swc.git
synced 2024-10-04 12:18:08 +03:00
perf(es/minifier): Add has_flag
to Comments
(#8182)
This commit is contained in:
parent
115f6fe4ae
commit
7530e9051d
@ -84,6 +84,47 @@ pub trait Comments {
|
||||
|
||||
ret
|
||||
}
|
||||
|
||||
/// This method is used to check if a comment with the given flag exist.
|
||||
///
|
||||
/// If `flag` is `PURE`, this method will look for `@__PURE__` and
|
||||
/// `#__PURE__`.
|
||||
fn has_flag(&self, lo: BytePos, flag: &str) -> bool {
|
||||
let cmts = self.take_leading(lo);
|
||||
|
||||
let ret = if let Some(comments) = &cmts {
|
||||
(|| {
|
||||
for c in comments {
|
||||
if c.kind == CommentKind::Block {
|
||||
for line in c.text.lines() {
|
||||
// jsdoc
|
||||
let line = line.trim_start_matches(['*', ' ']);
|
||||
let line = line.trim();
|
||||
|
||||
//
|
||||
if line.len() == (flag.len() + 5)
|
||||
&& (line.starts_with("#__") || line.starts_with("@__"))
|
||||
&& line.ends_with("__")
|
||||
&& flag == &line[3..line.len() - 2]
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
false
|
||||
})()
|
||||
} else {
|
||||
false
|
||||
};
|
||||
|
||||
if let Some(cmts) = cmts {
|
||||
self.add_trailing_comments(lo, cmts);
|
||||
}
|
||||
|
||||
ret
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! delegate {
|
||||
@ -139,6 +180,10 @@ macro_rules! delegate {
|
||||
fn add_pure_comment(&self, pos: BytePos) {
|
||||
(**self).add_pure_comment(pos)
|
||||
}
|
||||
|
||||
fn has_flag(&self, lo: BytePos, flag: &str) -> bool {
|
||||
(**self).has_flag(lo, flag)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@ -225,6 +270,11 @@ impl Comments for NoopComments {
|
||||
|
||||
#[cfg_attr(not(debug_assertions), inline(always))]
|
||||
fn add_pure_comment(&self, _: BytePos) {}
|
||||
|
||||
#[inline]
|
||||
fn has_flag(&self, _: BytePos, _: &str) -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
/// This implementation behaves like [NoopComments] if it's [None].
|
||||
@ -347,6 +397,15 @@ where
|
||||
f(&[])
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn has_flag(&self, lo: BytePos, flag: &str) -> bool {
|
||||
if let Some(c) = self {
|
||||
c.has_flag(lo, flag)
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub type SingleThreadedCommentsMapInner = FxHashMap<BytePos, Vec<Comment>>;
|
||||
@ -485,6 +544,31 @@ impl Comments for SingleThreadedComments {
|
||||
f(&[])
|
||||
}
|
||||
}
|
||||
|
||||
fn has_flag(&self, lo: BytePos, flag: &str) -> bool {
|
||||
self.with_leading(lo, |comments| {
|
||||
for c in comments {
|
||||
if c.kind == CommentKind::Block {
|
||||
for line in c.text.lines() {
|
||||
// jsdoc
|
||||
let line = line.trim_start_matches(['*', ' ']);
|
||||
let line = line.trim();
|
||||
|
||||
//
|
||||
if line.len() == (flag.len() + 5)
|
||||
&& (line.starts_with("#__") || line.starts_with("@__"))
|
||||
&& line.ends_with("__")
|
||||
&& flag == &line[3..line.len() - 2]
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
false
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl SingleThreadedComments {
|
||||
|
@ -1139,11 +1139,17 @@ impl BytePos {
|
||||
self.0 >= Self::MIN_RESERVED.0 && self.0 != u32::MAX
|
||||
}
|
||||
|
||||
/// Returns true if this is synthesized and has no relevant input source
|
||||
/// Returns `true`` if this is synthesized and has no relevant input source
|
||||
/// code.
|
||||
pub const fn is_dummy(self) -> bool {
|
||||
self.0 == 0
|
||||
}
|
||||
|
||||
/// Returns `true`` if this is explicitly synthesized or has relevant input
|
||||
/// source so can have a comment.
|
||||
pub const fn can_have_comment(self) -> bool {
|
||||
self.0 != 0
|
||||
}
|
||||
}
|
||||
|
||||
/// A character offset. Because of multibyte utf8 characters, a byte offset
|
||||
|
@ -311,24 +311,5 @@ fn has_flag(comments: Option<&dyn Comments>, span: Span, text: &'static str) ->
|
||||
return false;
|
||||
}
|
||||
|
||||
find_comment(comments, span, |c| {
|
||||
if c.kind == CommentKind::Block {
|
||||
for line in c.text.lines() {
|
||||
// jsdoc
|
||||
let line = line.trim_start_matches(['*', ' ']);
|
||||
let line = line.trim();
|
||||
|
||||
//
|
||||
if line.len() == (text.len() + 5)
|
||||
&& (line.starts_with("#__") || line.starts_with("@__"))
|
||||
&& line.ends_with("__")
|
||||
&& text == &line[3..line.len() - 2]
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
false
|
||||
})
|
||||
comments.has_flag(span.lo, text)
|
||||
}
|
||||
|
@ -0,0 +1,119 @@
|
||||
|
||||
x Module
|
||||
,-[$DIR/tests/comments/exprs/array/blockStmt/input.js:1:1]
|
||||
1 | ,-> React.useEffect(() => {
|
||||
2 | | // @refresh reset
|
||||
3 | `-> });
|
||||
`----
|
||||
|
||||
x ModuleItem
|
||||
,-[$DIR/tests/comments/exprs/array/blockStmt/input.js:1:1]
|
||||
1 | ,-> React.useEffect(() => {
|
||||
2 | | // @refresh reset
|
||||
3 | `-> });
|
||||
`----
|
||||
|
||||
x Stmt
|
||||
,-[$DIR/tests/comments/exprs/array/blockStmt/input.js:1:1]
|
||||
1 | ,-> React.useEffect(() => {
|
||||
2 | | // @refresh reset
|
||||
3 | `-> });
|
||||
`----
|
||||
|
||||
x ExprStmt
|
||||
,-[$DIR/tests/comments/exprs/array/blockStmt/input.js:1:1]
|
||||
1 | ,-> React.useEffect(() => {
|
||||
2 | | // @refresh reset
|
||||
3 | `-> });
|
||||
`----
|
||||
|
||||
x Expr
|
||||
,-[$DIR/tests/comments/exprs/array/blockStmt/input.js:1:1]
|
||||
1 | ,-> React.useEffect(() => {
|
||||
2 | | // @refresh reset
|
||||
3 | `-> });
|
||||
`----
|
||||
|
||||
x CallExpr
|
||||
,-[$DIR/tests/comments/exprs/array/blockStmt/input.js:1:1]
|
||||
1 | ,-> React.useEffect(() => {
|
||||
2 | | // @refresh reset
|
||||
3 | `-> });
|
||||
`----
|
||||
|
||||
x Callee
|
||||
,-[$DIR/tests/comments/exprs/array/blockStmt/input.js:1:1]
|
||||
1 | React.useEffect(() => {
|
||||
: ^^^^^^^^^^^^^^^
|
||||
2 | // @refresh reset
|
||||
`----
|
||||
|
||||
x Expr
|
||||
,-[$DIR/tests/comments/exprs/array/blockStmt/input.js:1:1]
|
||||
1 | React.useEffect(() => {
|
||||
: ^^^^^^^^^^^^^^^
|
||||
2 | // @refresh reset
|
||||
`----
|
||||
|
||||
x MemberExpr
|
||||
,-[$DIR/tests/comments/exprs/array/blockStmt/input.js:1:1]
|
||||
1 | React.useEffect(() => {
|
||||
: ^^^^^^^^^^^^^^^
|
||||
2 | // @refresh reset
|
||||
`----
|
||||
|
||||
x Expr
|
||||
,-[$DIR/tests/comments/exprs/array/blockStmt/input.js:1:1]
|
||||
1 | React.useEffect(() => {
|
||||
: ^^^^^
|
||||
2 | // @refresh reset
|
||||
`----
|
||||
|
||||
x Ident
|
||||
,-[$DIR/tests/comments/exprs/array/blockStmt/input.js:1:1]
|
||||
1 | React.useEffect(() => {
|
||||
: ^^^^^
|
||||
2 | // @refresh reset
|
||||
`----
|
||||
|
||||
x Ident
|
||||
,-[$DIR/tests/comments/exprs/array/blockStmt/input.js:1:1]
|
||||
1 | React.useEffect(() => {
|
||||
: ^^^^^^^^^
|
||||
2 | // @refresh reset
|
||||
`----
|
||||
|
||||
x ExprOrSpread
|
||||
,-[$DIR/tests/comments/exprs/array/blockStmt/input.js:1:1]
|
||||
1 | ,-> React.useEffect(() => {
|
||||
2 | | // @refresh reset
|
||||
3 | `-> });
|
||||
`----
|
||||
|
||||
x Expr
|
||||
,-[$DIR/tests/comments/exprs/array/blockStmt/input.js:1:1]
|
||||
1 | ,-> React.useEffect(() => {
|
||||
2 | | // @refresh reset
|
||||
3 | `-> });
|
||||
`----
|
||||
|
||||
x ArrowExpr
|
||||
,-[$DIR/tests/comments/exprs/array/blockStmt/input.js:1:1]
|
||||
1 | ,-> React.useEffect(() => {
|
||||
2 | | // @refresh reset
|
||||
3 | `-> });
|
||||
`----
|
||||
|
||||
x BlockStmtOrExpr
|
||||
,-[$DIR/tests/comments/exprs/array/blockStmt/input.js:1:1]
|
||||
1 | ,-> React.useEffect(() => {
|
||||
2 | | // @refresh reset
|
||||
3 | `-> });
|
||||
`----
|
||||
|
||||
x BlockStmt
|
||||
,-[$DIR/tests/comments/exprs/array/blockStmt/input.js:1:1]
|
||||
1 | ,-> React.useEffect(() => {
|
||||
2 | | // @refresh reset
|
||||
3 | `-> });
|
||||
`----
|
@ -0,0 +1,102 @@
|
||||
|
||||
x Module
|
||||
,-[$DIR/tests/comments/exprs/call/simple/input.js:1:1]
|
||||
1 | test(123/*post: 9*/, 456/*post: 10*/);
|
||||
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x ModuleItem
|
||||
,-[$DIR/tests/comments/exprs/call/simple/input.js:1:1]
|
||||
1 | test(123/*post: 9*/, 456/*post: 10*/);
|
||||
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Stmt
|
||||
,-[$DIR/tests/comments/exprs/call/simple/input.js:1:1]
|
||||
1 | test(123/*post: 9*/, 456/*post: 10*/);
|
||||
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x ExprStmt
|
||||
,-[$DIR/tests/comments/exprs/call/simple/input.js:1:1]
|
||||
1 | test(123/*post: 9*/, 456/*post: 10*/);
|
||||
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Expr
|
||||
,-[$DIR/tests/comments/exprs/call/simple/input.js:1:1]
|
||||
1 | test(123/*post: 9*/, 456/*post: 10*/);
|
||||
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x CallExpr
|
||||
,-[$DIR/tests/comments/exprs/call/simple/input.js:1:1]
|
||||
1 | test(123/*post: 9*/, 456/*post: 10*/);
|
||||
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Callee
|
||||
,-[$DIR/tests/comments/exprs/call/simple/input.js:1:1]
|
||||
1 | test(123/*post: 9*/, 456/*post: 10*/);
|
||||
: ^^^^
|
||||
`----
|
||||
|
||||
x Expr
|
||||
,-[$DIR/tests/comments/exprs/call/simple/input.js:1:1]
|
||||
1 | test(123/*post: 9*/, 456/*post: 10*/);
|
||||
: ^^^^
|
||||
`----
|
||||
|
||||
x Ident
|
||||
,-[$DIR/tests/comments/exprs/call/simple/input.js:1:1]
|
||||
1 | test(123/*post: 9*/, 456/*post: 10*/);
|
||||
: ^^^^
|
||||
`----
|
||||
|
||||
x ExprOrSpread
|
||||
,-[$DIR/tests/comments/exprs/call/simple/input.js:1:1]
|
||||
1 | test(123/*post: 9*/, 456/*post: 10*/);
|
||||
: ^^^
|
||||
`----
|
||||
|
||||
x Expr
|
||||
,-[$DIR/tests/comments/exprs/call/simple/input.js:1:1]
|
||||
1 | test(123/*post: 9*/, 456/*post: 10*/);
|
||||
: ^^^
|
||||
`----
|
||||
|
||||
x Lit
|
||||
,-[$DIR/tests/comments/exprs/call/simple/input.js:1:1]
|
||||
1 | test(123/*post: 9*/, 456/*post: 10*/);
|
||||
: ^^^
|
||||
`----
|
||||
|
||||
x Number
|
||||
,-[$DIR/tests/comments/exprs/call/simple/input.js:1:1]
|
||||
1 | test(123/*post: 9*/, 456/*post: 10*/);
|
||||
: ^^^
|
||||
`----
|
||||
|
||||
x ExprOrSpread
|
||||
,-[$DIR/tests/comments/exprs/call/simple/input.js:1:1]
|
||||
1 | test(123/*post: 9*/, 456/*post: 10*/);
|
||||
: ^^^
|
||||
`----
|
||||
|
||||
x Expr
|
||||
,-[$DIR/tests/comments/exprs/call/simple/input.js:1:1]
|
||||
1 | test(123/*post: 9*/, 456/*post: 10*/);
|
||||
: ^^^
|
||||
`----
|
||||
|
||||
x Lit
|
||||
,-[$DIR/tests/comments/exprs/call/simple/input.js:1:1]
|
||||
1 | test(123/*post: 9*/, 456/*post: 10*/);
|
||||
: ^^^
|
||||
`----
|
||||
|
||||
x Number
|
||||
,-[$DIR/tests/comments/exprs/call/simple/input.js:1:1]
|
||||
1 | test(123/*post: 9*/, 456/*post: 10*/);
|
||||
: ^^^
|
||||
`----
|
@ -0,0 +1,2 @@
|
||||
const fnB = /*#__NO_SIDE_EFFECTS__*/ (args) => {
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
|
||||
x Module
|
||||
,-[$DIR/tests/comments/exprs/paren-annotations/1/input.js:1:1]
|
||||
1 | ,-> const fnB = /*#__NO_SIDE_EFFECTS__*/ (args) => {
|
||||
2 | `-> }
|
||||
`----
|
||||
|
||||
x ModuleItem
|
||||
,-[$DIR/tests/comments/exprs/paren-annotations/1/input.js:1:1]
|
||||
1 | ,-> const fnB = /*#__NO_SIDE_EFFECTS__*/ (args) => {
|
||||
2 | `-> }
|
||||
`----
|
||||
|
||||
x Stmt
|
||||
,-[$DIR/tests/comments/exprs/paren-annotations/1/input.js:1:1]
|
||||
1 | ,-> const fnB = /*#__NO_SIDE_EFFECTS__*/ (args) => {
|
||||
2 | `-> }
|
||||
`----
|
||||
|
||||
x Decl
|
||||
,-[$DIR/tests/comments/exprs/paren-annotations/1/input.js:1:1]
|
||||
1 | ,-> const fnB = /*#__NO_SIDE_EFFECTS__*/ (args) => {
|
||||
2 | `-> }
|
||||
`----
|
||||
|
||||
x VarDecl
|
||||
,-[$DIR/tests/comments/exprs/paren-annotations/1/input.js:1:1]
|
||||
1 | ,-> const fnB = /*#__NO_SIDE_EFFECTS__*/ (args) => {
|
||||
2 | `-> }
|
||||
`----
|
||||
|
||||
x VarDeclarator
|
||||
,-[$DIR/tests/comments/exprs/paren-annotations/1/input.js:1:1]
|
||||
1 | ,-> const fnB = /*#__NO_SIDE_EFFECTS__*/ (args) => {
|
||||
2 | `-> }
|
||||
`----
|
||||
|
||||
x Pat
|
||||
,-[$DIR/tests/comments/exprs/paren-annotations/1/input.js:1:1]
|
||||
1 | const fnB = /*#__NO_SIDE_EFFECTS__*/ (args) => {
|
||||
: ^^^
|
||||
2 | }
|
||||
`----
|
||||
|
||||
x Ident
|
||||
,-[$DIR/tests/comments/exprs/paren-annotations/1/input.js:1:1]
|
||||
1 | const fnB = /*#__NO_SIDE_EFFECTS__*/ (args) => {
|
||||
: ^^^
|
||||
2 | }
|
||||
`----
|
||||
|
||||
x Expr
|
||||
,-[$DIR/tests/comments/exprs/paren-annotations/1/input.js:1:1]
|
||||
1 | ,-> const fnB = /*#__NO_SIDE_EFFECTS__*/ (args) => {
|
||||
2 | `-> }
|
||||
`----
|
||||
|
||||
x ArrowExpr
|
||||
,-[$DIR/tests/comments/exprs/paren-annotations/1/input.js:1:1]
|
||||
1 | ,-> const fnB = /*#__NO_SIDE_EFFECTS__*/ (args) => {
|
||||
2 | `-> }
|
||||
`----
|
||||
|
||||
x Pat
|
||||
,-[$DIR/tests/comments/exprs/paren-annotations/1/input.js:1:1]
|
||||
1 | const fnB = /*#__NO_SIDE_EFFECTS__*/ (args) => {
|
||||
: ^^^^
|
||||
2 | }
|
||||
`----
|
||||
|
||||
x Ident
|
||||
,-[$DIR/tests/comments/exprs/paren-annotations/1/input.js:1:1]
|
||||
1 | const fnB = /*#__NO_SIDE_EFFECTS__*/ (args) => {
|
||||
: ^^^^
|
||||
2 | }
|
||||
`----
|
||||
|
||||
x BlockStmtOrExpr
|
||||
,-[$DIR/tests/comments/exprs/paren-annotations/1/input.js:1:1]
|
||||
1 | ,-> const fnB = /*#__NO_SIDE_EFFECTS__*/ (args) => {
|
||||
2 | `-> }
|
||||
`----
|
||||
|
||||
x BlockStmt
|
||||
,-[$DIR/tests/comments/exprs/paren-annotations/1/input.js:1:1]
|
||||
1 | ,-> const fnB = /*#__NO_SIDE_EFFECTS__*/ (args) => {
|
||||
2 | `-> }
|
||||
`----
|
@ -0,0 +1,10 @@
|
||||
|
||||
> Leading (lo)
|
||||
|
||||
Error:
|
||||
> #__NO_SIDE_EFFECTS__
|
||||
,-[$DIR/tests/comments/exprs/paren-annotations/1/input.js:1:1]
|
||||
1 | const fnB = /*#__NO_SIDE_EFFECTS__*/ (args) => {
|
||||
: ^
|
||||
2 | }
|
||||
`----
|
@ -0,0 +1 @@
|
||||
/*#__PURE__*/ (console.log('simple'))
|
@ -0,0 +1,108 @@
|
||||
|
||||
x Module
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/1/input.js:1:1]
|
||||
1 | /*#__PURE__*/ (console.log('simple'))
|
||||
: ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x ModuleItem
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/1/input.js:1:1]
|
||||
1 | /*#__PURE__*/ (console.log('simple'))
|
||||
: ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Stmt
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/1/input.js:1:1]
|
||||
1 | /*#__PURE__*/ (console.log('simple'))
|
||||
: ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x ExprStmt
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/1/input.js:1:1]
|
||||
1 | /*#__PURE__*/ (console.log('simple'))
|
||||
: ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Expr
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/1/input.js:1:1]
|
||||
1 | /*#__PURE__*/ (console.log('simple'))
|
||||
: ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x ParenExpr
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/1/input.js:1:1]
|
||||
1 | /*#__PURE__*/ (console.log('simple'))
|
||||
: ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Expr
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/1/input.js:1:1]
|
||||
1 | /*#__PURE__*/ (console.log('simple'))
|
||||
: ^^^^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x CallExpr
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/1/input.js:1:1]
|
||||
1 | /*#__PURE__*/ (console.log('simple'))
|
||||
: ^^^^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Callee
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/1/input.js:1:1]
|
||||
1 | /*#__PURE__*/ (console.log('simple'))
|
||||
: ^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Expr
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/1/input.js:1:1]
|
||||
1 | /*#__PURE__*/ (console.log('simple'))
|
||||
: ^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x MemberExpr
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/1/input.js:1:1]
|
||||
1 | /*#__PURE__*/ (console.log('simple'))
|
||||
: ^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Expr
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/1/input.js:1:1]
|
||||
1 | /*#__PURE__*/ (console.log('simple'))
|
||||
: ^^^^^^^
|
||||
`----
|
||||
|
||||
x Ident
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/1/input.js:1:1]
|
||||
1 | /*#__PURE__*/ (console.log('simple'))
|
||||
: ^^^^^^^
|
||||
`----
|
||||
|
||||
x Ident
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/1/input.js:1:1]
|
||||
1 | /*#__PURE__*/ (console.log('simple'))
|
||||
: ^^^
|
||||
`----
|
||||
|
||||
x ExprOrSpread
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/1/input.js:1:1]
|
||||
1 | /*#__PURE__*/ (console.log('simple'))
|
||||
: ^^^^^^^^
|
||||
`----
|
||||
|
||||
x Expr
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/1/input.js:1:1]
|
||||
1 | /*#__PURE__*/ (console.log('simple'))
|
||||
: ^^^^^^^^
|
||||
`----
|
||||
|
||||
x Lit
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/1/input.js:1:1]
|
||||
1 | /*#__PURE__*/ (console.log('simple'))
|
||||
: ^^^^^^^^
|
||||
`----
|
||||
|
||||
x Str
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/1/input.js:1:1]
|
||||
1 | /*#__PURE__*/ (console.log('simple'))
|
||||
: ^^^^^^^^
|
||||
`----
|
@ -0,0 +1,9 @@
|
||||
|
||||
> Leading (lo)
|
||||
|
||||
Error:
|
||||
> #__PURE__
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/1/input.js:1:1]
|
||||
1 | /*#__PURE__*/ (console.log('simple'))
|
||||
: ^
|
||||
`----
|
@ -0,0 +1,2 @@
|
||||
|
||||
/*#__PURE__*/((() => import('./any'))())
|
@ -0,0 +1,147 @@
|
||||
|
||||
x Module
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/2/input.js:1:1]
|
||||
1 |
|
||||
2 | /*#__PURE__*/((() => import('./any'))())
|
||||
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x ModuleItem
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/2/input.js:1:1]
|
||||
1 |
|
||||
2 | /*#__PURE__*/((() => import('./any'))())
|
||||
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Stmt
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/2/input.js:1:1]
|
||||
1 |
|
||||
2 | /*#__PURE__*/((() => import('./any'))())
|
||||
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x ExprStmt
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/2/input.js:1:1]
|
||||
1 |
|
||||
2 | /*#__PURE__*/((() => import('./any'))())
|
||||
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Expr
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/2/input.js:1:1]
|
||||
1 |
|
||||
2 | /*#__PURE__*/((() => import('./any'))())
|
||||
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x ParenExpr
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/2/input.js:1:1]
|
||||
1 |
|
||||
2 | /*#__PURE__*/((() => import('./any'))())
|
||||
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Expr
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/2/input.js:1:1]
|
||||
1 |
|
||||
2 | /*#__PURE__*/((() => import('./any'))())
|
||||
: ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x CallExpr
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/2/input.js:1:1]
|
||||
1 |
|
||||
2 | /*#__PURE__*/((() => import('./any'))())
|
||||
: ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Callee
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/2/input.js:1:1]
|
||||
1 |
|
||||
2 | /*#__PURE__*/((() => import('./any'))())
|
||||
: ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Expr
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/2/input.js:1:1]
|
||||
1 |
|
||||
2 | /*#__PURE__*/((() => import('./any'))())
|
||||
: ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x ParenExpr
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/2/input.js:1:1]
|
||||
1 |
|
||||
2 | /*#__PURE__*/((() => import('./any'))())
|
||||
: ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Expr
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/2/input.js:1:1]
|
||||
1 |
|
||||
2 | /*#__PURE__*/((() => import('./any'))())
|
||||
: ^^^^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x ArrowExpr
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/2/input.js:1:1]
|
||||
1 |
|
||||
2 | /*#__PURE__*/((() => import('./any'))())
|
||||
: ^^^^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x BlockStmtOrExpr
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/2/input.js:1:1]
|
||||
1 |
|
||||
2 | /*#__PURE__*/((() => import('./any'))())
|
||||
: ^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Expr
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/2/input.js:1:1]
|
||||
1 |
|
||||
2 | /*#__PURE__*/((() => import('./any'))())
|
||||
: ^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x CallExpr
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/2/input.js:1:1]
|
||||
1 |
|
||||
2 | /*#__PURE__*/((() => import('./any'))())
|
||||
: ^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Callee
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/2/input.js:1:1]
|
||||
1 |
|
||||
2 | /*#__PURE__*/((() => import('./any'))())
|
||||
: ^^^^^^
|
||||
`----
|
||||
|
||||
x ExprOrSpread
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/2/input.js:1:1]
|
||||
1 |
|
||||
2 | /*#__PURE__*/((() => import('./any'))())
|
||||
: ^^^^^^^
|
||||
`----
|
||||
|
||||
x Expr
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/2/input.js:1:1]
|
||||
1 |
|
||||
2 | /*#__PURE__*/((() => import('./any'))())
|
||||
: ^^^^^^^
|
||||
`----
|
||||
|
||||
x Lit
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/2/input.js:1:1]
|
||||
1 |
|
||||
2 | /*#__PURE__*/((() => import('./any'))())
|
||||
: ^^^^^^^
|
||||
`----
|
||||
|
||||
x Str
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/2/input.js:1:1]
|
||||
1 |
|
||||
2 | /*#__PURE__*/((() => import('./any'))())
|
||||
: ^^^^^^^
|
||||
`----
|
@ -0,0 +1,10 @@
|
||||
|
||||
> Leading (lo)
|
||||
|
||||
Error:
|
||||
> #__PURE__
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/2/input.js:1:1]
|
||||
1 |
|
||||
2 | /*#__PURE__*/((() => import('./any'))())
|
||||
: ^
|
||||
`----
|
@ -0,0 +1 @@
|
||||
/*#__PURE__*/(((() => import('./any'))()))
|
@ -0,0 +1,138 @@
|
||||
|
||||
x Module
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/3/input.js:1:1]
|
||||
1 | /*#__PURE__*/(((() => import('./any'))()))
|
||||
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x ModuleItem
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/3/input.js:1:1]
|
||||
1 | /*#__PURE__*/(((() => import('./any'))()))
|
||||
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Stmt
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/3/input.js:1:1]
|
||||
1 | /*#__PURE__*/(((() => import('./any'))()))
|
||||
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x ExprStmt
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/3/input.js:1:1]
|
||||
1 | /*#__PURE__*/(((() => import('./any'))()))
|
||||
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Expr
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/3/input.js:1:1]
|
||||
1 | /*#__PURE__*/(((() => import('./any'))()))
|
||||
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x ParenExpr
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/3/input.js:1:1]
|
||||
1 | /*#__PURE__*/(((() => import('./any'))()))
|
||||
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Expr
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/3/input.js:1:1]
|
||||
1 | /*#__PURE__*/(((() => import('./any'))()))
|
||||
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x ParenExpr
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/3/input.js:1:1]
|
||||
1 | /*#__PURE__*/(((() => import('./any'))()))
|
||||
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Expr
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/3/input.js:1:1]
|
||||
1 | /*#__PURE__*/(((() => import('./any'))()))
|
||||
: ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x CallExpr
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/3/input.js:1:1]
|
||||
1 | /*#__PURE__*/(((() => import('./any'))()))
|
||||
: ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Callee
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/3/input.js:1:1]
|
||||
1 | /*#__PURE__*/(((() => import('./any'))()))
|
||||
: ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Expr
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/3/input.js:1:1]
|
||||
1 | /*#__PURE__*/(((() => import('./any'))()))
|
||||
: ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x ParenExpr
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/3/input.js:1:1]
|
||||
1 | /*#__PURE__*/(((() => import('./any'))()))
|
||||
: ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Expr
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/3/input.js:1:1]
|
||||
1 | /*#__PURE__*/(((() => import('./any'))()))
|
||||
: ^^^^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x ArrowExpr
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/3/input.js:1:1]
|
||||
1 | /*#__PURE__*/(((() => import('./any'))()))
|
||||
: ^^^^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x BlockStmtOrExpr
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/3/input.js:1:1]
|
||||
1 | /*#__PURE__*/(((() => import('./any'))()))
|
||||
: ^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Expr
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/3/input.js:1:1]
|
||||
1 | /*#__PURE__*/(((() => import('./any'))()))
|
||||
: ^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x CallExpr
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/3/input.js:1:1]
|
||||
1 | /*#__PURE__*/(((() => import('./any'))()))
|
||||
: ^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Callee
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/3/input.js:1:1]
|
||||
1 | /*#__PURE__*/(((() => import('./any'))()))
|
||||
: ^^^^^^
|
||||
`----
|
||||
|
||||
x ExprOrSpread
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/3/input.js:1:1]
|
||||
1 | /*#__PURE__*/(((() => import('./any'))()))
|
||||
: ^^^^^^^
|
||||
`----
|
||||
|
||||
x Expr
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/3/input.js:1:1]
|
||||
1 | /*#__PURE__*/(((() => import('./any'))()))
|
||||
: ^^^^^^^
|
||||
`----
|
||||
|
||||
x Lit
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/3/input.js:1:1]
|
||||
1 | /*#__PURE__*/(((() => import('./any'))()))
|
||||
: ^^^^^^^
|
||||
`----
|
||||
|
||||
x Str
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/3/input.js:1:1]
|
||||
1 | /*#__PURE__*/(((() => import('./any'))()))
|
||||
: ^^^^^^^
|
||||
`----
|
@ -0,0 +1,9 @@
|
||||
|
||||
> Leading (lo)
|
||||
|
||||
Error:
|
||||
> #__PURE__
|
||||
,-[$DIR/tests/comments/exprs/paren-pure/3/input.js:1:1]
|
||||
1 | /*#__PURE__*/(((() => import('./any'))()))
|
||||
: ^
|
||||
`----
|
@ -0,0 +1,54 @@
|
||||
|
||||
x Module
|
||||
,-[$DIR/tests/comments/issue-3715/input.js:1:1]
|
||||
1 | a() /* IMPORTANT_DO_NOT_REMOVE */;
|
||||
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x ModuleItem
|
||||
,-[$DIR/tests/comments/issue-3715/input.js:1:1]
|
||||
1 | a() /* IMPORTANT_DO_NOT_REMOVE */;
|
||||
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Stmt
|
||||
,-[$DIR/tests/comments/issue-3715/input.js:1:1]
|
||||
1 | a() /* IMPORTANT_DO_NOT_REMOVE */;
|
||||
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x ExprStmt
|
||||
,-[$DIR/tests/comments/issue-3715/input.js:1:1]
|
||||
1 | a() /* IMPORTANT_DO_NOT_REMOVE */;
|
||||
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
`----
|
||||
|
||||
x Expr
|
||||
,-[$DIR/tests/comments/issue-3715/input.js:1:1]
|
||||
1 | a() /* IMPORTANT_DO_NOT_REMOVE */;
|
||||
: ^^^
|
||||
`----
|
||||
|
||||
x CallExpr
|
||||
,-[$DIR/tests/comments/issue-3715/input.js:1:1]
|
||||
1 | a() /* IMPORTANT_DO_NOT_REMOVE */;
|
||||
: ^^^
|
||||
`----
|
||||
|
||||
x Callee
|
||||
,-[$DIR/tests/comments/issue-3715/input.js:1:1]
|
||||
1 | a() /* IMPORTANT_DO_NOT_REMOVE */;
|
||||
: ^
|
||||
`----
|
||||
|
||||
x Expr
|
||||
,-[$DIR/tests/comments/issue-3715/input.js:1:1]
|
||||
1 | a() /* IMPORTANT_DO_NOT_REMOVE */;
|
||||
: ^
|
||||
`----
|
||||
|
||||
x Ident
|
||||
,-[$DIR/tests/comments/issue-3715/input.js:1:1]
|
||||
1 | a() /* IMPORTANT_DO_NOT_REMOVE */;
|
||||
: ^
|
||||
`----
|
@ -0,0 +1,128 @@
|
||||
|
||||
x Module
|
||||
,-[$DIR/tests/comments/issue-4876/input.js:9:1]
|
||||
9 | // a
|
||||
10 | console.log(1);
|
||||
: ^^^^^^^^^^^^^^^
|
||||
11 | // b
|
||||
`----
|
||||
|
||||
x ModuleItem
|
||||
,-[$DIR/tests/comments/issue-4876/input.js:9:1]
|
||||
9 | // a
|
||||
10 | console.log(1);
|
||||
: ^^^^^^^^^^^^^^^
|
||||
11 | // b
|
||||
`----
|
||||
|
||||
x Stmt
|
||||
,-[$DIR/tests/comments/issue-4876/input.js:9:1]
|
||||
9 | // a
|
||||
10 | console.log(1);
|
||||
: ^^^^^^^^^^^^^^^
|
||||
11 | // b
|
||||
`----
|
||||
|
||||
x ExprStmt
|
||||
,-[$DIR/tests/comments/issue-4876/input.js:9:1]
|
||||
9 | // a
|
||||
10 | console.log(1);
|
||||
: ^^^^^^^^^^^^^^^
|
||||
11 | // b
|
||||
`----
|
||||
|
||||
x Expr
|
||||
,-[$DIR/tests/comments/issue-4876/input.js:9:1]
|
||||
9 | // a
|
||||
10 | console.log(1);
|
||||
: ^^^^^^^^^^^^^^
|
||||
11 | // b
|
||||
`----
|
||||
|
||||
x CallExpr
|
||||
,-[$DIR/tests/comments/issue-4876/input.js:9:1]
|
||||
9 | // a
|
||||
10 | console.log(1);
|
||||
: ^^^^^^^^^^^^^^
|
||||
11 | // b
|
||||
`----
|
||||
|
||||
x Callee
|
||||
,-[$DIR/tests/comments/issue-4876/input.js:9:1]
|
||||
9 | // a
|
||||
10 | console.log(1);
|
||||
: ^^^^^^^^^^^
|
||||
11 | // b
|
||||
`----
|
||||
|
||||
x Expr
|
||||
,-[$DIR/tests/comments/issue-4876/input.js:9:1]
|
||||
9 | // a
|
||||
10 | console.log(1);
|
||||
: ^^^^^^^^^^^
|
||||
11 | // b
|
||||
`----
|
||||
|
||||
x MemberExpr
|
||||
,-[$DIR/tests/comments/issue-4876/input.js:9:1]
|
||||
9 | // a
|
||||
10 | console.log(1);
|
||||
: ^^^^^^^^^^^
|
||||
11 | // b
|
||||
`----
|
||||
|
||||
x Expr
|
||||
,-[$DIR/tests/comments/issue-4876/input.js:9:1]
|
||||
9 | // a
|
||||
10 | console.log(1);
|
||||
: ^^^^^^^
|
||||
11 | // b
|
||||
`----
|
||||
|
||||
x Ident
|
||||
,-[$DIR/tests/comments/issue-4876/input.js:9:1]
|
||||
9 | // a
|
||||
10 | console.log(1);
|
||||
: ^^^^^^^
|
||||
11 | // b
|
||||
`----
|
||||
|
||||
x Ident
|
||||
,-[$DIR/tests/comments/issue-4876/input.js:9:1]
|
||||
9 | // a
|
||||
10 | console.log(1);
|
||||
: ^^^
|
||||
11 | // b
|
||||
`----
|
||||
|
||||
x ExprOrSpread
|
||||
,-[$DIR/tests/comments/issue-4876/input.js:9:1]
|
||||
9 | // a
|
||||
10 | console.log(1);
|
||||
: ^
|
||||
11 | // b
|
||||
`----
|
||||
|
||||
x Expr
|
||||
,-[$DIR/tests/comments/issue-4876/input.js:9:1]
|
||||
9 | // a
|
||||
10 | console.log(1);
|
||||
: ^
|
||||
11 | // b
|
||||
`----
|
||||
|
||||
x Lit
|
||||
,-[$DIR/tests/comments/issue-4876/input.js:9:1]
|
||||
9 | // a
|
||||
10 | console.log(1);
|
||||
: ^
|
||||
11 | // b
|
||||
`----
|
||||
|
||||
x Number
|
||||
,-[$DIR/tests/comments/issue-4876/input.js:9:1]
|
||||
9 | // a
|
||||
10 | console.log(1);
|
||||
: ^
|
||||
11 | // b
|
||||
`----
|
@ -0,0 +1,63 @@
|
||||
|
||||
x Module
|
||||
,-[$DIR/tests/comments/stmts/block/input.js:1:1]
|
||||
1 | ,-> while (1) {
|
||||
2 | | /* test */
|
||||
3 | `-> }
|
||||
`----
|
||||
|
||||
x ModuleItem
|
||||
,-[$DIR/tests/comments/stmts/block/input.js:1:1]
|
||||
1 | ,-> while (1) {
|
||||
2 | | /* test */
|
||||
3 | `-> }
|
||||
`----
|
||||
|
||||
x Stmt
|
||||
,-[$DIR/tests/comments/stmts/block/input.js:1:1]
|
||||
1 | ,-> while (1) {
|
||||
2 | | /* test */
|
||||
3 | `-> }
|
||||
`----
|
||||
|
||||
x WhileStmt
|
||||
,-[$DIR/tests/comments/stmts/block/input.js:1:1]
|
||||
1 | ,-> while (1) {
|
||||
2 | | /* test */
|
||||
3 | `-> }
|
||||
`----
|
||||
|
||||
x Expr
|
||||
,-[$DIR/tests/comments/stmts/block/input.js:1:1]
|
||||
1 | while (1) {
|
||||
: ^
|
||||
2 | /* test */
|
||||
`----
|
||||
|
||||
x Lit
|
||||
,-[$DIR/tests/comments/stmts/block/input.js:1:1]
|
||||
1 | while (1) {
|
||||
: ^
|
||||
2 | /* test */
|
||||
`----
|
||||
|
||||
x Number
|
||||
,-[$DIR/tests/comments/stmts/block/input.js:1:1]
|
||||
1 | while (1) {
|
||||
: ^
|
||||
2 | /* test */
|
||||
`----
|
||||
|
||||
x Stmt
|
||||
,-[$DIR/tests/comments/stmts/block/input.js:1:1]
|
||||
1 | ,-> while (1) {
|
||||
2 | | /* test */
|
||||
3 | `-> }
|
||||
`----
|
||||
|
||||
x BlockStmt
|
||||
,-[$DIR/tests/comments/stmts/block/input.js:1:1]
|
||||
1 | ,-> while (1) {
|
||||
2 | | /* test */
|
||||
3 | `-> }
|
||||
`----
|
@ -0,0 +1,129 @@
|
||||
|
||||
x Module
|
||||
,-[$DIR/tests/comments/stmts/switch/input.js:1:1]
|
||||
1 | ,-> switch (1) {
|
||||
2 | | case 2:
|
||||
3 | | 3;
|
||||
4 | | // 4
|
||||
5 | `-> }
|
||||
`----
|
||||
|
||||
x ModuleItem
|
||||
,-[$DIR/tests/comments/stmts/switch/input.js:1:1]
|
||||
1 | ,-> switch (1) {
|
||||
2 | | case 2:
|
||||
3 | | 3;
|
||||
4 | | // 4
|
||||
5 | `-> }
|
||||
`----
|
||||
|
||||
x Stmt
|
||||
,-[$DIR/tests/comments/stmts/switch/input.js:1:1]
|
||||
1 | ,-> switch (1) {
|
||||
2 | | case 2:
|
||||
3 | | 3;
|
||||
4 | | // 4
|
||||
5 | `-> }
|
||||
`----
|
||||
|
||||
x SwitchStmt
|
||||
,-[$DIR/tests/comments/stmts/switch/input.js:1:1]
|
||||
1 | ,-> switch (1) {
|
||||
2 | | case 2:
|
||||
3 | | 3;
|
||||
4 | | // 4
|
||||
5 | `-> }
|
||||
`----
|
||||
|
||||
x Expr
|
||||
,-[$DIR/tests/comments/stmts/switch/input.js:1:1]
|
||||
1 | switch (1) {
|
||||
: ^
|
||||
2 | case 2:
|
||||
`----
|
||||
|
||||
x Lit
|
||||
,-[$DIR/tests/comments/stmts/switch/input.js:1:1]
|
||||
1 | switch (1) {
|
||||
: ^
|
||||
2 | case 2:
|
||||
`----
|
||||
|
||||
x Number
|
||||
,-[$DIR/tests/comments/stmts/switch/input.js:1:1]
|
||||
1 | switch (1) {
|
||||
: ^
|
||||
2 | case 2:
|
||||
`----
|
||||
|
||||
x SwitchCase
|
||||
,-[$DIR/tests/comments/stmts/switch/input.js:1:1]
|
||||
1 | switch (1) {
|
||||
2 | ,-> case 2:
|
||||
3 | `-> 3;
|
||||
4 | // 4
|
||||
`----
|
||||
|
||||
x Expr
|
||||
,-[$DIR/tests/comments/stmts/switch/input.js:1:1]
|
||||
1 | switch (1) {
|
||||
2 | case 2:
|
||||
: ^
|
||||
3 | 3;
|
||||
`----
|
||||
|
||||
x Lit
|
||||
,-[$DIR/tests/comments/stmts/switch/input.js:1:1]
|
||||
1 | switch (1) {
|
||||
2 | case 2:
|
||||
: ^
|
||||
3 | 3;
|
||||
`----
|
||||
|
||||
x Number
|
||||
,-[$DIR/tests/comments/stmts/switch/input.js:1:1]
|
||||
1 | switch (1) {
|
||||
2 | case 2:
|
||||
: ^
|
||||
3 | 3;
|
||||
`----
|
||||
|
||||
x Stmt
|
||||
,-[$DIR/tests/comments/stmts/switch/input.js:2:1]
|
||||
2 | case 2:
|
||||
3 | 3;
|
||||
: ^^
|
||||
4 | // 4
|
||||
`----
|
||||
|
||||
x ExprStmt
|
||||
,-[$DIR/tests/comments/stmts/switch/input.js:2:1]
|
||||
2 | case 2:
|
||||
3 | 3;
|
||||
: ^^
|
||||
4 | // 4
|
||||
`----
|
||||
|
||||
x Expr
|
||||
,-[$DIR/tests/comments/stmts/switch/input.js:2:1]
|
||||
2 | case 2:
|
||||
3 | 3;
|
||||
: ^
|
||||
4 | // 4
|
||||
`----
|
||||
|
||||
x Lit
|
||||
,-[$DIR/tests/comments/stmts/switch/input.js:2:1]
|
||||
2 | case 2:
|
||||
3 | 3;
|
||||
: ^
|
||||
4 | // 4
|
||||
`----
|
||||
|
||||
x Number
|
||||
,-[$DIR/tests/comments/stmts/switch/input.js:2:1]
|
||||
2 | case 2:
|
||||
3 | 3;
|
||||
: ^
|
||||
4 | // 4
|
||||
`----
|
@ -7,6 +7,7 @@ use swc_ecma_visit::{Visit, VisitWith};
|
||||
|
||||
#[testing::fixture("tests/span/**/*.js")]
|
||||
#[testing::fixture("tests/span/**/*.ts")]
|
||||
#[testing::fixture("tests/comments/**/*.js")]
|
||||
fn span(entry: PathBuf) {
|
||||
let dir = entry.parent().unwrap().to_path_buf();
|
||||
let file_name = entry
|
||||
@ -53,7 +54,7 @@ fn span(entry: PathBuf) {
|
||||
})
|
||||
.expect_err("failed to run test");
|
||||
|
||||
let ref_file = format!("{}.swc-stderr", dir.join(&file_name).display());
|
||||
let ref_file = format!("{}.span.swc-stderr", dir.join(&file_name).display());
|
||||
|
||||
content.compare_to_file(ref_file).unwrap();
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user