Commit graph

61 commits

Author SHA1 Message Date
Boshen
6d87b0f1f2 fix(semantic): fix error message for duplicated label (#5071) 2024-08-22 12:30:04 +00:00
Boshen
afe728a73a feat(parser): parse regular expression with regex parser (#4998)
Many false positives and incorrect errors. @leaysgur Enjoy 😁

Run `just conformance` to update the snapshot.
2024-08-22 03:09:55 +00:00
Boshen
bea76f0f24
fix(coverage): fix babel cases 2024-08-17 11:22:00 +08:00
Boshen
81439403fd chore(coverage): print path relative to snapshot file (#4938)
Ctrl + click in terminal can open the file with this change.

I don't know about vscode, but maybe a plugin can help?

<img width="1399" alt="image" src="https://github.com/user-attachments/assets/9bb4609b-14e9-4df8-b5ee-cb96b72b2f7d">

<img width="1131" alt="image" src="https://github.com/user-attachments/assets/e0293693-f755-4b91-8712-bbd2a0e615cc">
2024-08-17 03:09:25 +00:00
Boshen
61cdfef5c7
chore(coverage): remove quotes around path from snapshot files
to make it easier to triple click and copy the path
2024-08-16 16:03:50 +08:00
DonIsaac
a2eabe1f4b refactor(parser): use error codes for ts diagnostics (#4335)
Part of #4333
2024-07-18 16:09:25 +00:00
Boshen
28eeee0f71 fix(parser): fix asi error diagnostic pointing at invalid text causing crash (#4163) 2024-07-10 14:45:10 +00:00
DonIsaac
2f53bdf72d feat(semantic): check for abstract ClassElements in non-abstract classes (#4127)
feat(semantic): check for abstract ClassElements in non-abstract classes

chore: update coverage snapshots
2024-07-09 03:35:32 +00:00
Don Isaac
c4ee9f8ec6
feat(semantic): check for abstract initializations and implementations (#4125) 2024-07-08 17:30:16 -04:00
DonIsaac
e386b62331 feat(semantic): check for invalid type import assignments (#4097)
Adds checks to `TSImportEqualsDeclaration` for invalid use of `import type` modifier.

```ts
import { Foo } from './foo'
namespace Bar {
  export class Baz {}
}

import type A = Foo.Baz;        // not allowed
import type B = Bar.Baz;        // not allowed
import type C = require('./c'); // allowed
```
2024-07-08 03:14:22 +00:00
Boshen
243c9f35b0 refactor(parser): use function instead of trait to parse list with rest element (#4028)
closes #3887
2024-07-02 13:43:14 +00:00
Boshen
1dacb1fc5b
refactor(parser): use function instead of trait to parse delimited lists (#4014)
relates #3887

The rest of the list parsing trait implementations involves ... parsing
`rest`, which I'll refactor in another PR.
2024-07-02 14:47:56 +08:00
DonIsaac
63f36daae0 feat(parser): parse modifiers with parse_modifiers (take 2) (#3977)
Same as #3948, with fixes for bugs found by @Boshen.
2024-06-30 03:46:34 +00:00
Boshen
14bc31ee74
Revert "feat(parser): parse modifiers with parse_modifiers (#3948)"
This reverts commit 7b38bde073.
2024-06-29 14:16:26 +08:00
DonIsaac
7b38bde073 feat(parser): parse modifiers with parse_modifiers (#3948)
Closes #3929
2024-06-29 05:29:47 +00:00
Boshen
3db2553dc2 refactor(parser): improve parsing of TypeScript type arguments (#3923) 2024-06-26 07:16:18 +00:00
Boshen
4cf3c7645f refactor(parser): improve parsing of TypeScript types (#3903)
- [x] fix everything
2024-06-26 05:58:16 +00:00
Dunqing
ef82c78a72 fix(parser): trailing comma is not allowed in ParenthesizedExpression (#3885)
close: #3878

The implementation is copied from `SeparatedList`'s `print_list`.
```diff
    fn parse_list(&mut self, p: &mut ParserImpl<'a>) -> Result<()> {
        p.expect(self.open())?;

        let mut first = true;

        while !p.at(self.close()) && !p.at(Kind::Eof) {
            if first {
                first = false;
            } else {
                p.expect(self.separator())?;
-                if p.at(self.close()) {
-                    break;
-               }
            }

            self.parse_element(p)?;
        }

        p.expect(self.close())?;
        Ok(())
    }
```
2024-06-24 14:56:32 +00:00
Boshen
13754cbd3d fix(parser): change diagnostic to "modifier cannot be used here" (#3853) 2024-06-23 15:14:27 +00:00
Boshen
ae09a97a09
refactor(ast)!: remove Modifiers from ts nodes (#3846) 2024-06-23 19:44:35 +08:00
Don Isaac
d5f6aeb1ca
feat(semantic): check for illegal symbol modifiers (#3838) 2024-06-23 12:36:09 +08:00
Boshen
c041e9d1a9
chore: bump test262, babel and TypeScript submodules (#3644) 2024-06-12 18:42:32 +08:00
Dunqing
350cd9158a
fix(parser): should parser error when function declaration has no name (#3461)
https://oxc-project.github.io/oxc/playground/?code=3YCAAICNgICAgICAgICzncl%2FKeF7k4Y7upgY2l43c79%2FYxaAgA%3D%3D
2024-05-30 19:58:50 +08:00
Boshen
89a1f97320
refactor(parser): improve expression parsing (#3352) 2024-05-19 21:28:16 +08:00
Boshen
e818fba21c refactor(parser): improve parse_simple_arrow_function_expression (#3349) 2024-05-19 06:05:39 +00:00
Boshen
530455849b chore(tasks): add commit sha to snapshots to make sure submodules are not outdated (#3267)
If submodules are outdated, it'll panic with the following message

```
Repository is outdated, please run `just submodules` to update it.
```

For us maintainers, we'll need the env `UPDATE_SNAPSHOT` to force an update.
2024-05-14 10:18:00 +00:00
Boshen
09f34fc942
refactor(semantic): unify diagnostic in checker 2024-05-12 01:07:28 +08:00
Dunqing
0ba7778e5e
fix(parser): correctly parse cls.fn<C> = x (#3208)
close: #3206
2024-05-09 10:23:45 +08:00
Dunqing
a227050ed0
chore: update babel repo (#3205) 2024-05-08 20:15:15 +08:00
Dunqing
220f722f19
chore: update snapshots (#2817)
Babel repo is updated in #2813 and #2814
2024-03-26 11:53:26 +08:00
Boshen
86ee074678
fix(parser): remove all duplicated comments in trivia builder (#2689) 2024-03-12 17:51:22 +08:00
Boshen
977c20b677
feat(coverage): add a duplicate comment check (#2688) 2024-03-12 16:52:34 +08:00
Boshen
6c6adb46d1
fix(ast): parse rest parameter with the correct optional and type annotation syntax (#2686)
closes #2653
2024-03-12 15:47:22 +08:00
Boshen
8a73d18fcf
chore(parser): make sure all span.end >= span.start (#2681)
closes #2679
2024-03-11 19:49:51 +08:00
Boshen
265b2fb640
feat: miette v7 (#2465) 2024-03-08 15:50:00 +08:00
Boshen
240ff19675
refactor(parser): improve parsing of BindingPattern in TypeScript (#2624)
closes #2622
2024-03-06 16:16:03 +08:00
Dunqing
197fa16613
feat(semantic): add check for duplicate class elements in checker (#2455)
1. Remove the check implementation of the parser
2. Implement it to semantic checker
3. Support typescript's check for duplicate class elements

Support checking for duplicate class elements in semantic checker is
easier to support typescript checking rules.
2024-02-21 14:10:19 +08:00
Boshen
ef336cb66b
feat(parser): recover from async x [newline] => x (#2375)
```javascript
async x
=> x
```

Babel recovers and displays "No line break is allowed before '=>'
2024-02-10 11:19:08 +08:00
Dunqing
a3570d41f0
feat(semantic): report parameter related errors for setter/getter (#2316) 2024-02-05 17:38:43 +08:00
Dunqing
9ca13d040d
feat(semantic): report type parameter list cannot be empty (#2315) 2024-02-05 16:05:51 +08:00
Dunqing
f53c54ced9
feat(semantic): report unexpected type annotation in ArrayPattern (#2309) 2024-02-05 13:45:52 +08:00
Boshen
650f6c942f
refactor: use our forked version of miette::Reporter for tests (#2266) 2024-02-02 16:15:31 +08:00
Dunqing
da2ffdf7a0
feat(semantic): check parameters property (#2264) 2024-02-02 15:58:32 +08:00
Dunqing
d71175e712
feat(semantic): check optional parameters (#2263) 2024-02-02 15:54:04 +08:00
Boshen
a69b76ab77
chore: update snapshots 2024-01-15 21:13:05 +08:00
Boshen
08438e04ba
refactor(parser): remove TokenValue::RegExp from Token (#1926)
This PR is part of #1880.

`Token` size is reduced from 48 to 40 bytes.

To reconstruct the regex pattern and flags within the parser , the regex
string is
re-parsed from the end by reading all valid flags.

In order to make things work nicely, the lexer will no longer recover
from a invalid regex.
2024-01-08 13:48:52 +08:00
Dunqing
c3090c2c70
fix(parser): terminate parsing if an EmptyParenthesizedExpression error occurs (#1874)
close: https://github.com/oxc-project/oxc/issues/1870#issue-2061901976
2024-01-03 11:34:14 +08:00
Boshen
19e77b0af3
fix(parser): false postive for "Missing initializer in const declaration" in declare + namespace (#1724)
closes #1723
2023-12-18 17:03:42 +08:00
Boshen
7fca9504d2
chore: update snapshots 2023-11-28 16:27:10 +08:00
magic-akari
9c0aafcd1c
fix(parser): Disallow ReservedWord in NamedExports (#1230)
- fix: #1222

---------

Co-authored-by: Boshen <boshenc@gmail.com>
2023-11-12 10:52:02 +00:00