Skip to content

Add support for class static block #43092

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 83 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
e3a3fb8
Added support for private identifier methods.
dragomirtitian Jan 15, 2021
4ab27a2
Added tests for private methods.
dragomirtitian Jan 15, 2021
6977b9f
Added check to only not allow private name method signatures in anyth…
dragomirtitian Jan 18, 2021
bc8c07e
Added private accessors tests
dragomirtitian Jan 19, 2021
2760ed8
Transform private methods
mkubilayk Jan 25, 2021
04af85d
Rename shouldTransformPrivateFields
mkubilayk Jan 25, 2021
f048d72
Accept baseline
mkubilayk Jan 25, 2021
f8cfb81
Use a single WeakSet for brand-check
mkubilayk Jan 26, 2021
4aa4c3b
Accept baseline
mkubilayk Jan 26, 2021
0ac1271
Add a test for using private methods in static field initializers
mkubilayk Jan 26, 2021
7da5bd9
Add breaking checker test
mkubilayk Jan 26, 2021
e133f60
Add to instances once per-instance
mkubilayk Jan 26, 2021
aa5dd8a
Accept baseline
mkubilayk Jan 26, 2021
a3889a7
fix: evaluate receiver and rhs expressions before throwing on readonl…
mkubilayk Jan 26, 2021
8952caa
Add a test for evaluating rhs before readonly assignment
mkubilayk Jan 26, 2021
dee87bb
Transpile private accessors
mkubilayk Jan 27, 2021
aec7e9b
Accept baseline
mkubilayk Jan 27, 2021
f3bbf0f
fix: handle readonly/writeonly accessors
mkubilayk Jan 28, 2021
a1b59cd
accept baseline
mkubilayk Jan 28, 2021
6b74498
add a test for private setter without a getter
mkubilayk Jan 28, 2021
d51f6cd
fix: getAllUnscopedEmitHelpers
mkubilayk Jan 28, 2021
c175770
fix: better handling of duplicate names
mkubilayk Jan 29, 2021
4301af5
Fixed wrong error message for private methods in class expressions.
dragomirtitian Feb 1, 2021
3a056b2
change error message
mkubilayk Feb 1, 2021
95df2d1
add a test for async private methods with a higher target
mkubilayk Feb 1, 2021
590124e
fix: setter assignment returns rhs value
mkubilayk Feb 3, 2021
219ea83
add a test for setter assignment return value
mkubilayk Feb 3, 2021
25da8ca
fix: handle duplicate accessors
mkubilayk Feb 3, 2021
a2228be
add tests for duplicate accessors
mkubilayk Feb 3, 2021
ff4f737
docs: add missing parameter docs
mkubilayk Feb 3, 2021
704727c
Fixed failing test.
dragomirtitian Feb 3, 2021
73925dc
baseline-accept: ordering changes
mkubilayk Feb 17, 2021
67fd38d
fix: attach weakSetName to property declaration
mkubilayk Feb 17, 2021
45c2a41
add a test for nested private methods
mkubilayk Feb 17, 2021
356b91d
add a test with any
mkubilayk Feb 17, 2021
b391464
Merge pull request #51 from bloomberg/fix/nested-private-methods
dragomirtitian Feb 18, 2021
5ebb3d6
Added support for static private fields accessors and methods.
dragomirtitian Feb 16, 2021
7006c09
Added error message for private identifiers used with static decorato…
dragomirtitian Feb 16, 2021
b876613
Fixed emit static bug that used private names outside of classes for …
dragomirtitian Feb 18, 2021
31a8c00
Added tests for private static fields methods and accessors.
dragomirtitian Feb 18, 2021
9219e99
Merge remote-tracking branch 'remotes/origin/master' into es-private-…
dragomirtitian Feb 19, 2021
5a27a32
Merge remote-tracking branch 'remotes/bloomberg/es-private-methods-an…
dragomirtitian Feb 19, 2021
964fc27
Fixed error messages and tests after merge.
dragomirtitian Feb 19, 2021
d2ab6fc
Merge branch 'es-private-methods-and-accessors' into es-private-stati…
dragomirtitian Feb 19, 2021
23f6c67
Accept new baseline.
dragomirtitian Feb 19, 2021
374e6f3
Improved duplicate identifier checks for static private class elements.
dragomirtitian Feb 19, 2021
62b4f2f
Added error when using initializers with private static fields when u…
dragomirtitian Feb 23, 2021
b2a692d
Fixed code review issues.
dragomirtitian Feb 24, 2021
363041e
Removed semantically wrong emit on `useDefineForClassFields:true` wit…
dragomirtitian Feb 24, 2021
64757e0
Changed emit for uninitialized private static fields.
dragomirtitian Feb 25, 2021
68a7f80
Added runtime error in helper if a static private field is accessed b…
dragomirtitian Feb 25, 2021
7e7b0b1
Fixed code review comments for private identifier static class elements.
dragomirtitian Feb 25, 2021
30c7f69
add debug.assertNever for unknown node type (#53)
mkubilayk Mar 1, 2021
c924058
Merge remote-tracking branch 'upstream/master' into es-private-method…
mkubilayk Mar 1, 2021
e65116f
Merge remote-tracking branch 'upstream/master' into es-private-method…
mkubilayk Mar 2, 2021
4748c87
Fixed code review issues.
dragomirtitian Mar 3, 2021
09a5aae
Merge branch 'es-private-methods-and-accessors' into es-private-stati…
dragomirtitian Mar 3, 2021
497e47f
Fixed code review issues for private class elements.
dragomirtitian Mar 3, 2021
3860b52
Add types factory and parser
Kingwl Mar 5, 2021
6d88baf
Add some case
Kingwl Mar 5, 2021
909c313
Make class static block as a container
Kingwl Mar 7, 2021
7c272dc
Update cases
Kingwl Mar 7, 2021
055ef74
Add visitor
Kingwl Mar 7, 2021
a4f6f3c
Add emitter and more compile target
Kingwl Mar 7, 2021
9669b7f
Check boundary of break and continue
Kingwl Mar 8, 2021
294cc48
Fixes class shadowing when checking access to a private static class …
dragomirtitian Mar 8, 2021
027bdb3
Merge remote-tracking branch 'remotes/origin/master' into es-private-…
dragomirtitian Mar 8, 2021
7bbc944
Merge remote-tracking branch 'upstream/master'
mkubilayk Mar 17, 2021
dd526e7
fix private methods/accessors in class expr inside a loop
mkubilayk Mar 17, 2021
f6ecfab
collapse switch case
mkubilayk Mar 17, 2021
6c3f661
fix class name
mkubilayk Mar 17, 2021
ef69c6c
simplify getPrivateMethodsAndAccessors
mkubilayk Mar 17, 2021
2a646ed
remove findPreviousAccessorInfo
mkubilayk Mar 17, 2021
d8136f7
lazily create weakSetName identifier
mkubilayk Mar 17, 2021
fbd749c
Merge remote-tracking branch 'remotes/bloomberg/es-private-static-fie…
dragomirtitian Mar 17, 2021
f96eafe
Merge remote-tracking branch 'remotes/bloomberg/es-private-static-fie…
dragomirtitian Mar 17, 2021
2de8a43
Merge branch 'es-private-methods-and-accessors' of https://github.com…
dragomirtitian Mar 18, 2021
5a2f195
Removed all the emit helpers for private identifier methods accessors…
dragomirtitian Mar 17, 2021
7490a36
do not allocate a node if not needed in visitMehodDeclaration (#55)
mkubilayk Mar 18, 2021
a3fdc4b
Simplified emit for private identifier class elements.
dragomirtitian Mar 18, 2021
668245b
Merge pull request #56 from bloomberg/es-private-methods-and-accessor…
dragomirtitian Mar 18, 2021
55a7097
do not clone the receiver (#57)
mkubilayk Mar 18, 2021
295f51f
Merge branch 'static_class_block_support' into class_static_block
Kingwl Mar 19, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1,274 changes: 637 additions & 637 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion src/compiler/binder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1829,6 +1829,7 @@ namespace ts {
case SyntaxKind.ConstructSignature:
case SyntaxKind.IndexSignature:
case SyntaxKind.ConstructorType:
case SyntaxKind.ClassStaticBlockDeclaration:
return ContainerFlags.IsContainer | ContainerFlags.IsControlFlowContainer | ContainerFlags.HasLocals | ContainerFlags.IsFunctionLike;

case SyntaxKind.FunctionExpression:
Expand Down Expand Up @@ -1864,7 +1865,7 @@ namespace ts {
// By not creating a new block-scoped-container here, we ensure that both 'var x'
// and 'let x' go into the Function-container's locals, and we do get a collision
// conflict.
return isFunctionLike(node.parent) ? ContainerFlags.None : ContainerFlags.IsBlockScopedContainer;
return isFunctionLike(node.parent) || isClassStaticBlockDeclaration(node.parent) ? ContainerFlags.None : ContainerFlags.IsBlockScopedContainer;
}

return ContainerFlags.None;
Expand Down Expand Up @@ -1926,6 +1927,7 @@ namespace ts {
case SyntaxKind.JSDocFunctionType:
case SyntaxKind.JSDocTypedefTag:
case SyntaxKind.JSDocCallbackTag:
case SyntaxKind.ClassStaticBlockDeclaration:
case SyntaxKind.TypeAliasDeclaration:
case SyntaxKind.MappedType:
// All the children of these container types are never visible through another
Expand Down
175 changes: 110 additions & 65 deletions src/compiler/checker.ts

Large diffs are not rendered by default.

24 changes: 16 additions & 8 deletions src/compiler/diagnosticMessages.json
Original file line number Diff line number Diff line change
Expand Up @@ -3284,6 +3284,18 @@
"category": "Error",
"code": 2802
},
"Cannot assign to private method '{0}'. Private methods are not writable.": {
"category": "Error",
"code": 2803
},
"Duplicate identifier '{0}'. Static and instance elements cannot share the same private name.": {
"category": "Error",
"code": 2804
},
"Static fields with private names can't have initializers when the '--useDefineForClassFields' flag is not specified with a '--target' of 'esnext'. Consider adding the '--useDefineForClassFields' flag.": {
"category": "Error",
"code": 2805
},

"Import declaration '{0}' is using private name '{1}'.": {
"category": "Error",
Expand Down Expand Up @@ -6334,14 +6346,6 @@
"category": "Error",
"code": 18019
},
"A method cannot be named with a private identifier.": {
"category": "Error",
"code": 18022
},
"An accessor cannot be named with a private identifier.": {
"category": "Error",
"code": 18023
},
"An enum member cannot be named with a private identifier.": {
"category": "Error",
"code": 18024
Expand Down Expand Up @@ -6385,5 +6389,9 @@
"Invalid value for 'jsxFragmentFactory'. '{0}' is not a valid identifier or qualified-name.": {
"category": "Error",
"code": 18035
},
"Class decorators can't be used with static private identifier. Consider removing the experimental decorator.": {
"category": "Error",
"code": 18036
}
}
13 changes: 13 additions & 0 deletions src/compiler/emitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1341,6 +1341,8 @@ namespace ts {
return emitMethodSignature(<MethodSignature>node);
case SyntaxKind.MethodDeclaration:
return emitMethodDeclaration(<MethodDeclaration>node);
case SyntaxKind.ClassStaticBlockDeclaration:
return emitClassStaticBlockDeclaration(<ClassStaticBlockDeclaration>node);
case SyntaxKind.Constructor:
return emitConstructor(<ConstructorDeclaration>node);
case SyntaxKind.GetAccessor:
Expand Down Expand Up @@ -2008,6 +2010,11 @@ namespace ts {
emitSignatureAndBody(node, emitSignatureHead);
}

function emitClassStaticBlockDeclaration(node: ClassStaticBlockDeclaration) {
emit(node.staticToken);
emitBlockFunctionBody(node.body);
}

function emitConstructor(node: ConstructorDeclaration) {
emitModifiers(node, node.modifiers);
writeKeyword("constructor");
Expand Down Expand Up @@ -5770,6 +5777,12 @@ namespace ts {
visitTypeNode(node.type),
visitFunctionBody(node.body));

case SyntaxKind.ClassStaticBlockDeclaration:
Debug.type<ClassStaticBlockDeclaration>(node);
return factory.updateClassStaticBlockDeclaration(node,
visit(node.staticToken, isStaticModifier),
visitFunctionBody(node.body));

case SyntaxKind.Constructor:
Debug.type<ConstructorDeclaration>(node);
return factory.updateConstructorDeclaration(node,
Expand Down
150 changes: 130 additions & 20 deletions src/compiler/factory/emitHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ namespace ts {
createImportDefaultHelper(expression: Expression): Expression;
createExportStarHelper(moduleExpression: Expression, exportsExpression?: Expression): Expression;
// Class Fields Helpers
createClassPrivateFieldGetHelper(receiver: Expression, privateField: Identifier): Expression;
createClassPrivateFieldSetHelper(receiver: Expression, privateField: Identifier, value: Expression): Expression;
createClassPrivateFieldGetHelper(receiver: Expression, state: Identifier, kind: PrivateIdentifierKind, f: Identifier | undefined): Expression;
createClassPrivateFieldSetHelper(receiver: Expression, state: Identifier, value: Expression, kind: PrivateIdentifierKind, f: Identifier | undefined): Expression;
}

export function createEmitHelperFactory(context: TransformationContext): EmitHelperFactory {
Expand Down Expand Up @@ -368,15 +368,30 @@ namespace ts {

// Class Fields Helpers

function createClassPrivateFieldGetHelper(receiver: Expression, privateField: Identifier) {
function createClassPrivateFieldGetHelper(receiver: Expression, state: Identifier, kind: PrivateIdentifierKind, f: Identifier | undefined) {
context.requestEmitHelper(classPrivateFieldGetHelper);
return factory.createCallExpression(getUnscopedHelperName("__classPrivateFieldGet"), /*typeArguments*/ undefined, [receiver, privateField]);
let args;
if (!f) {
args = [receiver, state, factory.createStringLiteral(kind)];
}
else {
args = [receiver, state, factory.createStringLiteral(kind), f];
}
return factory.createCallExpression(getUnscopedHelperName("__classPrivateFieldGet"), /*typeArguments*/ undefined, args);
}

function createClassPrivateFieldSetHelper(receiver: Expression, privateField: Identifier, value: Expression) {
function createClassPrivateFieldSetHelper(receiver: Expression, state: Identifier, value: Expression, kind: PrivateIdentifierKind, f: Identifier | undefined) {
context.requestEmitHelper(classPrivateFieldSetHelper);
return factory.createCallExpression(getUnscopedHelperName("__classPrivateFieldSet"), /*typeArguments*/ undefined, [receiver, privateField, value]);
let args;
if (!f) {
args = [receiver, state, value, factory.createStringLiteral(kind)];
}
else {
args = [receiver, state, value, factory.createStringLiteral(kind), f];
}
return factory.createCallExpression(getUnscopedHelperName("__classPrivateFieldSet"), /*typeArguments*/ undefined, args);
}

}

/* @internal */
Expand Down Expand Up @@ -803,7 +818,6 @@ namespace ts {
};`
};

// emit output for the __export helper function
export const exportStarHelper: UnscopedEmitHelper = {
name: "typescript:export-star",
importName: "__exportStar",
Expand All @@ -816,31 +830,127 @@ namespace ts {
};`
};

// Class fields helpers
/**
* Parameters:
* @param receiver — The object on which the private member will be set.
* @param state — One of the following:
* - A WeakMap used to store a private instance field.
* - A WeakSet used as an instance brand for private instance methods and accessors.
* - A function value that should be the undecorated class constructor used to brand check private static fields, methods, and accessors.
* @param value — The value to set.
* @param kind — (optional pre TS 4.3, required for TS 4.3+) One of the following values:
* - undefined — Indicates a private instance field (pre TS 4.3).
* - "f" — Indicates a private field (instance or static).
* - "m" — Indicates a private method (instance or static).
* - "a" — Indicates a private accessor (instance or static).
* @param f — (optional pre TS 4.3) Depends on the arguments for state and kind:
* - If kind is "m", this should be the function corresponding to the static or instance method.
* - If kind is "a", this should be the function corresponding to the setter method, or undefined if the setter was not defined.
* - If kind is "f" and state is a function, this should be an object holding the value of a static field, or undefined if the static field declaration has not yet been evaluated.
* Usage:
* This helper will only ever be used by the compiler in the following ways:
*
* Writing to a private instance field (pre TS 4.3):
* __classPrivateFieldSet(<any>, <WeakMap>, <any>)
*
* Writing to a private instance field (TS 4.3+):
* __classPrivateFieldSet(<any>, <WeakMap>, <any>, "f")
*
* Writing to a private instance set accessor (when defined, TS 4.3+):
* __classPrivateFieldSet(<any>, <WeakSet>, <any>, "a", <function>)
*
* Writing to a private instance set accessor (when not defined, TS 4.3+):
* __classPrivateFieldSet(<any>, <WeakSet>, <any>, "a", void 0)
* NOTE: This always results in a runtime error.
*
* Writing to a private instance method (TS 4.3+):
* __classPrivateFieldSet(<any>, <WeakSet>, <any>, "m", <function>)
* NOTE: This always results in a runtime error.
*
* Writing to a private static field (TS 4.3+):
* __classPrivateFieldSet(<any>, <constructor>, <any>, "f", <{ value: any }>)
*
* Writing to a private static set accessor (when defined, TS 4.3+):
* __classPrivateFieldSet(<any>, <constructor>, <any>, "a", <function>)
*
* Writing to a private static set accessor (when not defined, TS 4.3+):
* __classPrivateFieldSet(<any>, <constructor>, <any>, "a", void 0)
* NOTE: This always results in a runtime error.
*
* Writing to a private static method (TS 4.3+):
* __classPrivateFieldSet(<any>, <constructor>, <any>, "m", <function>)
* NOTE: This always results in a runtime error.
*/
export const classPrivateFieldGetHelper: UnscopedEmitHelper = {
name: "typescript:classPrivateFieldGet",
importName: "__classPrivateFieldGet",
scoped: false,
text: `
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, privateMap) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to get private field on non-instance");
}
return privateMap.get(receiver);
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};`
};

/**
* Parameters:
* @param receiver — The object from which the private member will be read.
* @param state — One of the following:
* - A WeakMap used to read a private instance field.
* - A WeakSet used as an instance brand for private instance methods and accessors.
* - A function value that should be the undecorated class constructor used to brand check private static fields, methods, and accessors.
* @param kind — (optional pre TS 4.3, required for TS 4.3+) One of the following values:
* - undefined — Indicates a private instance field (pre TS 4.3).
* - "f" — Indicates a private field (instance or static).
* - "m" — Indicates a private method (instance or static).
* - "a" — Indicates a private accessor (instance or static).
* @param f — (optional pre TS 4.3) Depends on the arguments for state and kind:
* - If kind is "m", this should be the function corresponding to the static or instance method.
* - If kind is "a", this should be the function corresponding to the getter method, or undefined if the getter was not defined.
* - If kind is "f" and state is a function, this should be an object holding the value of a static field, or undefined if the static field declaration has not yet been evaluated.
* Usage:
* This helper will only ever be used by the compiler in the following ways:
*
* Reading from a private instance field (pre TS 4.3):
* __classPrivateFieldGet(<any>, <WeakMap>)
*
* Reading from a private instance field (TS 4.3+):
* __classPrivateFieldGet(<any>, <WeakMap>, "f")
*
* Reading from a private instance get accessor (when defined, TS 4.3+):
* __classPrivateFieldGet(<any>, <WeakSet>, "a", <function>)
*
* Reading from a private instance get accessor (when not defined, TS 4.3+):
* __classPrivateFieldGet(<any>, <WeakSet>, "a", void 0)
* NOTE: This always results in a runtime error.
*
* Reading from a private instance method (TS 4.3+):
* __classPrivateFieldGet(<any>, <WeakSet>, "m", <function>)
*
* Reading from a private static field (TS 4.3+):
* __classPrivateFieldGet(<any>, <constructor>, "f", <{ value: any }>)
*
* Reading from a private static get accessor (when defined, TS 4.3+):
* __classPrivateFieldGet(<any>, <constructor>, "a", <function>)
*
* Reading from a private static get accessor (when not defined, TS 4.3+):
* __classPrivateFieldGet(<any>, <constructor>, "a", void 0)
* NOTE: This always results in a runtime error.
*
* Reading from a private static method (TS 4.3+):
* __classPrivateFieldGet(<any>, <constructor>, "m", <function>)
*/
export const classPrivateFieldSetHelper: UnscopedEmitHelper = {
name: "typescript:classPrivateFieldSet",
importName: "__classPrivateFieldSet",
scoped: false,
text: `
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, privateMap, value) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to set private field on non-instance");
}
privateMap.set(receiver, value);
return value;
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};`
};

Expand Down Expand Up @@ -897,4 +1007,4 @@ namespace ts {
&& (getEmitFlags(firstSegment.expression) & EmitFlags.HelperName)
&& firstSegment.expression.escapedText === helperName;
}
}
}
32 changes: 32 additions & 0 deletions src/compiler/factory/nodeFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ namespace ts {
updateConstructSignature,
createIndexSignature,
updateIndexSignature,
createClassStaticBlockDeclaration,
updateClassStaticBlockDeclaration,
createTemplateLiteralTypeSpan,
updateTemplateLiteralTypeSpan,
createKeywordTypeNode,
Expand Down Expand Up @@ -1610,6 +1612,36 @@ namespace ts {
: node;
}

// @api
function createClassStaticBlockDeclaration(
staticToken: Token<SyntaxKind.StaticKeyword>,
body: Block
): ClassStaticBlockDeclaration {
const node = createBaseGenericNamedDeclaration<ClassStaticBlockDeclaration>(
SyntaxKind.ClassStaticBlockDeclaration,
/*decorators*/ undefined,
/*modifiers*/ undefined,
/*name*/ undefined,
/*typeParameters*/ undefined
);
node.staticToken = staticToken;
node.body = body;
node.transformFlags = TransformFlags.ContainsESNext;
return node;
}

// @api
function updateClassStaticBlockDeclaration(
node: ClassStaticBlockDeclaration,
staticToken: Token<SyntaxKind.StaticKeyword>,
body: Block
): ClassStaticBlockDeclaration {
return node.staticToken !== staticToken
|| node.body !== body
? update(createClassStaticBlockDeclaration(staticToken, body), node)
: node;
}

// @api
function createTemplateLiteralTypeSpan(type: TypeNode, literal: TemplateMiddle | TemplateTail) {
const node = createBaseNode<TemplateLiteralTypeSpan>(SyntaxKind.TemplateLiteralTypeSpan);
Expand Down
Loading