add legacy decorators support to strict class fields (#10616)

This PR allows legacy decorators to work with strict class fields, which
are now stage 3 and have shipped in a number of browsers. Allowing this will
allow users of the legacy transform (which is currently recommended by the
champions of the decorator proposal) to use the proper class field semantics
for non-decorated fields, which should help prevent breakage later on.

This change is not a breaking change, since users had to explicitly opt into
loose mode in class fields before. This just gives them the option to remove
that opt-in.
This commit is contained in:
Chris Garrett
2019-11-04 10:05:42 -08:00
committed by Huáng Jùnliàng
parent bea1b0d0af
commit 5c0d8a9de7
13 changed files with 186 additions and 5 deletions

View File

@@ -1040,9 +1040,7 @@ helpers.initializerWarningHelper = helper("7.0.0-beta.0")`
export default function _initializerWarningHelper(descriptor, context){
throw new Error(
'Decorating class property failed. Please ensure that ' +
'proposal-class-properties is enabled and set to use loose mode. ' +
'To use proposal-class-properties in spec mode with decorators, wait for ' +
'the next major version of decorators in stage 2.'
'proposal-class-properties is enabled and runs after the decorators transform.'
);
}
`;