feat(es/ast): Support abstract auto-accessors (#8736)

**Description:**

Supports abstract auto-accessors:
3e91592b06/tests/baselines/reference/autoAccessorAllowedModifiers.js (L9)

**BREAKING CHANGE:**

Adds a new is_abstract property
This commit is contained in:
David Sherret 2024-04-23 20:35:33 -04:00 committed by GitHub
parent d925f8a6d2
commit 1155ac7972
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
37 changed files with 263 additions and 71 deletions

View File

@ -332,6 +332,9 @@ pub struct AutoAccessor {
#[cfg_attr(feature = "serde-impl", serde(default))]
pub accessibility: Option<Accessibility>,
#[cfg_attr(feature = "serde-impl", serde(default))]
pub is_abstract: bool,
#[cfg_attr(feature = "serde-impl", serde(default))]
pub is_override: bool,
@ -349,6 +352,7 @@ impl Take for AutoAccessor {
is_static: false,
decorators: Take::dummy(),
accessibility: None,
is_abstract: false,
is_override: false,
definite: false,
}

View File

@ -1384,6 +1384,11 @@ where
space!();
}
if n.is_abstract {
keyword!("abstract");
space!();
}
if n.is_override {
keyword!("override");
space!();

View File

@ -15,5 +15,6 @@ class MyClass extends Base {
public prop13: string;
private static prop14: string;
protected override accessor prop15 = 5;
abstract accessor abstractAccessor: string;
[value]?: string[];
}

View File

@ -15,5 +15,6 @@ class MyClass extends Base {
public prop13: string;
private static prop14: string;
protected override accessor prop15 = 5;
abstract accessor abstractAccessor: string;
[value]?: string[];
}

View File

@ -1 +1 @@
class MyClass extends Base{prop1?: string;prop2!: string;#prop3?: string;#prop4?: string="test";#privateOptionalNoType?;static readonly prop5!: string;readonly #prop6="asdf";public abstract override readonly prop7=5;override readonly #prop8=5;declare public static readonly prop9: string;accessor prop10!: string="";public accessor prop11="";public static accessor prop12="";public prop13: string;private static prop14: string;protected override accessor prop15=5;[value]?: string[]}
class MyClass extends Base{prop1?: string;prop2!: string;#prop3?: string;#prop4?: string="test";#privateOptionalNoType?;static readonly prop5!: string;readonly #prop6="asdf";public abstract override readonly prop7=5;override readonly #prop8=5;declare public static readonly prop9: string;accessor prop10!: string="";public accessor prop11="";public static accessor prop12="";public prop13: string;private static prop14: string;protected override accessor prop15=5;abstract accessor abstractAccessor: string;[value]?: string[]}

View File

@ -1094,6 +1094,7 @@ impl<I: Tokens> Parser<I> {
is_static,
decorators,
accessibility,
is_abstract,
is_override,
definite,
}));

View File

@ -64,6 +64,7 @@
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
},
@ -98,6 +99,7 @@
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
},
@ -139,6 +141,7 @@
"isStatic": true,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
},
@ -173,6 +176,7 @@
"isStatic": true,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
}

View File

@ -57,6 +57,7 @@
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
}
@ -162,6 +163,7 @@
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
}
@ -302,6 +304,7 @@
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
},
@ -436,6 +439,7 @@
"isStatic": true,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
}
@ -497,6 +501,7 @@
"isStatic": true,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
}

View File

@ -222,6 +222,7 @@
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
},

View File

@ -72,6 +72,7 @@
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
},
@ -114,6 +115,7 @@
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
},
@ -163,6 +165,7 @@
"isStatic": true,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
},
@ -205,6 +208,7 @@
"isStatic": true,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
},

View File

@ -64,6 +64,7 @@
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
},
@ -98,6 +99,7 @@
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
},
@ -139,6 +141,7 @@
"isStatic": true,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
},
@ -173,6 +176,7 @@
"isStatic": true,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
}

View File

@ -64,6 +64,7 @@
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
},
@ -98,6 +99,7 @@
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
},
@ -139,6 +141,7 @@
"isStatic": true,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
},
@ -173,6 +176,7 @@
"isStatic": true,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
}

View File

@ -64,6 +64,7 @@
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
}

View File

@ -64,6 +64,7 @@
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": true,
"isOverride": false,
"definite": false
}
@ -125,6 +126,7 @@
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
}

View File

@ -64,6 +64,7 @@
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
},
@ -105,6 +106,7 @@
"isStatic": true,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
}
@ -173,6 +175,7 @@
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
},
@ -214,6 +217,7 @@
"isStatic": true,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
}
@ -310,6 +314,7 @@
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
},
@ -351,6 +356,7 @@
"isStatic": true,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
}

View File

@ -57,6 +57,7 @@
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
}
@ -156,6 +157,7 @@
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
},
@ -299,6 +301,7 @@
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
}
@ -551,6 +554,7 @@
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
},
@ -650,6 +654,7 @@
"isStatic": true,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
}
@ -749,6 +754,7 @@
"isStatic": true,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
},

View File

@ -64,6 +64,7 @@
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
},
@ -105,6 +106,7 @@
"isStatic": false,
"decorators": [],
"accessibility": "public",
"isAbstract": false,
"isOverride": false,
"definite": false
},
@ -146,6 +148,7 @@
"isStatic": false,
"decorators": [],
"accessibility": "private",
"isAbstract": false,
"isOverride": false,
"definite": false
},
@ -187,6 +190,7 @@
"isStatic": false,
"decorators": [],
"accessibility": "protected",
"isAbstract": false,
"isOverride": false,
"definite": false
},
@ -228,6 +232,7 @@
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": true,
"isOverride": false,
"definite": false
},
@ -269,6 +274,7 @@
"isStatic": true,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
},
@ -310,6 +316,7 @@
"isStatic": true,
"decorators": [],
"accessibility": "public",
"isAbstract": false,
"isOverride": false,
"definite": false
},
@ -351,6 +358,7 @@
"isStatic": true,
"decorators": [],
"accessibility": "private",
"isAbstract": false,
"isOverride": false,
"definite": false
},
@ -392,6 +400,7 @@
"isStatic": true,
"decorators": [],
"accessibility": "protected",
"isAbstract": false,
"isOverride": false,
"definite": false
},
@ -441,6 +450,7 @@
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
},
@ -482,6 +492,7 @@
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
},
@ -523,6 +534,7 @@
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
},
@ -572,6 +584,7 @@
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
},
@ -613,6 +626,7 @@
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": true
}
@ -681,6 +695,7 @@
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": true,
"definite": false
},
@ -722,6 +737,7 @@
"isStatic": true,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": true,
"definite": false
}
@ -799,6 +815,7 @@
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
}

View File

@ -57,6 +57,7 @@
"isStatic": true,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
}
@ -126,6 +127,7 @@
"isStatic": true,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
}
@ -195,6 +197,7 @@
"isStatic": true,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
},
@ -237,6 +240,7 @@
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
}
@ -298,6 +302,7 @@
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
}
@ -367,6 +372,7 @@
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
}
@ -474,6 +480,7 @@
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
}
@ -543,6 +550,7 @@
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
},

View File

@ -225,6 +225,7 @@
"isStatic": true,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
},

View File

@ -560,6 +560,7 @@
}
],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
},
@ -1049,6 +1050,7 @@
}
],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
}

View File

@ -191,6 +191,7 @@
}
],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
},
@ -276,6 +277,7 @@
}
],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
},
@ -361,6 +363,7 @@
}
],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
}

View File

@ -133,6 +133,7 @@
}
],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
}

View File

@ -191,6 +191,7 @@
}
],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
},
@ -276,6 +277,7 @@
}
],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
},
@ -361,6 +363,7 @@
}
],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
}
@ -441,6 +444,7 @@
"isStatic": true,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
},

View File

@ -133,6 +133,7 @@
}
],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
}
@ -221,6 +222,7 @@
"isStatic": true,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
},

View File

@ -152,6 +152,7 @@
}
],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
}

View File

@ -152,6 +152,7 @@
}
],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
}

View File

@ -560,6 +560,7 @@
}
],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
},
@ -1049,6 +1050,7 @@
}
],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
}

View File

@ -573,6 +573,7 @@
}
],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
},
@ -1062,6 +1063,7 @@
}
],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
}

View File

@ -869,6 +869,7 @@
}
],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
},
@ -965,6 +966,7 @@
}
],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
},
@ -1947,6 +1949,7 @@
}
],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
},
@ -2043,6 +2046,7 @@
}
],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
},

View File

@ -57,6 +57,7 @@
"isStatic": true,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
},
@ -91,6 +92,7 @@
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
}

View File

@ -111,6 +111,7 @@
}
],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
},
@ -199,6 +200,7 @@
}
],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
}

View File

@ -1,3 +1,6 @@
abstract class B {
abstract accessor i: number;
}
class C1 extends B {
accessor a: any;
accessor b = 1;

View File

@ -2,7 +2,7 @@
"type": "Script",
"span": {
"start": 1,
"end": 291,
"end": 345,
"ctxt": 0
},
"body": [
@ -11,17 +11,17 @@
"identifier": {
"type": "Identifier",
"span": {
"start": 7,
"end": 9,
"start": 16,
"end": 17,
"ctxt": 0
},
"value": "C1",
"value": "B",
"optional": false
},
"declare": false,
"span": {
"start": 1,
"end": 291,
"end": 54,
"ctxt": 0
},
"decorators": [],
@ -29,15 +29,84 @@
{
"type": "AutoAccessor",
"span": {
"start": 26,
"end": 42,
"start": 24,
"end": 52,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 35,
"end": 36,
"start": 42,
"end": 43,
"ctxt": 0
},
"value": "i",
"optional": false
},
"value": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 43,
"end": 51,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 45,
"end": 51,
"ctxt": 0
},
"kind": "number"
}
},
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": true,
"isOverride": false,
"definite": false
}
],
"superClass": null,
"isAbstract": true,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 61,
"end": 63,
"ctxt": 0
},
"value": "C1",
"optional": false
},
"declare": false,
"span": {
"start": 55,
"end": 345,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "AutoAccessor",
"span": {
"start": 80,
"end": 96,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 89,
"end": 90,
"ctxt": 0
},
"value": "a",
@ -47,15 +116,15 @@
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 36,
"end": 41,
"start": 90,
"end": 95,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 38,
"end": 41,
"start": 92,
"end": 95,
"ctxt": 0
},
"kind": "any"
@ -64,21 +133,22 @@
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
},
{
"type": "AutoAccessor",
"span": {
"start": 47,
"end": 62,
"start": 101,
"end": 116,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 56,
"end": 57,
"start": 110,
"end": 111,
"ctxt": 0
},
"value": "b",
@ -87,8 +157,8 @@
"value": {
"type": "NumericLiteral",
"span": {
"start": 60,
"end": 61,
"start": 114,
"end": 115,
"ctxt": 0
},
"value": 1.0,
@ -98,21 +168,22 @@
"isStatic": false,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
},
{
"type": "AutoAccessor",
"span": {
"start": 67,
"end": 90,
"start": 121,
"end": 144,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 83,
"end": 84,
"start": 137,
"end": 138,
"ctxt": 0
},
"value": "c",
@ -122,15 +193,15 @@
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 84,
"end": 89,
"start": 138,
"end": 143,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 86,
"end": 89,
"start": 140,
"end": 143,
"ctxt": 0
},
"kind": "any"
@ -139,21 +210,22 @@
"isStatic": true,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
},
{
"type": "AutoAccessor",
"span": {
"start": 95,
"end": 117,
"start": 149,
"end": 171,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 111,
"end": 112,
"start": 165,
"end": 166,
"ctxt": 0
},
"value": "d",
@ -162,8 +234,8 @@
"value": {
"type": "NumericLiteral",
"span": {
"start": 115,
"end": 116,
"start": 169,
"end": 170,
"ctxt": 0
},
"value": 2.0,
@ -173,21 +245,22 @@
"isStatic": true,
"decorators": [],
"accessibility": null,
"isAbstract": false,
"isOverride": false,
"definite": false
},
{
"type": "AutoAccessor",
"span": {
"start": 122,
"end": 151,
"start": 176,
"end": 205,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 145,
"end": 146,
"start": 199,
"end": 200,
"ctxt": 0
},
"value": "e",
@ -196,8 +269,8 @@
"value": {
"type": "NumericLiteral",
"span": {
"start": 149,
"end": 150,
"start": 203,
"end": 204,
"ctxt": 0
},
"value": 4.0,
@ -207,21 +280,22 @@
"isStatic": true,
"decorators": [],
"accessibility": "public",
"isAbstract": false,
"isOverride": false,
"definite": false
},
{
"type": "AutoAccessor",
"span": {
"start": 156,
"end": 192,
"start": 210,
"end": 246,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 182,
"end": 183,
"start": 236,
"end": 237,
"ctxt": 0
},
"value": "f",
@ -231,15 +305,15 @@
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 183,
"end": 191,
"start": 237,
"end": 245,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 185,
"end": 191,
"start": 239,
"end": 245,
"ctxt": 0
},
"kind": "number"
@ -248,21 +322,22 @@
"isStatic": true,
"decorators": [],
"accessibility": "protected",
"isAbstract": false,
"isOverride": false,
"definite": false
},
{
"type": "AutoAccessor",
"span": {
"start": 197,
"end": 225,
"start": 251,
"end": 279,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 214,
"end": 215,
"start": 268,
"end": 269,
"ctxt": 0
},
"value": "g",
@ -272,15 +347,15 @@
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 216,
"end": 224,
"start": 270,
"end": 278,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 218,
"end": 224,
"start": 272,
"end": 278,
"ctxt": 0
},
"kind": "string"
@ -289,21 +364,22 @@
"isStatic": false,
"decorators": [],
"accessibility": "private",
"isAbstract": false,
"isOverride": false,
"definite": true
},
{
"type": "AutoAccessor",
"span": {
"start": 230,
"end": 252,
"start": 284,
"end": 306,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 246,
"end": 247,
"start": 300,
"end": 301,
"ctxt": 0
},
"value": "h",
@ -312,8 +388,8 @@
"value": {
"type": "NumericLiteral",
"span": {
"start": 250,
"end": 251,
"start": 304,
"end": 305,
"ctxt": 0
},
"value": 1.0,
@ -323,21 +399,22 @@
"isStatic": false,
"decorators": [],
"accessibility": "public",
"isAbstract": false,
"isOverride": false,
"definite": false
},
{
"type": "AutoAccessor",
"span": {
"start": 257,
"end": 289,
"start": 311,
"end": 343,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 282,
"end": 283,
"start": 336,
"end": 337,
"ctxt": 0
},
"value": "i",
@ -346,8 +423,8 @@
"value": {
"type": "NumericLiteral",
"span": {
"start": 286,
"end": 288,
"start": 340,
"end": 342,
"ctxt": 0
},
"value": 10.0,
@ -357,6 +434,7 @@
"isStatic": false,
"decorators": [],
"accessibility": "public",
"isAbstract": false,
"isOverride": true,
"definite": false
}
@ -364,8 +442,8 @@
"superClass": {
"type": "Identifier",
"span": {
"start": 18,
"end": 19,
"start": 72,
"end": 73,
"ctxt": 0
},
"value": "B",

View File

@ -34,6 +34,7 @@ impl VisitMut for StripType {
n.accessibility = None;
n.definite = false;
n.is_override = false;
n.is_abstract = false;
n.visit_mut_children_with(self);
}
@ -64,7 +65,10 @@ impl VisitMut for StripType {
| ClassProp {
is_abstract: true, ..
},
) => false,
)
| ClassMember::AutoAccessor(AutoAccessor {
is_abstract: true, ..
}) => false,
_ => true,
});

View File

@ -1,3 +1,6 @@
abstract class B {
abstract accessor b: string;
}
class Test extends B {
accessor a!: string;
public override accessor b: string = "";

View File

@ -1,3 +1,5 @@
class B {
}
class Test extends B {
accessor a;
accessor b = "";

View File

@ -1906,6 +1906,7 @@ define!({
pub is_static: bool,
pub decorators: Vec<Decorator>,
pub accessibility: Option<Accessibility>,
pub is_abstract: bool,
pub is_override: bool,
pub definite: bool,
}