mirror of
https://gitee.com/openharmony/third_party_typescript
synced 2024-11-27 00:51:12 +00:00
!365 Implement rules for shared module in linter
Merge pull request !365 from huyunhui/linter
This commit is contained in:
commit
0f509d9ede
@ -192890,7 +192890,7 @@ var ts;
|
||||
(function (ArkTSLinter_1_1) {
|
||||
ArkTSLinter_1_1.cookBookMsg = [];
|
||||
ArkTSLinter_1_1.cookBookTag = [];
|
||||
for (var i = 0; i <= 162; i++) {
|
||||
for (var i = 0; i <= 164; i++) {
|
||||
ArkTSLinter_1_1.cookBookMsg[i] = "";
|
||||
}
|
||||
ArkTSLinter_1_1.cookBookTag[1] = "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)";
|
||||
@ -193055,6 +193055,8 @@ var ts;
|
||||
ArkTSLinter_1_1.cookBookTag[160] = 'Computed property names are not allowed in "Sendable" classes and interfaces (arkts-sendable-computed-prop-name)';
|
||||
ArkTSLinter_1_1.cookBookTag[161] = 'Casting "Non-sendable" data to "Sendable" type is not allowed (arkts-sendable-as-expr)';
|
||||
ArkTSLinter_1_1.cookBookTag[162] = "Shared module do not allow side effect import (arkts-no-side-effects-imports)";
|
||||
ArkTSLinter_1_1.cookBookTag[163] = 'Exported object must have a Sendable data type in shared module (arkts-shared-module-exports)';
|
||||
ArkTSLinter_1_1.cookBookTag[164] = '"export * from \'xxx\'" is not supported in shared module (arkts-shared-module-no-star-export)';
|
||||
})(ArkTSLinter_1_1 = ts.ArkTSLinter_1_1 || (ts.ArkTSLinter_1_1 = {}));
|
||||
})(ts || (ts = {}));
|
||||
/*
|
||||
@ -193315,7 +193317,9 @@ var ts;
|
||||
FaultID[FaultID["SendableComputedPropName"] = 89] = "SendableComputedPropName";
|
||||
FaultID[FaultID["SendableAsExpr"] = 90] = "SendableAsExpr";
|
||||
FaultID[FaultID["SharedNoSideEffectImport"] = 91] = "SharedNoSideEffectImport";
|
||||
FaultID[FaultID["LAST_ID"] = 92] = "LAST_ID";
|
||||
FaultID[FaultID["SharedModuleExports"] = 92] = "SharedModuleExports";
|
||||
FaultID[FaultID["SharedModuleNoStarExport"] = 93] = "SharedModuleNoStarExport";
|
||||
FaultID[FaultID["LAST_ID"] = 94] = "LAST_ID";
|
||||
})(FaultID = Problems.FaultID || (Problems.FaultID = {}));
|
||||
var FaultAttributes = /** @class */ (function () {
|
||||
function FaultAttributes(cookBookRef, migratable, severity) {
|
||||
@ -193421,6 +193425,8 @@ var ts;
|
||||
Problems.faultsAttrs[FaultID.SendableComputedPropName] = new FaultAttributes(160);
|
||||
Problems.faultsAttrs[FaultID.SendableAsExpr] = new FaultAttributes(161);
|
||||
Problems.faultsAttrs[FaultID.SharedNoSideEffectImport] = new FaultAttributes(162);
|
||||
Problems.faultsAttrs[FaultID.SharedModuleExports] = new FaultAttributes(163);
|
||||
Problems.faultsAttrs[FaultID.SharedModuleNoStarExport] = new FaultAttributes(164);
|
||||
})(Problems = ArkTSLinter_1_1.Problems || (ArkTSLinter_1_1.Problems = {}));
|
||||
})(ArkTSLinter_1_1 = ts.ArkTSLinter_1_1 || (ts.ArkTSLinter_1_1 = {}));
|
||||
})(ts || (ts = {}));
|
||||
@ -195144,6 +195150,19 @@ var ts;
|
||||
return isSendableClassOrInterface(type);
|
||||
}
|
||||
Utils.isSendableType = isSendableType;
|
||||
function isShareableType(tsType) {
|
||||
var sym = tsType.getSymbol();
|
||||
if (isConstEnum(sym)) {
|
||||
return true;
|
||||
}
|
||||
if (tsType.isUnion()) {
|
||||
return tsType.types.every(function (elemType) {
|
||||
return isShareableType(elemType);
|
||||
});
|
||||
}
|
||||
return isSendableType(tsType);
|
||||
}
|
||||
Utils.isShareableType = isShareableType;
|
||||
function isSendableClassOrInterface(type) {
|
||||
var _a;
|
||||
var sym = type.getSymbol();
|
||||
@ -195252,6 +195271,23 @@ var ts;
|
||||
return false;
|
||||
}
|
||||
Utils.isSharedModule = isSharedModule;
|
||||
function getDeclarationNode(node) {
|
||||
var sym = trueSymbolAtLocation(node);
|
||||
return getDeclaration(sym);
|
||||
}
|
||||
function isFunctionLikeDeclaration(node) {
|
||||
return ts.isFunctionDeclaration(node) || ts.isMethodDeclaration(node) ||
|
||||
ts.isGetAccessorDeclaration(node) || ts.isSetAccessorDeclaration(node) || ts.isConstructorDeclaration(node) ||
|
||||
ts.isFunctionExpression(node) || ts.isArrowFunction(node);
|
||||
}
|
||||
function isShareableEntity(node) {
|
||||
var decl = getDeclarationNode(node);
|
||||
var typeNode = decl === null || decl === void 0 ? void 0 : decl.type;
|
||||
return (typeNode && !isFunctionLikeDeclaration(decl)) ?
|
||||
isSendableTypeNode(typeNode) :
|
||||
isShareableType(ArkTSLinter_1_1.TypeScriptLinter.tsTypeChecker.getTypeAtLocation(decl ? decl : node));
|
||||
}
|
||||
Utils.isShareableEntity = isShareableEntity;
|
||||
})(Utils = ArkTSLinter_1_1.Utils || (ArkTSLinter_1_1.Utils = {}));
|
||||
})(ArkTSLinter_1_1 = ts.ArkTSLinter_1_1 || (ts.ArkTSLinter_1_1 = {}));
|
||||
})(ts || (ts = {}));
|
||||
@ -195530,6 +195566,8 @@ var ts;
|
||||
LinterConfig.nodeDesc[FaultID.SendableComputedPropName] = 'Sendable computed property name';
|
||||
LinterConfig.nodeDesc[FaultID.SendableAsExpr] = 'Sendable as expr';
|
||||
LinterConfig.nodeDesc[FaultID.SharedNoSideEffectImport] = 'Shared no side effect import';
|
||||
LinterConfig.nodeDesc[FaultID.SharedModuleExports] = 'Shared module exports';
|
||||
LinterConfig.nodeDesc[FaultID.SharedModuleNoStarExport] = 'Share module no star export';
|
||||
};
|
||||
LinterConfig.nodeDesc = [];
|
||||
// The SyntaxKind enum defines additional elements at the end of the enum
|
||||
@ -195680,6 +195718,8 @@ var ts;
|
||||
[218 /* SyntaxKind.EtsComponentExpression */, this.handleEtsComponentExpression],
|
||||
[173 /* SyntaxKind.ClassStaticBlockDeclaration */, this.handleClassStaticBlockDeclaration],
|
||||
[179 /* ts.SyntaxKind.IndexSignature */, this.handleIndexSignature],
|
||||
[94 /* ts.SyntaxKind.ExportKeyword */, this.handleExportKeyword],
|
||||
[278 /* ts.SyntaxKind.ExportDeclaration */, this.handleExportDeclaration]
|
||||
]);
|
||||
this.validatedTypesSet = new ts.Set();
|
||||
TypeScriptLinter.tsTypeChecker = tsProgram.getLinterTypeChecker();
|
||||
@ -197108,6 +197148,12 @@ var ts;
|
||||
if (exportAssignment.isExportEquals) {
|
||||
this.incrementCounters(node, FaultID.ExportAssignment);
|
||||
}
|
||||
if (!TypeScriptLinter.inSharedModule(node)) {
|
||||
return;
|
||||
}
|
||||
if (ArkTSLinter_1_1.Utils.isShareableEntity(exportAssignment.expression)) {
|
||||
this.incrementCounters(exportAssignment.expression, FaultID.SharedModuleExports);
|
||||
}
|
||||
};
|
||||
TypeScriptLinter.prototype.handleCallExpression = function (node) {
|
||||
var tsCallExpr = node;
|
||||
@ -197622,6 +197668,55 @@ var ts;
|
||||
this.visitSourceFile(this.sourceFile);
|
||||
this.handleCommentDirectives(this.sourceFile);
|
||||
};
|
||||
TypeScriptLinter.prototype.handleExportKeyword = function (node) {
|
||||
var parentNode = node.parent;
|
||||
if (!TypeScriptLinter.inSharedModule(node) || ts.isModuleBlock(parentNode.parent)) {
|
||||
return;
|
||||
}
|
||||
switch (parentNode.kind) {
|
||||
case 266 /* ts.SyntaxKind.EnumDeclaration */:
|
||||
case 264 /* ts.SyntaxKind.InterfaceDeclaration */:
|
||||
case 262 /* ts.SyntaxKind.ClassDeclaration */:
|
||||
if (!ArkTSLinter_1_1.Utils.isShareableType(TypeScriptLinter.tsTypeChecker.getTypeAtLocation(parentNode))) {
|
||||
this.incrementCounters(parentNode, FaultID.SharedModuleExports);
|
||||
}
|
||||
return;
|
||||
case 242 /* ts.SyntaxKind.VariableStatement */:
|
||||
for (var _i = 0, _a = parentNode.declarationList.declarations; _i < _a.length; _i++) {
|
||||
var variableDeclaration = _a[_i];
|
||||
if (!ArkTSLinter_1_1.Utils.isShareableEntity(variableDeclaration.name)) {
|
||||
this.incrementCounters(variableDeclaration, FaultID.SharedModuleExports);
|
||||
}
|
||||
}
|
||||
return;
|
||||
case 265 /* ts.SyntaxKind.TypeAliasDeclaration */:
|
||||
return;
|
||||
default:
|
||||
this.incrementCounters(parentNode, FaultID.SharedModuleExports);
|
||||
}
|
||||
};
|
||||
TypeScriptLinter.prototype.handleExportDeclaration = function (node) {
|
||||
if (!TypeScriptLinter.inSharedModule(node) || ts.isModuleBlock(node.parent)) {
|
||||
return;
|
||||
}
|
||||
var exportDecl = node;
|
||||
if (exportDecl.exportClause === undefined) {
|
||||
this.incrementCounters(exportDecl, FaultID.SharedModuleNoStarExport);
|
||||
return;
|
||||
}
|
||||
if (ts.isNamespaceExport(exportDecl.exportClause)) {
|
||||
if (!ArkTSLinter_1_1.Utils.isShareableType(TypeScriptLinter.tsTypeChecker.getTypeAtLocation(exportDecl.exportClause.name))) {
|
||||
this.incrementCounters(exportDecl.exportClause.name, FaultID.SharedModuleExports);
|
||||
}
|
||||
return;
|
||||
}
|
||||
for (var _i = 0, _a = exportDecl.exportClause.elements; _i < _a.length; _i++) {
|
||||
var exportSpecifier = _a[_i];
|
||||
if (!ArkTSLinter_1_1.Utils.isShareableEntity(exportSpecifier.name)) {
|
||||
this.incrementCounters(exportSpecifier.name, FaultID.SharedModuleExports);
|
||||
}
|
||||
}
|
||||
};
|
||||
TypeScriptLinter.reportDiagnostics = true;
|
||||
// The SyntaxKind enum defines additional elements at the end of the enum
|
||||
// that serve as markers (FirstX/LastX). Those elements are initialized
|
||||
|
8
lib/tsserverlibrary.d.ts
vendored
8
lib/tsserverlibrary.d.ts
vendored
@ -13144,7 +13144,9 @@ declare namespace ts {
|
||||
SendableComputedPropName = 89,
|
||||
SendableAsExpr = 90,
|
||||
SharedNoSideEffectImport = 91,
|
||||
LAST_ID = 92
|
||||
SharedModuleExports = 92,
|
||||
SharedModuleNoStarExport = 93,
|
||||
LAST_ID = 94
|
||||
}
|
||||
class FaultAttributes {
|
||||
cookBookRef: number;
|
||||
@ -13332,6 +13334,7 @@ declare namespace ts {
|
||||
function unwrapParenthesizedTypeNode(typeNode: ts.TypeNode): ts.TypeNode;
|
||||
function isSendableTypeNode(typeNode: ts.TypeNode): boolean;
|
||||
function isSendableType(type: ts.Type): boolean;
|
||||
function isShareableType(tsType: ts.Type): boolean;
|
||||
function isSendableClassOrInterface(type: ts.Type): boolean;
|
||||
function typeContainsSendableClassOrInterface(type: ts.Type): boolean;
|
||||
function isConstEnum(sym: ts.Symbol | undefined): boolean;
|
||||
@ -13341,6 +13344,7 @@ declare namespace ts {
|
||||
function getDecoratorsIfInSendableClass(declaration: ts.HasDecorators): readonly ts.Decorator[] | undefined;
|
||||
function isISendableInterface(type: ts.Type): boolean;
|
||||
function isSharedModule(sourceFile: ts.SourceFile): boolean;
|
||||
function isShareableEntity(node: ts.Node): boolean;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -13532,6 +13536,8 @@ declare namespace ts {
|
||||
private handleClassStaticBlockDeclaration;
|
||||
private handleIndexSignature;
|
||||
lint(): void;
|
||||
private handleExportKeyword;
|
||||
private handleExportDeclaration;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -192635,7 +192635,7 @@ var ts;
|
||||
(function (ArkTSLinter_1_1) {
|
||||
ArkTSLinter_1_1.cookBookMsg = [];
|
||||
ArkTSLinter_1_1.cookBookTag = [];
|
||||
for (var i = 0; i <= 162; i++) {
|
||||
for (var i = 0; i <= 164; i++) {
|
||||
ArkTSLinter_1_1.cookBookMsg[i] = "";
|
||||
}
|
||||
ArkTSLinter_1_1.cookBookTag[1] = "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)";
|
||||
@ -192800,6 +192800,8 @@ var ts;
|
||||
ArkTSLinter_1_1.cookBookTag[160] = 'Computed property names are not allowed in "Sendable" classes and interfaces (arkts-sendable-computed-prop-name)';
|
||||
ArkTSLinter_1_1.cookBookTag[161] = 'Casting "Non-sendable" data to "Sendable" type is not allowed (arkts-sendable-as-expr)';
|
||||
ArkTSLinter_1_1.cookBookTag[162] = "Shared module do not allow side effect import (arkts-no-side-effects-imports)";
|
||||
ArkTSLinter_1_1.cookBookTag[163] = 'Exported object must have a Sendable data type in shared module (arkts-shared-module-exports)';
|
||||
ArkTSLinter_1_1.cookBookTag[164] = '"export * from \'xxx\'" is not supported in shared module (arkts-shared-module-no-star-export)';
|
||||
})(ArkTSLinter_1_1 = ts.ArkTSLinter_1_1 || (ts.ArkTSLinter_1_1 = {}));
|
||||
})(ts || (ts = {}));
|
||||
/*
|
||||
@ -193060,7 +193062,9 @@ var ts;
|
||||
FaultID[FaultID["SendableComputedPropName"] = 89] = "SendableComputedPropName";
|
||||
FaultID[FaultID["SendableAsExpr"] = 90] = "SendableAsExpr";
|
||||
FaultID[FaultID["SharedNoSideEffectImport"] = 91] = "SharedNoSideEffectImport";
|
||||
FaultID[FaultID["LAST_ID"] = 92] = "LAST_ID";
|
||||
FaultID[FaultID["SharedModuleExports"] = 92] = "SharedModuleExports";
|
||||
FaultID[FaultID["SharedModuleNoStarExport"] = 93] = "SharedModuleNoStarExport";
|
||||
FaultID[FaultID["LAST_ID"] = 94] = "LAST_ID";
|
||||
})(FaultID = Problems.FaultID || (Problems.FaultID = {}));
|
||||
var FaultAttributes = /** @class */ (function () {
|
||||
function FaultAttributes(cookBookRef, migratable, severity) {
|
||||
@ -193166,6 +193170,8 @@ var ts;
|
||||
Problems.faultsAttrs[FaultID.SendableComputedPropName] = new FaultAttributes(160);
|
||||
Problems.faultsAttrs[FaultID.SendableAsExpr] = new FaultAttributes(161);
|
||||
Problems.faultsAttrs[FaultID.SharedNoSideEffectImport] = new FaultAttributes(162);
|
||||
Problems.faultsAttrs[FaultID.SharedModuleExports] = new FaultAttributes(163);
|
||||
Problems.faultsAttrs[FaultID.SharedModuleNoStarExport] = new FaultAttributes(164);
|
||||
})(Problems = ArkTSLinter_1_1.Problems || (ArkTSLinter_1_1.Problems = {}));
|
||||
})(ArkTSLinter_1_1 = ts.ArkTSLinter_1_1 || (ts.ArkTSLinter_1_1 = {}));
|
||||
})(ts || (ts = {}));
|
||||
@ -194889,6 +194895,19 @@ var ts;
|
||||
return isSendableClassOrInterface(type);
|
||||
}
|
||||
Utils.isSendableType = isSendableType;
|
||||
function isShareableType(tsType) {
|
||||
var sym = tsType.getSymbol();
|
||||
if (isConstEnum(sym)) {
|
||||
return true;
|
||||
}
|
||||
if (tsType.isUnion()) {
|
||||
return tsType.types.every(function (elemType) {
|
||||
return isShareableType(elemType);
|
||||
});
|
||||
}
|
||||
return isSendableType(tsType);
|
||||
}
|
||||
Utils.isShareableType = isShareableType;
|
||||
function isSendableClassOrInterface(type) {
|
||||
var _a;
|
||||
var sym = type.getSymbol();
|
||||
@ -194997,6 +195016,23 @@ var ts;
|
||||
return false;
|
||||
}
|
||||
Utils.isSharedModule = isSharedModule;
|
||||
function getDeclarationNode(node) {
|
||||
var sym = trueSymbolAtLocation(node);
|
||||
return getDeclaration(sym);
|
||||
}
|
||||
function isFunctionLikeDeclaration(node) {
|
||||
return ts.isFunctionDeclaration(node) || ts.isMethodDeclaration(node) ||
|
||||
ts.isGetAccessorDeclaration(node) || ts.isSetAccessorDeclaration(node) || ts.isConstructorDeclaration(node) ||
|
||||
ts.isFunctionExpression(node) || ts.isArrowFunction(node);
|
||||
}
|
||||
function isShareableEntity(node) {
|
||||
var decl = getDeclarationNode(node);
|
||||
var typeNode = decl === null || decl === void 0 ? void 0 : decl.type;
|
||||
return (typeNode && !isFunctionLikeDeclaration(decl)) ?
|
||||
isSendableTypeNode(typeNode) :
|
||||
isShareableType(ArkTSLinter_1_1.TypeScriptLinter.tsTypeChecker.getTypeAtLocation(decl ? decl : node));
|
||||
}
|
||||
Utils.isShareableEntity = isShareableEntity;
|
||||
})(Utils = ArkTSLinter_1_1.Utils || (ArkTSLinter_1_1.Utils = {}));
|
||||
})(ArkTSLinter_1_1 = ts.ArkTSLinter_1_1 || (ts.ArkTSLinter_1_1 = {}));
|
||||
})(ts || (ts = {}));
|
||||
@ -195275,6 +195311,8 @@ var ts;
|
||||
LinterConfig.nodeDesc[FaultID.SendableComputedPropName] = 'Sendable computed property name';
|
||||
LinterConfig.nodeDesc[FaultID.SendableAsExpr] = 'Sendable as expr';
|
||||
LinterConfig.nodeDesc[FaultID.SharedNoSideEffectImport] = 'Shared no side effect import';
|
||||
LinterConfig.nodeDesc[FaultID.SharedModuleExports] = 'Shared module exports';
|
||||
LinterConfig.nodeDesc[FaultID.SharedModuleNoStarExport] = 'Share module no star export';
|
||||
};
|
||||
LinterConfig.nodeDesc = [];
|
||||
// The SyntaxKind enum defines additional elements at the end of the enum
|
||||
@ -195425,6 +195463,8 @@ var ts;
|
||||
[218 /* SyntaxKind.EtsComponentExpression */, this.handleEtsComponentExpression],
|
||||
[173 /* SyntaxKind.ClassStaticBlockDeclaration */, this.handleClassStaticBlockDeclaration],
|
||||
[179 /* ts.SyntaxKind.IndexSignature */, this.handleIndexSignature],
|
||||
[94 /* ts.SyntaxKind.ExportKeyword */, this.handleExportKeyword],
|
||||
[278 /* ts.SyntaxKind.ExportDeclaration */, this.handleExportDeclaration]
|
||||
]);
|
||||
this.validatedTypesSet = new ts.Set();
|
||||
TypeScriptLinter.tsTypeChecker = tsProgram.getLinterTypeChecker();
|
||||
@ -196853,6 +196893,12 @@ var ts;
|
||||
if (exportAssignment.isExportEquals) {
|
||||
this.incrementCounters(node, FaultID.ExportAssignment);
|
||||
}
|
||||
if (!TypeScriptLinter.inSharedModule(node)) {
|
||||
return;
|
||||
}
|
||||
if (ArkTSLinter_1_1.Utils.isShareableEntity(exportAssignment.expression)) {
|
||||
this.incrementCounters(exportAssignment.expression, FaultID.SharedModuleExports);
|
||||
}
|
||||
};
|
||||
TypeScriptLinter.prototype.handleCallExpression = function (node) {
|
||||
var tsCallExpr = node;
|
||||
@ -197367,6 +197413,55 @@ var ts;
|
||||
this.visitSourceFile(this.sourceFile);
|
||||
this.handleCommentDirectives(this.sourceFile);
|
||||
};
|
||||
TypeScriptLinter.prototype.handleExportKeyword = function (node) {
|
||||
var parentNode = node.parent;
|
||||
if (!TypeScriptLinter.inSharedModule(node) || ts.isModuleBlock(parentNode.parent)) {
|
||||
return;
|
||||
}
|
||||
switch (parentNode.kind) {
|
||||
case 266 /* ts.SyntaxKind.EnumDeclaration */:
|
||||
case 264 /* ts.SyntaxKind.InterfaceDeclaration */:
|
||||
case 262 /* ts.SyntaxKind.ClassDeclaration */:
|
||||
if (!ArkTSLinter_1_1.Utils.isShareableType(TypeScriptLinter.tsTypeChecker.getTypeAtLocation(parentNode))) {
|
||||
this.incrementCounters(parentNode, FaultID.SharedModuleExports);
|
||||
}
|
||||
return;
|
||||
case 242 /* ts.SyntaxKind.VariableStatement */:
|
||||
for (var _i = 0, _a = parentNode.declarationList.declarations; _i < _a.length; _i++) {
|
||||
var variableDeclaration = _a[_i];
|
||||
if (!ArkTSLinter_1_1.Utils.isShareableEntity(variableDeclaration.name)) {
|
||||
this.incrementCounters(variableDeclaration, FaultID.SharedModuleExports);
|
||||
}
|
||||
}
|
||||
return;
|
||||
case 265 /* ts.SyntaxKind.TypeAliasDeclaration */:
|
||||
return;
|
||||
default:
|
||||
this.incrementCounters(parentNode, FaultID.SharedModuleExports);
|
||||
}
|
||||
};
|
||||
TypeScriptLinter.prototype.handleExportDeclaration = function (node) {
|
||||
if (!TypeScriptLinter.inSharedModule(node) || ts.isModuleBlock(node.parent)) {
|
||||
return;
|
||||
}
|
||||
var exportDecl = node;
|
||||
if (exportDecl.exportClause === undefined) {
|
||||
this.incrementCounters(exportDecl, FaultID.SharedModuleNoStarExport);
|
||||
return;
|
||||
}
|
||||
if (ts.isNamespaceExport(exportDecl.exportClause)) {
|
||||
if (!ArkTSLinter_1_1.Utils.isShareableType(TypeScriptLinter.tsTypeChecker.getTypeAtLocation(exportDecl.exportClause.name))) {
|
||||
this.incrementCounters(exportDecl.exportClause.name, FaultID.SharedModuleExports);
|
||||
}
|
||||
return;
|
||||
}
|
||||
for (var _i = 0, _a = exportDecl.exportClause.elements; _i < _a.length; _i++) {
|
||||
var exportSpecifier = _a[_i];
|
||||
if (!ArkTSLinter_1_1.Utils.isShareableEntity(exportSpecifier.name)) {
|
||||
this.incrementCounters(exportSpecifier.name, FaultID.SharedModuleExports);
|
||||
}
|
||||
}
|
||||
};
|
||||
TypeScriptLinter.reportDiagnostics = true;
|
||||
// The SyntaxKind enum defines additional elements at the end of the enum
|
||||
// that serve as markers (FirstX/LastX). Those elements are initialized
|
||||
|
8
lib/typescript.d.ts
vendored
8
lib/typescript.d.ts
vendored
@ -9205,7 +9205,9 @@ declare namespace ts {
|
||||
SendableComputedPropName = 89,
|
||||
SendableAsExpr = 90,
|
||||
SharedNoSideEffectImport = 91,
|
||||
LAST_ID = 92
|
||||
SharedModuleExports = 92,
|
||||
SharedModuleNoStarExport = 93,
|
||||
LAST_ID = 94
|
||||
}
|
||||
class FaultAttributes {
|
||||
cookBookRef: number;
|
||||
@ -9393,6 +9395,7 @@ declare namespace ts {
|
||||
function unwrapParenthesizedTypeNode(typeNode: ts.TypeNode): ts.TypeNode;
|
||||
function isSendableTypeNode(typeNode: ts.TypeNode): boolean;
|
||||
function isSendableType(type: ts.Type): boolean;
|
||||
function isShareableType(tsType: ts.Type): boolean;
|
||||
function isSendableClassOrInterface(type: ts.Type): boolean;
|
||||
function typeContainsSendableClassOrInterface(type: ts.Type): boolean;
|
||||
function isConstEnum(sym: ts.Symbol | undefined): boolean;
|
||||
@ -9402,6 +9405,7 @@ declare namespace ts {
|
||||
function getDecoratorsIfInSendableClass(declaration: ts.HasDecorators): readonly ts.Decorator[] | undefined;
|
||||
function isISendableInterface(type: ts.Type): boolean;
|
||||
function isSharedModule(sourceFile: ts.SourceFile): boolean;
|
||||
function isShareableEntity(node: ts.Node): boolean;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -9593,6 +9597,8 @@ declare namespace ts {
|
||||
private handleClassStaticBlockDeclaration;
|
||||
private handleIndexSignature;
|
||||
lint(): void;
|
||||
private handleExportKeyword;
|
||||
private handleExportDeclaration;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -181729,7 +181729,7 @@ var ts;
|
||||
(function (ArkTSLinter_1_1) {
|
||||
ArkTSLinter_1_1.cookBookMsg = [];
|
||||
ArkTSLinter_1_1.cookBookTag = [];
|
||||
for (var i = 0; i <= 162; i++) {
|
||||
for (var i = 0; i <= 164; i++) {
|
||||
ArkTSLinter_1_1.cookBookMsg[i] = "";
|
||||
}
|
||||
ArkTSLinter_1_1.cookBookTag[1] = "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)";
|
||||
@ -181894,6 +181894,8 @@ var ts;
|
||||
ArkTSLinter_1_1.cookBookTag[160] = 'Computed property names are not allowed in "Sendable" classes and interfaces (arkts-sendable-computed-prop-name)';
|
||||
ArkTSLinter_1_1.cookBookTag[161] = 'Casting "Non-sendable" data to "Sendable" type is not allowed (arkts-sendable-as-expr)';
|
||||
ArkTSLinter_1_1.cookBookTag[162] = "Shared module do not allow side effect import (arkts-no-side-effects-imports)";
|
||||
ArkTSLinter_1_1.cookBookTag[163] = 'Exported object must have a Sendable data type in shared module (arkts-shared-module-exports)';
|
||||
ArkTSLinter_1_1.cookBookTag[164] = '"export * from \'xxx\'" is not supported in shared module (arkts-shared-module-no-star-export)';
|
||||
})(ArkTSLinter_1_1 = ts.ArkTSLinter_1_1 || (ts.ArkTSLinter_1_1 = {}));
|
||||
})(ts || (ts = {}));
|
||||
/*
|
||||
@ -182154,7 +182156,9 @@ var ts;
|
||||
FaultID[FaultID["SendableComputedPropName"] = 89] = "SendableComputedPropName";
|
||||
FaultID[FaultID["SendableAsExpr"] = 90] = "SendableAsExpr";
|
||||
FaultID[FaultID["SharedNoSideEffectImport"] = 91] = "SharedNoSideEffectImport";
|
||||
FaultID[FaultID["LAST_ID"] = 92] = "LAST_ID";
|
||||
FaultID[FaultID["SharedModuleExports"] = 92] = "SharedModuleExports";
|
||||
FaultID[FaultID["SharedModuleNoStarExport"] = 93] = "SharedModuleNoStarExport";
|
||||
FaultID[FaultID["LAST_ID"] = 94] = "LAST_ID";
|
||||
})(FaultID = Problems.FaultID || (Problems.FaultID = {}));
|
||||
var FaultAttributes = /** @class */ (function () {
|
||||
function FaultAttributes(cookBookRef, migratable, severity) {
|
||||
@ -182260,6 +182264,8 @@ var ts;
|
||||
Problems.faultsAttrs[FaultID.SendableComputedPropName] = new FaultAttributes(160);
|
||||
Problems.faultsAttrs[FaultID.SendableAsExpr] = new FaultAttributes(161);
|
||||
Problems.faultsAttrs[FaultID.SharedNoSideEffectImport] = new FaultAttributes(162);
|
||||
Problems.faultsAttrs[FaultID.SharedModuleExports] = new FaultAttributes(163);
|
||||
Problems.faultsAttrs[FaultID.SharedModuleNoStarExport] = new FaultAttributes(164);
|
||||
})(Problems = ArkTSLinter_1_1.Problems || (ArkTSLinter_1_1.Problems = {}));
|
||||
})(ArkTSLinter_1_1 = ts.ArkTSLinter_1_1 || (ts.ArkTSLinter_1_1 = {}));
|
||||
})(ts || (ts = {}));
|
||||
@ -183983,6 +183989,19 @@ var ts;
|
||||
return isSendableClassOrInterface(type);
|
||||
}
|
||||
Utils.isSendableType = isSendableType;
|
||||
function isShareableType(tsType) {
|
||||
var sym = tsType.getSymbol();
|
||||
if (isConstEnum(sym)) {
|
||||
return true;
|
||||
}
|
||||
if (tsType.isUnion()) {
|
||||
return tsType.types.every(function (elemType) {
|
||||
return isShareableType(elemType);
|
||||
});
|
||||
}
|
||||
return isSendableType(tsType);
|
||||
}
|
||||
Utils.isShareableType = isShareableType;
|
||||
function isSendableClassOrInterface(type) {
|
||||
var _a;
|
||||
var sym = type.getSymbol();
|
||||
@ -184091,6 +184110,23 @@ var ts;
|
||||
return false;
|
||||
}
|
||||
Utils.isSharedModule = isSharedModule;
|
||||
function getDeclarationNode(node) {
|
||||
var sym = trueSymbolAtLocation(node);
|
||||
return getDeclaration(sym);
|
||||
}
|
||||
function isFunctionLikeDeclaration(node) {
|
||||
return ts.isFunctionDeclaration(node) || ts.isMethodDeclaration(node) ||
|
||||
ts.isGetAccessorDeclaration(node) || ts.isSetAccessorDeclaration(node) || ts.isConstructorDeclaration(node) ||
|
||||
ts.isFunctionExpression(node) || ts.isArrowFunction(node);
|
||||
}
|
||||
function isShareableEntity(node) {
|
||||
var decl = getDeclarationNode(node);
|
||||
var typeNode = decl === null || decl === void 0 ? void 0 : decl.type;
|
||||
return (typeNode && !isFunctionLikeDeclaration(decl)) ?
|
||||
isSendableTypeNode(typeNode) :
|
||||
isShareableType(ArkTSLinter_1_1.TypeScriptLinter.tsTypeChecker.getTypeAtLocation(decl ? decl : node));
|
||||
}
|
||||
Utils.isShareableEntity = isShareableEntity;
|
||||
})(Utils = ArkTSLinter_1_1.Utils || (ArkTSLinter_1_1.Utils = {}));
|
||||
})(ArkTSLinter_1_1 = ts.ArkTSLinter_1_1 || (ts.ArkTSLinter_1_1 = {}));
|
||||
})(ts || (ts = {}));
|
||||
@ -184369,6 +184405,8 @@ var ts;
|
||||
LinterConfig.nodeDesc[FaultID.SendableComputedPropName] = 'Sendable computed property name';
|
||||
LinterConfig.nodeDesc[FaultID.SendableAsExpr] = 'Sendable as expr';
|
||||
LinterConfig.nodeDesc[FaultID.SharedNoSideEffectImport] = 'Shared no side effect import';
|
||||
LinterConfig.nodeDesc[FaultID.SharedModuleExports] = 'Shared module exports';
|
||||
LinterConfig.nodeDesc[FaultID.SharedModuleNoStarExport] = 'Share module no star export';
|
||||
};
|
||||
LinterConfig.nodeDesc = [];
|
||||
// The SyntaxKind enum defines additional elements at the end of the enum
|
||||
@ -184519,6 +184557,8 @@ var ts;
|
||||
[218 /* SyntaxKind.EtsComponentExpression */, this.handleEtsComponentExpression],
|
||||
[173 /* SyntaxKind.ClassStaticBlockDeclaration */, this.handleClassStaticBlockDeclaration],
|
||||
[179 /* ts.SyntaxKind.IndexSignature */, this.handleIndexSignature],
|
||||
[94 /* ts.SyntaxKind.ExportKeyword */, this.handleExportKeyword],
|
||||
[278 /* ts.SyntaxKind.ExportDeclaration */, this.handleExportDeclaration]
|
||||
]);
|
||||
this.validatedTypesSet = new ts.Set();
|
||||
TypeScriptLinter.tsTypeChecker = tsProgram.getLinterTypeChecker();
|
||||
@ -185947,6 +185987,12 @@ var ts;
|
||||
if (exportAssignment.isExportEquals) {
|
||||
this.incrementCounters(node, FaultID.ExportAssignment);
|
||||
}
|
||||
if (!TypeScriptLinter.inSharedModule(node)) {
|
||||
return;
|
||||
}
|
||||
if (ArkTSLinter_1_1.Utils.isShareableEntity(exportAssignment.expression)) {
|
||||
this.incrementCounters(exportAssignment.expression, FaultID.SharedModuleExports);
|
||||
}
|
||||
};
|
||||
TypeScriptLinter.prototype.handleCallExpression = function (node) {
|
||||
var tsCallExpr = node;
|
||||
@ -186461,6 +186507,55 @@ var ts;
|
||||
this.visitSourceFile(this.sourceFile);
|
||||
this.handleCommentDirectives(this.sourceFile);
|
||||
};
|
||||
TypeScriptLinter.prototype.handleExportKeyword = function (node) {
|
||||
var parentNode = node.parent;
|
||||
if (!TypeScriptLinter.inSharedModule(node) || ts.isModuleBlock(parentNode.parent)) {
|
||||
return;
|
||||
}
|
||||
switch (parentNode.kind) {
|
||||
case 266 /* ts.SyntaxKind.EnumDeclaration */:
|
||||
case 264 /* ts.SyntaxKind.InterfaceDeclaration */:
|
||||
case 262 /* ts.SyntaxKind.ClassDeclaration */:
|
||||
if (!ArkTSLinter_1_1.Utils.isShareableType(TypeScriptLinter.tsTypeChecker.getTypeAtLocation(parentNode))) {
|
||||
this.incrementCounters(parentNode, FaultID.SharedModuleExports);
|
||||
}
|
||||
return;
|
||||
case 242 /* ts.SyntaxKind.VariableStatement */:
|
||||
for (var _i = 0, _a = parentNode.declarationList.declarations; _i < _a.length; _i++) {
|
||||
var variableDeclaration = _a[_i];
|
||||
if (!ArkTSLinter_1_1.Utils.isShareableEntity(variableDeclaration.name)) {
|
||||
this.incrementCounters(variableDeclaration, FaultID.SharedModuleExports);
|
||||
}
|
||||
}
|
||||
return;
|
||||
case 265 /* ts.SyntaxKind.TypeAliasDeclaration */:
|
||||
return;
|
||||
default:
|
||||
this.incrementCounters(parentNode, FaultID.SharedModuleExports);
|
||||
}
|
||||
};
|
||||
TypeScriptLinter.prototype.handleExportDeclaration = function (node) {
|
||||
if (!TypeScriptLinter.inSharedModule(node) || ts.isModuleBlock(node.parent)) {
|
||||
return;
|
||||
}
|
||||
var exportDecl = node;
|
||||
if (exportDecl.exportClause === undefined) {
|
||||
this.incrementCounters(exportDecl, FaultID.SharedModuleNoStarExport);
|
||||
return;
|
||||
}
|
||||
if (ts.isNamespaceExport(exportDecl.exportClause)) {
|
||||
if (!ArkTSLinter_1_1.Utils.isShareableType(TypeScriptLinter.tsTypeChecker.getTypeAtLocation(exportDecl.exportClause.name))) {
|
||||
this.incrementCounters(exportDecl.exportClause.name, FaultID.SharedModuleExports);
|
||||
}
|
||||
return;
|
||||
}
|
||||
for (var _i = 0, _a = exportDecl.exportClause.elements; _i < _a.length; _i++) {
|
||||
var exportSpecifier = _a[_i];
|
||||
if (!ArkTSLinter_1_1.Utils.isShareableEntity(exportSpecifier.name)) {
|
||||
this.incrementCounters(exportSpecifier.name, FaultID.SharedModuleExports);
|
||||
}
|
||||
}
|
||||
};
|
||||
TypeScriptLinter.reportDiagnostics = true;
|
||||
// The SyntaxKind enum defines additional elements at the end of the enum
|
||||
// that serve as markers (FirstX/LastX). Those elements are initialized
|
||||
|
8
lib/typescriptServices.d.ts
vendored
8
lib/typescriptServices.d.ts
vendored
@ -9205,7 +9205,9 @@ declare namespace ts {
|
||||
SendableComputedPropName = 89,
|
||||
SendableAsExpr = 90,
|
||||
SharedNoSideEffectImport = 91,
|
||||
LAST_ID = 92
|
||||
SharedModuleExports = 92,
|
||||
SharedModuleNoStarExport = 93,
|
||||
LAST_ID = 94
|
||||
}
|
||||
class FaultAttributes {
|
||||
cookBookRef: number;
|
||||
@ -9393,6 +9395,7 @@ declare namespace ts {
|
||||
function unwrapParenthesizedTypeNode(typeNode: ts.TypeNode): ts.TypeNode;
|
||||
function isSendableTypeNode(typeNode: ts.TypeNode): boolean;
|
||||
function isSendableType(type: ts.Type): boolean;
|
||||
function isShareableType(tsType: ts.Type): boolean;
|
||||
function isSendableClassOrInterface(type: ts.Type): boolean;
|
||||
function typeContainsSendableClassOrInterface(type: ts.Type): boolean;
|
||||
function isConstEnum(sym: ts.Symbol | undefined): boolean;
|
||||
@ -9402,6 +9405,7 @@ declare namespace ts {
|
||||
function getDecoratorsIfInSendableClass(declaration: ts.HasDecorators): readonly ts.Decorator[] | undefined;
|
||||
function isISendableInterface(type: ts.Type): boolean;
|
||||
function isSharedModule(sourceFile: ts.SourceFile): boolean;
|
||||
function isShareableEntity(node: ts.Node): boolean;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -9593,6 +9597,8 @@ declare namespace ts {
|
||||
private handleClassStaticBlockDeclaration;
|
||||
private handleIndexSignature;
|
||||
lint(): void;
|
||||
private handleExportKeyword;
|
||||
private handleExportDeclaration;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -181729,7 +181729,7 @@ var ts;
|
||||
(function (ArkTSLinter_1_1) {
|
||||
ArkTSLinter_1_1.cookBookMsg = [];
|
||||
ArkTSLinter_1_1.cookBookTag = [];
|
||||
for (var i = 0; i <= 162; i++) {
|
||||
for (var i = 0; i <= 164; i++) {
|
||||
ArkTSLinter_1_1.cookBookMsg[i] = "";
|
||||
}
|
||||
ArkTSLinter_1_1.cookBookTag[1] = "Objects with property names that are not identifiers are not supported (arkts-identifiers-as-prop-names)";
|
||||
@ -181894,6 +181894,8 @@ var ts;
|
||||
ArkTSLinter_1_1.cookBookTag[160] = 'Computed property names are not allowed in "Sendable" classes and interfaces (arkts-sendable-computed-prop-name)';
|
||||
ArkTSLinter_1_1.cookBookTag[161] = 'Casting "Non-sendable" data to "Sendable" type is not allowed (arkts-sendable-as-expr)';
|
||||
ArkTSLinter_1_1.cookBookTag[162] = "Shared module do not allow side effect import (arkts-no-side-effects-imports)";
|
||||
ArkTSLinter_1_1.cookBookTag[163] = 'Exported object must have a Sendable data type in shared module (arkts-shared-module-exports)';
|
||||
ArkTSLinter_1_1.cookBookTag[164] = '"export * from \'xxx\'" is not supported in shared module (arkts-shared-module-no-star-export)';
|
||||
})(ArkTSLinter_1_1 = ts.ArkTSLinter_1_1 || (ts.ArkTSLinter_1_1 = {}));
|
||||
})(ts || (ts = {}));
|
||||
/*
|
||||
@ -182154,7 +182156,9 @@ var ts;
|
||||
FaultID[FaultID["SendableComputedPropName"] = 89] = "SendableComputedPropName";
|
||||
FaultID[FaultID["SendableAsExpr"] = 90] = "SendableAsExpr";
|
||||
FaultID[FaultID["SharedNoSideEffectImport"] = 91] = "SharedNoSideEffectImport";
|
||||
FaultID[FaultID["LAST_ID"] = 92] = "LAST_ID";
|
||||
FaultID[FaultID["SharedModuleExports"] = 92] = "SharedModuleExports";
|
||||
FaultID[FaultID["SharedModuleNoStarExport"] = 93] = "SharedModuleNoStarExport";
|
||||
FaultID[FaultID["LAST_ID"] = 94] = "LAST_ID";
|
||||
})(FaultID = Problems.FaultID || (Problems.FaultID = {}));
|
||||
var FaultAttributes = /** @class */ (function () {
|
||||
function FaultAttributes(cookBookRef, migratable, severity) {
|
||||
@ -182260,6 +182264,8 @@ var ts;
|
||||
Problems.faultsAttrs[FaultID.SendableComputedPropName] = new FaultAttributes(160);
|
||||
Problems.faultsAttrs[FaultID.SendableAsExpr] = new FaultAttributes(161);
|
||||
Problems.faultsAttrs[FaultID.SharedNoSideEffectImport] = new FaultAttributes(162);
|
||||
Problems.faultsAttrs[FaultID.SharedModuleExports] = new FaultAttributes(163);
|
||||
Problems.faultsAttrs[FaultID.SharedModuleNoStarExport] = new FaultAttributes(164);
|
||||
})(Problems = ArkTSLinter_1_1.Problems || (ArkTSLinter_1_1.Problems = {}));
|
||||
})(ArkTSLinter_1_1 = ts.ArkTSLinter_1_1 || (ts.ArkTSLinter_1_1 = {}));
|
||||
})(ts || (ts = {}));
|
||||
@ -183983,6 +183989,19 @@ var ts;
|
||||
return isSendableClassOrInterface(type);
|
||||
}
|
||||
Utils.isSendableType = isSendableType;
|
||||
function isShareableType(tsType) {
|
||||
var sym = tsType.getSymbol();
|
||||
if (isConstEnum(sym)) {
|
||||
return true;
|
||||
}
|
||||
if (tsType.isUnion()) {
|
||||
return tsType.types.every(function (elemType) {
|
||||
return isShareableType(elemType);
|
||||
});
|
||||
}
|
||||
return isSendableType(tsType);
|
||||
}
|
||||
Utils.isShareableType = isShareableType;
|
||||
function isSendableClassOrInterface(type) {
|
||||
var _a;
|
||||
var sym = type.getSymbol();
|
||||
@ -184091,6 +184110,23 @@ var ts;
|
||||
return false;
|
||||
}
|
||||
Utils.isSharedModule = isSharedModule;
|
||||
function getDeclarationNode(node) {
|
||||
var sym = trueSymbolAtLocation(node);
|
||||
return getDeclaration(sym);
|
||||
}
|
||||
function isFunctionLikeDeclaration(node) {
|
||||
return ts.isFunctionDeclaration(node) || ts.isMethodDeclaration(node) ||
|
||||
ts.isGetAccessorDeclaration(node) || ts.isSetAccessorDeclaration(node) || ts.isConstructorDeclaration(node) ||
|
||||
ts.isFunctionExpression(node) || ts.isArrowFunction(node);
|
||||
}
|
||||
function isShareableEntity(node) {
|
||||
var decl = getDeclarationNode(node);
|
||||
var typeNode = decl === null || decl === void 0 ? void 0 : decl.type;
|
||||
return (typeNode && !isFunctionLikeDeclaration(decl)) ?
|
||||
isSendableTypeNode(typeNode) :
|
||||
isShareableType(ArkTSLinter_1_1.TypeScriptLinter.tsTypeChecker.getTypeAtLocation(decl ? decl : node));
|
||||
}
|
||||
Utils.isShareableEntity = isShareableEntity;
|
||||
})(Utils = ArkTSLinter_1_1.Utils || (ArkTSLinter_1_1.Utils = {}));
|
||||
})(ArkTSLinter_1_1 = ts.ArkTSLinter_1_1 || (ts.ArkTSLinter_1_1 = {}));
|
||||
})(ts || (ts = {}));
|
||||
@ -184369,6 +184405,8 @@ var ts;
|
||||
LinterConfig.nodeDesc[FaultID.SendableComputedPropName] = 'Sendable computed property name';
|
||||
LinterConfig.nodeDesc[FaultID.SendableAsExpr] = 'Sendable as expr';
|
||||
LinterConfig.nodeDesc[FaultID.SharedNoSideEffectImport] = 'Shared no side effect import';
|
||||
LinterConfig.nodeDesc[FaultID.SharedModuleExports] = 'Shared module exports';
|
||||
LinterConfig.nodeDesc[FaultID.SharedModuleNoStarExport] = 'Share module no star export';
|
||||
};
|
||||
LinterConfig.nodeDesc = [];
|
||||
// The SyntaxKind enum defines additional elements at the end of the enum
|
||||
@ -184519,6 +184557,8 @@ var ts;
|
||||
[218 /* SyntaxKind.EtsComponentExpression */, this.handleEtsComponentExpression],
|
||||
[173 /* SyntaxKind.ClassStaticBlockDeclaration */, this.handleClassStaticBlockDeclaration],
|
||||
[179 /* ts.SyntaxKind.IndexSignature */, this.handleIndexSignature],
|
||||
[94 /* ts.SyntaxKind.ExportKeyword */, this.handleExportKeyword],
|
||||
[278 /* ts.SyntaxKind.ExportDeclaration */, this.handleExportDeclaration]
|
||||
]);
|
||||
this.validatedTypesSet = new ts.Set();
|
||||
TypeScriptLinter.tsTypeChecker = tsProgram.getLinterTypeChecker();
|
||||
@ -185947,6 +185987,12 @@ var ts;
|
||||
if (exportAssignment.isExportEquals) {
|
||||
this.incrementCounters(node, FaultID.ExportAssignment);
|
||||
}
|
||||
if (!TypeScriptLinter.inSharedModule(node)) {
|
||||
return;
|
||||
}
|
||||
if (ArkTSLinter_1_1.Utils.isShareableEntity(exportAssignment.expression)) {
|
||||
this.incrementCounters(exportAssignment.expression, FaultID.SharedModuleExports);
|
||||
}
|
||||
};
|
||||
TypeScriptLinter.prototype.handleCallExpression = function (node) {
|
||||
var tsCallExpr = node;
|
||||
@ -186461,6 +186507,55 @@ var ts;
|
||||
this.visitSourceFile(this.sourceFile);
|
||||
this.handleCommentDirectives(this.sourceFile);
|
||||
};
|
||||
TypeScriptLinter.prototype.handleExportKeyword = function (node) {
|
||||
var parentNode = node.parent;
|
||||
if (!TypeScriptLinter.inSharedModule(node) || ts.isModuleBlock(parentNode.parent)) {
|
||||
return;
|
||||
}
|
||||
switch (parentNode.kind) {
|
||||
case 266 /* ts.SyntaxKind.EnumDeclaration */:
|
||||
case 264 /* ts.SyntaxKind.InterfaceDeclaration */:
|
||||
case 262 /* ts.SyntaxKind.ClassDeclaration */:
|
||||
if (!ArkTSLinter_1_1.Utils.isShareableType(TypeScriptLinter.tsTypeChecker.getTypeAtLocation(parentNode))) {
|
||||
this.incrementCounters(parentNode, FaultID.SharedModuleExports);
|
||||
}
|
||||
return;
|
||||
case 242 /* ts.SyntaxKind.VariableStatement */:
|
||||
for (var _i = 0, _a = parentNode.declarationList.declarations; _i < _a.length; _i++) {
|
||||
var variableDeclaration = _a[_i];
|
||||
if (!ArkTSLinter_1_1.Utils.isShareableEntity(variableDeclaration.name)) {
|
||||
this.incrementCounters(variableDeclaration, FaultID.SharedModuleExports);
|
||||
}
|
||||
}
|
||||
return;
|
||||
case 265 /* ts.SyntaxKind.TypeAliasDeclaration */:
|
||||
return;
|
||||
default:
|
||||
this.incrementCounters(parentNode, FaultID.SharedModuleExports);
|
||||
}
|
||||
};
|
||||
TypeScriptLinter.prototype.handleExportDeclaration = function (node) {
|
||||
if (!TypeScriptLinter.inSharedModule(node) || ts.isModuleBlock(node.parent)) {
|
||||
return;
|
||||
}
|
||||
var exportDecl = node;
|
||||
if (exportDecl.exportClause === undefined) {
|
||||
this.incrementCounters(exportDecl, FaultID.SharedModuleNoStarExport);
|
||||
return;
|
||||
}
|
||||
if (ts.isNamespaceExport(exportDecl.exportClause)) {
|
||||
if (!ArkTSLinter_1_1.Utils.isShareableType(TypeScriptLinter.tsTypeChecker.getTypeAtLocation(exportDecl.exportClause.name))) {
|
||||
this.incrementCounters(exportDecl.exportClause.name, FaultID.SharedModuleExports);
|
||||
}
|
||||
return;
|
||||
}
|
||||
for (var _i = 0, _a = exportDecl.exportClause.elements; _i < _a.length; _i++) {
|
||||
var exportSpecifier = _a[_i];
|
||||
if (!ArkTSLinter_1_1.Utils.isShareableEntity(exportSpecifier.name)) {
|
||||
this.incrementCounters(exportSpecifier.name, FaultID.SharedModuleExports);
|
||||
}
|
||||
}
|
||||
};
|
||||
TypeScriptLinter.reportDiagnostics = true;
|
||||
// The SyntaxKind enum defines additional elements at the end of the enum
|
||||
// that serve as markers (FirstX/LastX). Those elements are initialized
|
||||
|
@ -17,7 +17,7 @@ export namespace ArkTSLinter_1_1 {
|
||||
export const cookBookMsg: string[] = [];
|
||||
export const cookBookTag: string[] = [];
|
||||
|
||||
for (let i = 0; i <= 162; i++) {
|
||||
for (let i = 0; i <= 164; i++) {
|
||||
cookBookMsg[ i ] = "";
|
||||
}
|
||||
|
||||
@ -183,5 +183,7 @@ cookBookTag[159] = 'Objects of "Sendable" type can not be initialized using obje
|
||||
cookBookTag[160] = 'Computed property names are not allowed in "Sendable" classes and interfaces (arkts-sendable-computed-prop-name)';
|
||||
cookBookTag[161] = 'Casting "Non-sendable" data to "Sendable" type is not allowed (arkts-sendable-as-expr)';
|
||||
cookBookTag[162] = "Shared module do not allow side effect import (arkts-no-side-effects-imports)";
|
||||
cookBookTag[163] = 'Exported object must have a Sendable data type in shared module (arkts-shared-module-exports)';
|
||||
cookBookTag[164] = '"export * from \'xxx\'" is not supported in shared module (arkts-shared-module-no-star-export)';
|
||||
}
|
||||
}
|
@ -41,8 +41,8 @@ export enum FaultID {
|
||||
SpreadOperator, LimitedStdLibApi, ErrorSuppression, StrictDiagnostic, ImportAfterStatement,
|
||||
EsObjectType, SendableClassInheritance, SendablePropType, SendableDefiniteAssignment, SendableGenericTypes,
|
||||
SendableCapturedVars, SendableClassDecorator, SendableObjectInitialization, SendableComputedPropName, SendableAsExpr,
|
||||
SharedNoSideEffectImport,
|
||||
LAST_ID, // this should always be last enum`
|
||||
SharedNoSideEffectImport, SharedModuleExports, SharedModuleNoStarExport,
|
||||
LAST_ID, // this should always be last enum
|
||||
}
|
||||
|
||||
export class FaultAttributes {
|
||||
@ -147,6 +147,8 @@ faultsAttrs[FaultID.SendableObjectInitialization] = new FaultAttributes(159);
|
||||
faultsAttrs[FaultID.SendableComputedPropName] = new FaultAttributes(160);
|
||||
faultsAttrs[FaultID.SendableAsExpr] = new FaultAttributes(161);
|
||||
faultsAttrs[FaultID.SharedNoSideEffectImport] = new FaultAttributes(162);
|
||||
faultsAttrs[FaultID.SharedModuleExports] = new FaultAttributes(163);
|
||||
faultsAttrs[FaultID.SharedModuleNoStarExport] = new FaultAttributes(164);
|
||||
}
|
||||
}
|
||||
}
|
@ -204,6 +204,8 @@ export class TypeScriptLinter {
|
||||
[SyntaxKind.EtsComponentExpression, this.handleEtsComponentExpression],
|
||||
[SyntaxKind.ClassStaticBlockDeclaration, this.handleClassStaticBlockDeclaration],
|
||||
[ts.SyntaxKind.IndexSignature, this.handleIndexSignature],
|
||||
[ts.SyntaxKind.ExportKeyword, this.handleExportKeyword],
|
||||
[ts.SyntaxKind.ExportDeclaration, this.handleExportDeclaration]
|
||||
]);
|
||||
|
||||
public incrementCounters(node: Node | CommentRange, faultId: number, autofixable = false, autofix?: Autofix[]): void {
|
||||
@ -1753,6 +1755,14 @@ export class TypeScriptLinter {
|
||||
if (exportAssignment.isExportEquals) {
|
||||
this.incrementCounters(node, FaultID.ExportAssignment);
|
||||
}
|
||||
|
||||
if (!TypeScriptLinter.inSharedModule(node)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Utils.isShareableEntity(exportAssignment.expression)) {
|
||||
this.incrementCounters(exportAssignment.expression, FaultID.SharedModuleExports);
|
||||
}
|
||||
}
|
||||
|
||||
private handleCallExpression(node: Node): void {
|
||||
@ -2339,6 +2349,58 @@ export class TypeScriptLinter {
|
||||
this.handleCommentDirectives(this.sourceFile);
|
||||
}
|
||||
|
||||
private handleExportKeyword(node: ts.Node): void {
|
||||
const parentNode = node.parent;
|
||||
if (!TypeScriptLinter.inSharedModule(node) || ts.isModuleBlock(parentNode.parent)) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (parentNode.kind) {
|
||||
case ts.SyntaxKind.EnumDeclaration:
|
||||
case ts.SyntaxKind.InterfaceDeclaration:
|
||||
case ts.SyntaxKind.ClassDeclaration:
|
||||
if (!Utils.isShareableType(TypeScriptLinter.tsTypeChecker.getTypeAtLocation(parentNode))) {
|
||||
this.incrementCounters(parentNode, FaultID.SharedModuleExports);
|
||||
}
|
||||
return;
|
||||
case ts.SyntaxKind.VariableStatement:
|
||||
for (const variableDeclaration of (parentNode as ts.VariableStatement).declarationList.declarations) {
|
||||
if (!Utils.isShareableEntity(variableDeclaration.name)) {
|
||||
this.incrementCounters(variableDeclaration, FaultID.SharedModuleExports);
|
||||
}
|
||||
}
|
||||
return;
|
||||
case ts.SyntaxKind.TypeAliasDeclaration:
|
||||
return;
|
||||
default:
|
||||
this.incrementCounters(parentNode, FaultID.SharedModuleExports);
|
||||
}
|
||||
}
|
||||
|
||||
private handleExportDeclaration(node: ts.Node): void {
|
||||
if (!TypeScriptLinter.inSharedModule(node) || ts.isModuleBlock(node.parent)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const exportDecl = node as ts.ExportDeclaration;
|
||||
if (exportDecl.exportClause === undefined) {
|
||||
this.incrementCounters(exportDecl, FaultID.SharedModuleNoStarExport);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ts.isNamespaceExport(exportDecl.exportClause)) {
|
||||
if (!Utils.isShareableType(TypeScriptLinter.tsTypeChecker.getTypeAtLocation(exportDecl.exportClause.name))) {
|
||||
this.incrementCounters(exportDecl.exportClause.name, FaultID.SharedModuleExports);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
for (const exportSpecifier of exportDecl.exportClause.elements) {
|
||||
if (!Utils.isShareableEntity(exportSpecifier.name)) {
|
||||
this.incrementCounters(exportSpecifier.name, FaultID.SharedModuleExports);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -126,6 +126,8 @@ export class LinterConfig {
|
||||
LinterConfig.nodeDesc[FaultID.SendableComputedPropName] = 'Sendable computed property name';
|
||||
LinterConfig.nodeDesc[FaultID.SendableAsExpr] = 'Sendable as expr';
|
||||
LinterConfig.nodeDesc[FaultID.SharedNoSideEffectImport] = 'Shared no side effect import';
|
||||
LinterConfig.nodeDesc[FaultID.SharedModuleExports] = 'Shared module exports';
|
||||
LinterConfig.nodeDesc[FaultID.SharedModuleNoStarExport] = 'Share module no star export';
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1872,6 +1872,21 @@ export function isSendableType(type: ts.Type): boolean {
|
||||
return isSendableClassOrInterface(type);
|
||||
}
|
||||
|
||||
export function isShareableType(tsType: ts.Type): boolean {
|
||||
const sym = tsType.getSymbol();
|
||||
if (isConstEnum(sym)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (tsType.isUnion()) {
|
||||
return tsType.types.every((elemType) => {
|
||||
return isShareableType(elemType);
|
||||
});
|
||||
}
|
||||
|
||||
return isSendableType(tsType);
|
||||
}
|
||||
|
||||
export function isSendableClassOrInterface(type: ts.Type): boolean {
|
||||
const sym = type.getSymbol();
|
||||
if (!sym) {
|
||||
@ -1990,6 +2005,25 @@ export function isSharedModule(sourceFile: ts.SourceFile): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
function getDeclarationNode(node: ts.Node): ts.Declaration | undefined {
|
||||
const sym = trueSymbolAtLocation(node);
|
||||
return getDeclaration(sym);
|
||||
}
|
||||
|
||||
function isFunctionLikeDeclaration(node: ts.Declaration): boolean {
|
||||
return ts.isFunctionDeclaration(node) || ts.isMethodDeclaration(node) ||
|
||||
ts.isGetAccessorDeclaration(node) || ts.isSetAccessorDeclaration(node) || ts.isConstructorDeclaration(node) ||
|
||||
ts.isFunctionExpression(node) || ts.isArrowFunction(node);
|
||||
}
|
||||
|
||||
export function isShareableEntity(node: ts.Node): boolean {
|
||||
const decl = getDeclarationNode(node);
|
||||
const typeNode = (decl as any)?.type;
|
||||
return (typeNode && !isFunctionLikeDeclaration(decl!)) ?
|
||||
isSendableTypeNode(typeNode) :
|
||||
isShareableType(TypeScriptLinter.tsTypeChecker.getTypeAtLocation(decl ? decl : node));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
declare namespace lang {
|
||||
interface ISendable {}
|
||||
}
|
||||
|
||||
// sendable class
|
||||
@Sendable
|
||||
class sendableClassA {}
|
||||
|
||||
// sendable class var
|
||||
let sendableVar = sendableClassA
|
||||
|
||||
// non-sendable class
|
||||
class nonSendableClassB {}
|
||||
|
||||
// non-sendable class var
|
||||
let nonSendableVar = nonSendableClassB
|
||||
|
||||
// sendable interface
|
||||
interface sendableInterface extends lang.ISendable {}
|
||||
|
||||
// non-sendable interface
|
||||
interface nonSendableInterface {}
|
||||
|
||||
export {
|
||||
sendableClassA,
|
||||
sendableVar,
|
||||
nonSendableClassB,
|
||||
nonSendableVar,
|
||||
sendableInterface,
|
||||
nonSendableInterface,
|
||||
lang,
|
||||
};
|
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import {lang} from "@arkts.lang";
|
||||
|
||||
'use shared'
|
||||
|
||||
export const enum A{a, b} // ok, const enum is sendable type
|
||||
export enum B{a, b} // error, enum is not sendable type
|
||||
export let var1: number | A; // ok, union type of const enum and number
|
||||
export let var2: A.a; // error, enum member is not sendable type
|
||||
|
||||
export class C{} // error, class is not sendable type
|
||||
@Sendable
|
||||
export class D{} // ok, sendable class is sendable type
|
||||
export {D as DD};
|
||||
export let var3: A | C; //error
|
||||
|
||||
export interface E{} // error, interface is not sendable type
|
||||
type ee = E;
|
||||
export {ee}; // error
|
||||
let var4: C | ee;
|
||||
export {var4}; // error
|
||||
|
||||
export * as ns from '@arkts.lang'; // err, ns is not sendable type
|
||||
export * from '@arkts.lang'; // error, export * from 'xxx' is not supported
|
||||
export default lang.ISendable; // ok
|
||||
|
||||
export let var6: A | A.a; // error, union type of sendable and unsendbale
|
||||
export let var7: string | B = 'aaa'; // error , union type of sendable and unsendbale
|
||||
export let var8 = var7; // ok, no explicit type, the inferred type of var8 is string
|
||||
namespace ns {
|
||||
export let a: C; // ok, exports from namespace is not checked
|
||||
}
|
||||
|
||||
export {ns} // error, ns is not sendable type
|
||||
|
||||
function fun: boolean() {}
|
||||
export {fun}
|
@ -0,0 +1,104 @@
|
||||
{
|
||||
"arktsVersion_1_0": [
|
||||
{
|
||||
"messageText": "No decorators except ArkUI decorators are currently allowed (arkts-no-decorators-except-arkui)",
|
||||
"expectLineAndCharacter": {
|
||||
"line": 26,
|
||||
"character": 1
|
||||
}
|
||||
}
|
||||
],
|
||||
"arktsVersion_1_1": [
|
||||
{
|
||||
"messageText": "Exported object must have a Sendable data type in shared module (arkts-shared-module-exports)",
|
||||
"expectLineAndCharacter": {
|
||||
"line": 21,
|
||||
"character": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"messageText": "Exported object must have a Sendable data type in shared module (arkts-shared-module-exports)",
|
||||
"expectLineAndCharacter": {
|
||||
"line": 23,
|
||||
"character": 12
|
||||
}
|
||||
},
|
||||
{
|
||||
"messageText": "Exported object must have a Sendable data type in shared module (arkts-shared-module-exports)",
|
||||
"expectLineAndCharacter": {
|
||||
"line": 25,
|
||||
"character": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"messageText": "Exported object must have a Sendable data type in shared module (arkts-shared-module-exports)",
|
||||
"expectLineAndCharacter": {
|
||||
"line": 29,
|
||||
"character": 12
|
||||
}
|
||||
},
|
||||
{
|
||||
"messageText": "Exported object must have a Sendable data type in shared module (arkts-shared-module-exports)",
|
||||
"expectLineAndCharacter": {
|
||||
"line": 31,
|
||||
"character": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"messageText": "Exported object must have a Sendable data type in shared module (arkts-shared-module-exports)",
|
||||
"expectLineAndCharacter": {
|
||||
"line": 33,
|
||||
"character": 9
|
||||
}
|
||||
},
|
||||
{
|
||||
"messageText": "Exported object must have a Sendable data type in shared module (arkts-shared-module-exports)",
|
||||
"expectLineAndCharacter": {
|
||||
"line": 35,
|
||||
"character": 9
|
||||
}
|
||||
},
|
||||
{
|
||||
"messageText": "Exported object must have a Sendable data type in shared module (arkts-shared-module-exports)",
|
||||
"expectLineAndCharacter": {
|
||||
"line": 37,
|
||||
"character": 13
|
||||
}
|
||||
},
|
||||
{
|
||||
"messageText": "\"export * from 'xxx'\" is not supported in shared module (arkts-shared-module-no-star-export)",
|
||||
"expectLineAndCharacter": {
|
||||
"line": 38,
|
||||
"character": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"messageText": "Exported object must have a Sendable data type in shared module (arkts-shared-module-exports)",
|
||||
"expectLineAndCharacter": {
|
||||
"line": 41,
|
||||
"character": 12
|
||||
}
|
||||
},
|
||||
{
|
||||
"messageText": "Exported object must have a Sendable data type in shared module (arkts-shared-module-exports)",
|
||||
"expectLineAndCharacter": {
|
||||
"line": 42,
|
||||
"character": 12
|
||||
}
|
||||
},
|
||||
{
|
||||
"messageText": "Exported object must have a Sendable data type in shared module (arkts-shared-module-exports)",
|
||||
"expectLineAndCharacter": {
|
||||
"line": 48,
|
||||
"character": 9
|
||||
}
|
||||
},
|
||||
{
|
||||
"messageText": "Exported object must have a Sendable data type in shared module (arkts-shared-module-exports)",
|
||||
"expectLineAndCharacter": {
|
||||
"line": 51,
|
||||
"character": 9
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@ -13138,12 +13138,15 @@ declare namespace ts {
|
||||
SendablePropType = 83,
|
||||
SendableDefiniteAssignment = 84,
|
||||
SendableGenericTypes = 85,
|
||||
SendableClassDecorator = 86,
|
||||
SendableObjectInitialization = 87,
|
||||
SendableComputedPropName = 88,
|
||||
SendableAsExpr = 89,
|
||||
SharedNoSideEffectImport = 90,
|
||||
LAST_ID = 91
|
||||
SendableCapturedVars = 86,
|
||||
SendableClassDecorator = 87,
|
||||
SendableObjectInitialization = 88,
|
||||
SendableComputedPropName = 89,
|
||||
SendableAsExpr = 90,
|
||||
SharedNoSideEffectImport = 91,
|
||||
SharedModuleExports = 92,
|
||||
SharedModuleNoStarExport = 93,
|
||||
LAST_ID = 94
|
||||
}
|
||||
class FaultAttributes {
|
||||
cookBookRef: number;
|
||||
@ -13331,6 +13334,7 @@ declare namespace ts {
|
||||
function unwrapParenthesizedTypeNode(typeNode: ts.TypeNode): ts.TypeNode;
|
||||
function isSendableTypeNode(typeNode: ts.TypeNode): boolean;
|
||||
function isSendableType(type: ts.Type): boolean;
|
||||
function isShareableType(tsType: ts.Type): boolean;
|
||||
function isSendableClassOrInterface(type: ts.Type): boolean;
|
||||
function typeContainsSendableClassOrInterface(type: ts.Type): boolean;
|
||||
function isConstEnum(sym: ts.Symbol | undefined): boolean;
|
||||
@ -13340,6 +13344,7 @@ declare namespace ts {
|
||||
function getDecoratorsIfInSendableClass(declaration: ts.HasDecorators): readonly ts.Decorator[] | undefined;
|
||||
function isISendableInterface(type: ts.Type): boolean;
|
||||
function isSharedModule(sourceFile: ts.SourceFile): boolean;
|
||||
function isShareableEntity(node: ts.Node): boolean;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -13470,6 +13475,9 @@ declare namespace ts {
|
||||
private handleEsObjectAssignment;
|
||||
private handleCatchClause;
|
||||
private handleClassDeclaration;
|
||||
private scanCapturedVarsInSendableScope;
|
||||
private checkLocalDecl;
|
||||
private checkNamespaceImportVar;
|
||||
private checkClassDeclarationHeritageClause;
|
||||
private isValidSendableClassExtends;
|
||||
private checkSendableTypeParameter;
|
||||
@ -13528,6 +13536,8 @@ declare namespace ts {
|
||||
private handleClassStaticBlockDeclaration;
|
||||
private handleIndexSignature;
|
||||
lint(): void;
|
||||
private handleExportKeyword;
|
||||
private handleExportDeclaration;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
22
tests/baselines/reference/api/typescript.d.ts
vendored
22
tests/baselines/reference/api/typescript.d.ts
vendored
@ -9199,12 +9199,15 @@ declare namespace ts {
|
||||
SendablePropType = 83,
|
||||
SendableDefiniteAssignment = 84,
|
||||
SendableGenericTypes = 85,
|
||||
SendableClassDecorator = 86,
|
||||
SendableObjectInitialization = 87,
|
||||
SendableComputedPropName = 88,
|
||||
SendableAsExpr = 89,
|
||||
SharedNoSideEffectImport = 90,
|
||||
LAST_ID = 91
|
||||
SendableCapturedVars = 86,
|
||||
SendableClassDecorator = 87,
|
||||
SendableObjectInitialization = 88,
|
||||
SendableComputedPropName = 89,
|
||||
SendableAsExpr = 90,
|
||||
SharedNoSideEffectImport = 91,
|
||||
SharedModuleExports = 92,
|
||||
SharedModuleNoStarExport = 93,
|
||||
LAST_ID = 94
|
||||
}
|
||||
class FaultAttributes {
|
||||
cookBookRef: number;
|
||||
@ -9392,6 +9395,7 @@ declare namespace ts {
|
||||
function unwrapParenthesizedTypeNode(typeNode: ts.TypeNode): ts.TypeNode;
|
||||
function isSendableTypeNode(typeNode: ts.TypeNode): boolean;
|
||||
function isSendableType(type: ts.Type): boolean;
|
||||
function isShareableType(tsType: ts.Type): boolean;
|
||||
function isSendableClassOrInterface(type: ts.Type): boolean;
|
||||
function typeContainsSendableClassOrInterface(type: ts.Type): boolean;
|
||||
function isConstEnum(sym: ts.Symbol | undefined): boolean;
|
||||
@ -9401,6 +9405,7 @@ declare namespace ts {
|
||||
function getDecoratorsIfInSendableClass(declaration: ts.HasDecorators): readonly ts.Decorator[] | undefined;
|
||||
function isISendableInterface(type: ts.Type): boolean;
|
||||
function isSharedModule(sourceFile: ts.SourceFile): boolean;
|
||||
function isShareableEntity(node: ts.Node): boolean;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -9531,6 +9536,9 @@ declare namespace ts {
|
||||
private handleEsObjectAssignment;
|
||||
private handleCatchClause;
|
||||
private handleClassDeclaration;
|
||||
private scanCapturedVarsInSendableScope;
|
||||
private checkLocalDecl;
|
||||
private checkNamespaceImportVar;
|
||||
private checkClassDeclarationHeritageClause;
|
||||
private isValidSendableClassExtends;
|
||||
private checkSendableTypeParameter;
|
||||
@ -9589,6 +9597,8 @@ declare namespace ts {
|
||||
private handleClassStaticBlockDeclaration;
|
||||
private handleIndexSignature;
|
||||
lint(): void;
|
||||
private handleExportKeyword;
|
||||
private handleExportDeclaration;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user