Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

Commit

Permalink
feat(rome_js_parser): EcmaScript @decorators #4252
Browse files Browse the repository at this point in the history
  • Loading branch information
denbezrukov committed Apr 30, 2023
1 parent ffe4934 commit 6d77bad
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 29 deletions.
9 changes: 4 additions & 5 deletions crates/rome_js_formatter/tests/quick_test.rs
Expand Up @@ -13,14 +13,13 @@ mod language {
// use this test check if your snippet prints as you wish, without using a snapshot
fn quick_test() {
let src = r#"
class A {
@dec()
// comment
accessor b;
abstract class Something3 {
@foo()
// comment
abstract method(): Array<string>
}
"#;
let syntax = SourceType::tsx();
let tree = parse(src, syntax);
Expand Down
Expand Up @@ -167,18 +167,6 @@ decorators-comments.ts:35:5 parse ━━━━━━━━━━━━━━━
36 │ }
37 │
decorators-comments.ts:33:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Decorators are not valid here.
32 │ class Something2 {
> 33 │ @foo()
│ ^^^^^^
34 │ // comment
35 │ abstract property: Array<string>
i Decorators are only valid on class declarations, class expressions, and class methods.
decorators-comments.ts:41:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Only abstract classes can have abstract members
Expand All @@ -190,18 +178,6 @@ decorators-comments.ts:41:5 parse ━━━━━━━━━━━━━━━
42 │ }
43 │
decorators-comments.ts:39:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Decorators are not valid here.
38 │ class Something3 {
> 39 │ @foo()
│ ^^^^^^
40 │ // comment
41 │ abstract method(): Array<string>
i Decorators are only valid on class declarations, class expressions, and class methods.
```

Expand Down
2 changes: 2 additions & 0 deletions crates/rome_js_parser/src/syntax/class.rs
Expand Up @@ -2160,6 +2160,8 @@ impl ClassMemberModifiers {
| JS_METHOD_CLASS_MEMBER
| JS_GETTER_CLASS_MEMBER
| JS_SETTER_CLASS_MEMBER
| TS_METHOD_SIGNATURE_CLASS_MEMBER
| TS_PROPERTY_SIGNATURE_CLASS_MEMBER
)
{
// test ts decorator_parameters_constructor
Expand Down

0 comments on commit 6d77bad

Please sign in to comment.