!431 struct内错误建立etscomponentexpression

Merge pull request !431 from houhaoyu/master10
This commit is contained in:
openharmony_ci 2024-07-27 09:28:16 +00:00 committed by Gitee
commit 4b8307cea2
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
19 changed files with 1083 additions and 623 deletions

7
lib/protocol.d.ts vendored
View File

@ -1673,6 +1673,13 @@ declare namespace ts.server.protocol {
name: string;
emitParameters: boolean;
}[];
syntaxComponents: {
paramsUICallback: string[];
attrUICallback: {
name: string;
attributes: string[];
}[];
};
}
/**
* Completions request; value of command field is "completions".

View File

@ -13977,6 +13977,18 @@ var ts;
return undefined;
}
ts.getRootEtsComponent = getRootEtsComponent;
function getRootComponent(node, compilerOptions) {
var _a, _b, _c;
while (node) {
if (ts.isEtsComponentExpression(node) || ts.isCallExpression(node) && ts.isIdentifier(node.expression) &&
((_c = (_b = (_a = compilerOptions.ets) === null || _a === void 0 ? void 0 : _a.syntaxComponents) === null || _b === void 0 ? void 0 : _b.attrUICallback) === null || _c === void 0 ? void 0 : _c.map(function (item) { return item.name; }).includes(node.expression.escapedText.toString()))) {
return node;
}
node = node.expression;
}
return undefined;
}
ts.getRootComponent = getRootComponent;
function getVirtualEtsComponent(node) {
while (node) {
if (ts.isPropertyAccessExpression(node) && node.expression && node.expression.virtual) {
@ -26716,6 +26728,12 @@ var ts;
function setEtsStateStylesContext(val) {
setEtsFlag(val, 64);
}
function setUICallbackContext(val) {
setEtsFlag(val, 512);
}
function setSyntaxComponentContext(val) {
setEtsFlag(val, 1024);
}
function doOutsideOfContext(context, func) {
var contextFlagsToClear = context & contextFlags;
if (contextFlagsToClear) {
@ -26826,6 +26844,12 @@ var ts;
function inEtsStateStylesContext() {
return inEtsContext() && (inBuildContext() || inBuilderContext() || inEtsExtendComponentsContext() || inEtsStylesComponentsContext()) && inEtsFlagsContext(64);
}
function inUICallbackContext() {
return inEtsContext() && (inBuildContext() || inBuilderContext()) && inEtsFlagsContext(512);
}
function inSyntaxComponentContext() {
return inEtsContext() && (inBuildContext() || inBuilderContext()) && inEtsFlagsContext(1024);
}
function parseErrorAtPosition(start, length, message, arg0) {
var lastError = ts.lastOrUndefined(parseDiagnostics);
var result;
@ -28916,7 +28940,7 @@ var ts;
if (ts.isLeftHandSideExpression(expr) && ts.isAssignmentOperator(reScanGreaterToken())) {
return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher(allowReturnTypeInArrowFunction), pos);
}
if ((inStructContext() || inBuildContext() || inBuilderContext()) && ts.isCallExpression(expr) && token() === 18) {
if ((inBuildContext() || inBuilderContext()) && inUICallbackContext() && ts.isCallExpression(expr) && token() === 18) {
return makeEtsComponentExpression(expr, pos);
}
return parseConditionalExpressionRest(expr, pos, allowReturnTypeInArrowFunction);
@ -29142,9 +29166,13 @@ var ts;
}
var lastToken = token();
var equalsGreaterThanToken = parseExpectedToken(38);
var originUIContextFlag = inUICallbackContext();
setUICallbackContext(inSyntaxComponentContext() ? true : false);
setSyntaxComponentContext(false);
var body = (lastToken === 38 || lastToken === 18)
? parseArrowFunctionExpressionBody(ts.some(modifiers, ts.isAsyncModifier), allowReturnTypeInArrowFunction)
: parseIdentifier();
setUICallbackContext(originUIContextFlag);
if (!allowReturnTypeInArrowFunction && hasReturnColon) {
if (token() !== 58) {
return undefined;
@ -29755,9 +29783,9 @@ var ts;
return finishNode(tagExpression, pos);
}
function parseCallExpressionRest(pos, expression) {
var _a, _b, _c, _d, _e, _f;
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
var currentNodeName;
while (true) {
var _loop_5 = function () {
expression = parseMemberExpressionRest(pos, expression, true);
var typeArguments = void 0;
var questionDotToken = parseOptionalToken(28);
@ -29765,7 +29793,7 @@ var ts;
typeArguments = tryParse(parseTypeArgumentsInExpression);
if (isTemplateStartOfTaggedTemplate()) {
expression = parseTaggedTemplateRest(pos, expression, questionDotToken, typeArguments);
continue;
return "continue";
}
}
if (typeArguments || token() === 20) {
@ -29774,19 +29802,27 @@ var ts;
expression = expression.expression;
}
if (isValidVirtualTypeArgumentsContext() && ts.isPropertyAccessExpression(expression)) {
var rootNode = ts.getRootEtsComponent(expression);
var rootNode = ts.getRootComponent(expression, sourceFileCompilerOptions);
if (rootNode) {
var rootNodeName = (rootNode.expression).escapedText.toString();
var rootNodeName_1 = (rootNode.expression).escapedText.toString();
currentNodeName = ts.getTextOfPropertyName(expression.name).toString();
if (currentNodeName === ((_b = (_a = sourceFileCompilerOptions === null || sourceFileCompilerOptions === void 0 ? void 0 : sourceFileCompilerOptions.ets) === null || _a === void 0 ? void 0 : _a.styles) === null || _b === void 0 ? void 0 : _b.property)) {
setEtsStateStylesContext(true);
stateStylesRootNode = rootNodeName;
stateStylesRootNode = rootNodeName_1;
}
else {
setEtsStateStylesContext(false);
stateStylesRootNode = undefined;
}
typeArguments = parseEtsTypeArguments(pos, "".concat(rootNodeName, "Attribute"));
if ((_e = (_d = (_c = sourceFileCompilerOptions === null || sourceFileCompilerOptions === void 0 ? void 0 : sourceFileCompilerOptions.ets) === null || _c === void 0 ? void 0 : _c.syntaxComponents) === null || _d === void 0 ? void 0 : _d.attrUICallback) === null || _e === void 0 ? void 0 : _e.map(function (item) { return item.name; }).includes(rootNodeName_1)) {
var syntaxComponents = (_h = (_g = (_f = sourceFileCompilerOptions === null || sourceFileCompilerOptions === void 0 ? void 0 : sourceFileCompilerOptions.ets) === null || _f === void 0 ? void 0 : _f.syntaxComponents) === null || _g === void 0 ? void 0 : _g.attrUICallback) === null || _h === void 0 ? void 0 : _h.filter(function (item) { return item.name === rootNodeName_1; });
if (syntaxComponents.length && ((_k = (_j = syntaxComponents[0]) === null || _j === void 0 ? void 0 : _j.attributes) === null || _k === void 0 ? void 0 : _k.includes(currentNodeName))) {
setSyntaxComponentContext(true);
}
}
else {
typeArguments = parseEtsTypeArguments(pos, "".concat(rootNodeName_1, "Attribute"));
}
}
else if (inEtsStateStylesContext() && stateStylesRootNode) {
typeArguments = parseEtsTypeArguments(pos, "".concat(stateStylesRootNode, "Attribute"));
@ -29796,7 +29832,7 @@ var ts;
if (virtualNode) {
var rootNodeName = (virtualNode.expression).escapedText.toString();
currentNodeName = ts.getTextOfPropertyName(expression.name).toString();
if (currentNodeName === ((_d = (_c = sourceFileCompilerOptions === null || sourceFileCompilerOptions === void 0 ? void 0 : sourceFileCompilerOptions.ets) === null || _c === void 0 ? void 0 : _c.styles) === null || _d === void 0 ? void 0 : _d.property)) {
if (currentNodeName === ((_m = (_l = sourceFileCompilerOptions === null || sourceFileCompilerOptions === void 0 ? void 0 : sourceFileCompilerOptions.ets) === null || _l === void 0 ? void 0 : _l.styles) === null || _m === void 0 ? void 0 : _m.property)) {
setEtsStateStylesContext(true);
rootNodeName = rootNodeName.replace("Instance", "");
stateStylesRootNode = rootNodeName;
@ -29805,20 +29841,29 @@ var ts;
}
}
}
if (isValidVirtualTypeArgumentsContext() && ts.isIdentifier(expression) &&
((_q = (_p = (_o = sourceFileCompilerOptions === null || sourceFileCompilerOptions === void 0 ? void 0 : sourceFileCompilerOptions.ets) === null || _o === void 0 ? void 0 : _o.syntaxComponents) === null || _p === void 0 ? void 0 : _p.paramsUICallback) === null || _q === void 0 ? void 0 : _q.includes(expression.escapedText.toString()))) {
setSyntaxComponentContext(true);
}
var argumentList = parseArgumentList();
var callExpr = questionDotToken || tryReparseOptionalChain(expression) ?
factory.createCallChain(expression, questionDotToken, typeArguments, argumentList) :
factory.createCallExpression(expression, typeArguments, argumentList);
expression = finishNode(callExpr, pos);
continue;
return "continue";
}
if (questionDotToken) {
var name = createMissingNode(79, false, ts.Diagnostics.Identifier_expected);
expression = finishNode(factory.createPropertyAccessChain(expression, questionDotToken, name), pos);
}
break;
return "break";
};
while (true) {
var state_2 = _loop_5();
if (state_2 === "break")
break;
}
if (currentNodeName === ((_f = (_e = sourceFileCompilerOptions === null || sourceFileCompilerOptions === void 0 ? void 0 : sourceFileCompilerOptions.ets) === null || _e === void 0 ? void 0 : _e.styles) === null || _f === void 0 ? void 0 : _f.property)) {
if (currentNodeName === ((_s = (_r = sourceFileCompilerOptions === null || sourceFileCompilerOptions === void 0 ? void 0 : sourceFileCompilerOptions.ets) === null || _r === void 0 ? void 0 : _r.styles) === null || _s === void 0 ? void 0 : _s.property)) {
setEtsStateStylesContext(false);
stateStylesRootNode = undefined;
}
@ -30846,8 +30891,10 @@ var ts;
var methodName = (_a = ts.getPropertyNameForPropertyNameNode(name)) === null || _a === void 0 ? void 0 : _a.toString();
var orignalEtsBuildContext = inBuildContext();
var orignalEtsBuilderContext = inBuilderContext();
var orignalUICallbackContext = inUICallbackContext();
setEtsBuildContext(methodName === ((_d = (_c = (_b = sourceFileCompilerOptions === null || sourceFileCompilerOptions === void 0 ? void 0 : sourceFileCompilerOptions.ets) === null || _b === void 0 ? void 0 : _b.render) === null || _c === void 0 ? void 0 : _c.method) === null || _d === void 0 ? void 0 : _d.find(function (render) { return render === "build"; })));
setEtsBuilderContext(ts.hasEtsBuilderDecoratorNames(decorators, sourceFileCompilerOptions));
setUICallbackContext(inBuildContext() || inBuilderContext());
if (inStructContext() && ts.hasEtsStylesDecoratorNames(decorators, sourceFileCompilerOptions)) {
if (methodName && currentStructName) {
structStylesComponents.set(methodName, { structName: currentStructName, kind: 173 });
@ -30872,6 +30919,7 @@ var ts;
node.exclamationToken = exclamationToken;
setEtsBuildContext(orignalEtsBuildContext);
setEtsBuilderContext(orignalEtsBuilderContext);
setUICallbackContext(orignalUICallbackContext);
setEtsStylesComponentsContext(false);
stylesEtsComponentDeclaration = undefined;
setEtsComponentsContext(orignalEtsComponentsContext);
@ -34966,7 +35014,7 @@ var ts;
}
function convertObjectLiteralExpressionToJson(node, knownOptions, extraKeyDiagnostics, parentOption) {
var result = returnValue ? {} : undefined;
var _loop_5 = function (element) {
var _loop_6 = function (element) {
if (element.kind !== 303) {
errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, element, ts.Diagnostics.Property_assignment_expected));
return "continue";
@ -35014,7 +35062,7 @@ var ts;
};
for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
var element = _a[_i];
_loop_5(element);
_loop_6(element);
}
return result;
}
@ -35195,7 +35243,7 @@ var ts;
var optionsNameMap = _a.optionsNameMap;
var result = new ts.Map();
var getCanonicalFileName = pathOptions && ts.createGetCanonicalFileName(pathOptions.useCaseSensitiveFileNames);
var _loop_6 = function (name) {
var _loop_7 = function (name) {
if (ts.hasProperty(options, name)) {
if (optionsNameMap.has(name) && (optionsNameMap.get(name).category === ts.Diagnostics.Command_line_Options || optionsNameMap.get(name).category === ts.Diagnostics.Output_Formatting)) {
return "continue";
@ -35224,7 +35272,7 @@ var ts;
}
};
for (var name in options) {
_loop_6(name);
_loop_7(name);
}
return result;
}
@ -35881,7 +35929,7 @@ var ts;
}
var jsonOnlyIncludeRegexes;
if (validatedIncludeSpecs && validatedIncludeSpecs.length > 0) {
var _loop_7 = function (file) {
var _loop_8 = function (file) {
if (ts.fileExtensionIs(file, ".json")) {
if (!jsonOnlyIncludeRegexes) {
var includes = validatedIncludeSpecs.filter(function (s) { return ts.endsWith(s, ".json"); });
@ -35908,7 +35956,7 @@ var ts;
};
for (var _a = 0, _b = host.readDirectory(basePath, ts.flatten(supportedExtensionsWithJsonIfResolveJsonModule), validatedExcludeSpecs, validatedIncludeSpecs, undefined); _a < _b.length; _a++) {
var file = _b[_a];
_loop_7(file);
_loop_8(file);
}
}
var literalFiles = ts.arrayFrom(literalFileMap.values());
@ -38886,23 +38934,23 @@ var ts;
}
break;
case 269: {
var state_2 = 0;
var state_3 = 0;
ts.forEachChild(node, function (n) {
var childState = getModuleInstanceStateCached(n, visited);
switch (childState) {
case 0:
return;
case 2:
state_2 = 2;
state_3 = 2;
return;
case 1:
state_2 = 1;
state_3 = 1;
return true;
default:
ts.Debug.assertNever(childState);
}
});
return state_2;
return state_3;
}
case 268:
return getModuleInstanceState(node, visited);
@ -42842,7 +42890,7 @@ var ts;
function addDuplicateDeclarationError(node, message, symbolName, relatedNodes) {
var errorNode = (ts.getExpandoInitializer(node, false) ? ts.getNameOfExpando(node) : ts.getNameOfDeclaration(node)) || node;
var err = lookupOrIssueError(errorNode, message, symbolName);
var _loop_8 = function (relatedNode) {
var _loop_9 = function (relatedNode) {
var adjustedNode = (ts.getExpandoInitializer(relatedNode, false) ? ts.getNameOfExpando(relatedNode) : ts.getNameOfDeclaration(relatedNode)) || relatedNode;
if (adjustedNode === errorNode)
return "continue";
@ -42855,7 +42903,7 @@ var ts;
};
for (var _i = 0, _a = relatedNodes || ts.emptyArray; _i < _a.length; _i++) {
var relatedNode = _a[_i];
_loop_8(relatedNode);
_loop_9(relatedNode);
}
}
function combineSymbolTables(first, second) {
@ -45241,7 +45289,7 @@ var ts;
}
function forEachSymbolTableInScope(enclosingDeclaration, callback) {
var result;
var _loop_9 = function (location) {
var _loop_10 = function (location) {
if (location.locals && !isGlobalSourceFile(location)) {
if (result = callback(location.locals, undefined, true, location)) {
return { value: result };
@ -45274,9 +45322,9 @@ var ts;
}
};
for (var location = enclosingDeclaration; location; location = location.parent) {
var state_3 = _loop_9(location);
if (typeof state_3 === "object")
return state_3.value;
var state_4 = _loop_10(location);
if (typeof state_4 === "object")
return state_4.value;
}
return callback(globals, undefined, true);
}
@ -47454,7 +47502,7 @@ var ts;
if (ts.length(reexports) > 1) {
var groups = ts.group(reexports, function (decl) { return ts.isStringLiteral(decl.moduleSpecifier) ? ">" + decl.moduleSpecifier.text : ">"; });
if (groups.length !== reexports.length) {
var _loop_10 = function (group_1) {
var _loop_11 = function (group_1) {
if (group_1.length > 1) {
statements = __spreadArray(__spreadArray([], ts.filter(statements, function (s) { return group_1.indexOf(s) === -1; }), true), [
ts.factory.createExportDeclaration(undefined, false, ts.factory.createNamedExports(ts.flatMap(group_1, function (e) { return ts.cast(e.exportClause, ts.isNamedExports).elements; })), group_1[0].moduleSpecifier)
@ -47463,7 +47511,7 @@ var ts;
};
for (var _i = 0, groups_1 = groups; _i < groups_1.length; _i++) {
var group_1 = groups_1[_i];
_loop_10(group_1);
_loop_11(group_1);
}
}
}
@ -50749,7 +50797,7 @@ var ts;
if (!ts.length(result) && indexWithLengthOverOne !== -1) {
var masterList = signatureLists[indexWithLengthOverOne !== undefined ? indexWithLengthOverOne : 0];
var results = masterList.slice();
var _loop_11 = function (signatures) {
var _loop_12 = function (signatures) {
if (signatures !== masterList) {
var signature_1 = signatures[0];
ts.Debug.assert(!!signature_1, "getUnionSignatures bails early on empty signature lists and should not have empty lists on second pass");
@ -50761,8 +50809,8 @@ var ts;
};
for (var _b = 0, signatureLists_1 = signatureLists; _b < signatureLists_1.length; _b++) {
var signatures = signatureLists_1[_b];
var state_4 = _loop_11(signatures);
if (state_4 === "break")
var state_5 = _loop_12(signatures);
if (state_5 === "break")
break;
}
result = results;
@ -50857,7 +50905,7 @@ var ts;
var sourceInfos = getIndexInfosOfType(types[0]);
if (sourceInfos) {
var result = [];
var _loop_12 = function (info) {
var _loop_13 = function (info) {
var indexType = info.keyType;
if (ts.every(types, function (t) { return !!getIndexInfoOfType(t, indexType); })) {
result.push(createIndexInfo(indexType, getUnionType(ts.map(types, function (t) { return getIndexTypeOfType(t, indexType); })), ts.some(types, function (t) { return getIndexInfoOfType(t, indexType).isReadonly; })));
@ -50865,7 +50913,7 @@ var ts;
};
for (var _i = 0, sourceInfos_1 = sourceInfos; _i < sourceInfos_1.length; _i++) {
var info = sourceInfos_1[_i];
_loop_12(info);
_loop_13(info);
}
return result;
}
@ -50908,7 +50956,7 @@ var ts;
var types = type.types;
var mixinFlags = findMixins(types);
var mixinCount = ts.countWhere(mixinFlags, function (b) { return b; });
var _loop_13 = function (i) {
var _loop_14 = function (i) {
var t = type.types[i];
if (!mixinFlags[i]) {
var signatures = getSignaturesOfType(t, 1);
@ -50925,19 +50973,19 @@ var ts;
indexInfos = ts.reduceLeft(getIndexInfosOfType(t), function (infos, newInfo) { return appendIndexInfo(infos, newInfo, false); }, indexInfos);
};
for (var i = 0; i < types.length; i++) {
_loop_13(i);
_loop_14(i);
}
setStructuredTypeMembers(type, emptySymbols, callSignatures || ts.emptyArray, constructSignatures || ts.emptyArray, indexInfos || ts.emptyArray);
}
function appendSignatures(signatures, newSignatures) {
var _loop_14 = function (sig) {
var _loop_15 = function (sig) {
if (!signatures || ts.every(signatures, function (s) { return !compareSignaturesIdentical(s, sig, false, false, false, compareTypesIdentical); })) {
signatures = ts.append(signatures, sig);
}
};
for (var _i = 0, newSignatures_1 = newSignatures; _i < newSignatures_1.length; _i++) {
var sig = newSignatures_1[_i];
_loop_14(sig);
_loop_15(sig);
}
return signatures;
}
@ -51825,7 +51873,7 @@ var ts;
}
function getCommonDeclarationsOfSymbols(symbols) {
var commonDeclarations;
var _loop_15 = function (symbol) {
var _loop_16 = function (symbol) {
if (!symbol.declarations) {
return { value: undefined };
}
@ -51844,9 +51892,9 @@ var ts;
};
for (var _i = 0, symbols_3 = symbols; _i < symbols_3.length; _i++) {
var symbol = symbols_3[_i];
var state_5 = _loop_15(symbol);
if (typeof state_5 === "object")
return state_5.value;
var state_6 = _loop_16(symbol);
if (typeof state_6 === "object")
return state_6.value;
}
return commonDeclarations;
}
@ -52480,7 +52528,7 @@ var ts;
function getIndexInfosOfIndexSymbol(indexSymbol) {
if (indexSymbol.declarations) {
var indexInfos_4 = [];
var _loop_16 = function (declaration) {
var _loop_17 = function (declaration) {
if (declaration.parameters.length === 1) {
var parameter = declaration.parameters[0];
if (parameter.type) {
@ -52494,7 +52542,7 @@ var ts;
};
for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
_loop_16(declaration);
_loop_17(declaration);
}
return indexInfos_4;
}
@ -52511,7 +52559,7 @@ var ts;
var _a;
var inferences;
if ((_a = typeParameter.symbol) === null || _a === void 0 ? void 0 : _a.declarations) {
var _loop_17 = function (declaration) {
var _loop_18 = function (declaration) {
if (declaration.parent.kind === 194) {
var _c = ts.walkUpParenthesizedTypesAndGetParentAndChild(declaration.parent.parent), _d = _c[0], childTypeParameter = _d === void 0 ? declaration.parent : _d, grandParent = _c[1];
if (grandParent.kind === 182 && !omitTypeReferences) {
@ -52556,7 +52604,7 @@ var ts;
};
for (var _i = 0, _b = typeParameter.symbol.declarations; _i < _b.length; _i++) {
var declaration = _b[_i];
_loop_17(declaration);
_loop_18(declaration);
}
}
return inferences && getIntersectionType(inferences);
@ -53375,7 +53423,7 @@ var ts;
var lastRequiredIndex = -1;
var firstRestIndex = -1;
var lastOptionalOrRestIndex = -1;
var _loop_18 = function (i) {
var _loop_19 = function (i) {
var type = elementTypes[i];
var flags = target.elementFlags[i];
if (flags & 8) {
@ -53401,9 +53449,9 @@ var ts;
}
};
for (var i = 0; i < elementTypes.length; i++) {
var state_6 = _loop_18(i);
if (typeof state_6 === "object")
return state_6.value;
var state_7 = _loop_19(i);
if (typeof state_7 === "object")
return state_7.value;
}
for (var i = 0; i < lastRequiredIndex; i++) {
if (expandedFlags[i] & 2)
@ -53578,7 +53626,7 @@ var ts;
var templates = ts.filter(types, isPatternLiteralType);
if (templates.length) {
var i = types.length;
var _loop_19 = function () {
var _loop_20 = function () {
i--;
var t = types[i];
if (t.flags & 128 && ts.some(templates, function (template) { return isTypeMatchedByTemplateLiteralType(t, template); })) {
@ -53586,7 +53634,7 @@ var ts;
}
};
while (i > 0) {
_loop_19();
_loop_20();
}
}
}
@ -53656,14 +53704,14 @@ var ts;
var namedUnions = [];
addNamedUnions(namedUnions, types);
var reducedTypes = [];
var _loop_20 = function (t) {
var _loop_21 = function (t) {
if (!ts.some(namedUnions, function (union) { return containsType(union.types, t); })) {
reducedTypes.push(t);
}
};
for (var _i = 0, typeSet_1 = typeSet; _i < typeSet_1.length; _i++) {
var t = typeSet_1[_i];
_loop_20(t);
_loop_21(t);
}
if (!aliasSymbol && namedUnions.length === 1 && reducedTypes.length === 0) {
return namedUnions[0];
@ -57183,7 +57231,7 @@ var ts;
reducedTarget = findMatchingDiscriminantType(source, target, isRelatedTo) || filterPrimitivesIfContainsNonPrimitive(target);
checkTypes = reducedTarget.flags & 1048576 ? reducedTarget.types : [reducedTarget];
}
var _loop_21 = function (prop) {
var _loop_22 = function (prop) {
if (shouldCheckAsExcessProperty(prop, source.symbol) && !isIgnoredJsxProperty(source, prop)) {
if (!isKnownProperty(reducedTarget, prop.escapedName, isComparingJsxAttributes)) {
if (reportErrors) {
@ -57236,9 +57284,9 @@ var ts;
};
for (var _i = 0, _b = getPropertiesOfType(source); _i < _b.length; _i++) {
var prop = _b[_i];
var state_7 = _loop_21(prop);
if (typeof state_7 === "object")
return state_7.value;
var state_8 = _loop_22(prop);
if (typeof state_8 === "object")
return state_8.value;
}
return false;
}
@ -58019,11 +58067,11 @@ var ts;
}
var discriminantCombinations = ts.cartesianProduct(sourceDiscriminantTypes);
var matchingTypes = [];
var _loop_22 = function (combination) {
var _loop_23 = function (combination) {
var hasMatch = false;
outer: for (var _c = 0, _d = target.types; _c < _d.length; _c++) {
var type = _d[_c];
var _loop_23 = function (i) {
var _loop_24 = function (i) {
var sourceProperty = sourcePropertiesFiltered[i];
var targetProperty = getPropertyOfType(type, sourceProperty.escapedName);
if (!targetProperty)
@ -58036,8 +58084,8 @@ var ts;
}
};
for (var i = 0; i < sourcePropertiesFiltered.length; i++) {
var state_9 = _loop_23(i);
switch (state_9) {
var state_10 = _loop_24(i);
switch (state_10) {
case "continue-outer": continue outer;
}
}
@ -58050,9 +58098,9 @@ var ts;
};
for (var _a = 0, discriminantCombinations_1 = discriminantCombinations; _a < discriminantCombinations_1.length; _a++) {
var combination = discriminantCombinations_1[_a];
var state_8 = _loop_22(combination);
if (typeof state_8 === "object")
return state_8.value;
var state_9 = _loop_23(combination);
if (typeof state_9 === "object")
return state_9.value;
}
var result = -1;
for (var _b = 0, matchingTypes_1 = matchingTypes; _b < matchingTypes_1.length; _b++) {
@ -58694,7 +58742,7 @@ var ts;
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes", "getVariancesWorker", { arity: typeParameters.length, id: getTypeId(getDeclaredTypeOfSymbol(symbol)) });
links.variances = ts.emptyArray;
var variances = [];
var _loop_24 = function (tp) {
var _loop_25 = function (tp) {
var modifiers = getVarianceModifiers(tp);
var variance = modifiers & 65536 ?
modifiers & 32768 ? 0 : 1 :
@ -58725,7 +58773,7 @@ var ts;
};
for (var _i = 0, typeParameters_2 = typeParameters; _i < typeParameters_2.length; _i++) {
var tp = typeParameters_2[_i];
_loop_24(tp);
_loop_25(tp);
}
links.variances = variances;
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop({ variances: variances.map(ts.Debug.formatVariance) });
@ -60370,7 +60418,7 @@ var ts;
var matches = inferTypesFromTemplateLiteralType(source, target);
var types = target.types;
if (matches || ts.every(target.texts, function (s) { return s.length === 0; })) {
var _loop_25 = function (i) {
var _loop_26 = function (i) {
var source_1 = matches ? matches[i] : neverType;
var target_3 = types[i];
if (source_1.flags & 128 && target_3.flags & 8650752) {
@ -60414,7 +60462,7 @@ var ts;
inferFromTypes(source_1, target_3);
};
for (var i = 0; i < types.length; i++) {
_loop_25(i);
_loop_26(i);
}
}
}
@ -60894,7 +60942,7 @@ var ts;
function mapTypesByKeyProperty(types, name) {
var map = new ts.Map();
var count = 0;
var _loop_26 = function (type) {
var _loop_27 = function (type) {
if (type.flags & (524288 | 2097152 | 58982400)) {
var discriminant = getTypeOfPropertyOfType(type, name);
if (discriminant) {
@ -60920,9 +60968,9 @@ var ts;
};
for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
var type = types_15[_i];
var state_10 = _loop_26(type);
if (typeof state_10 === "object")
return state_10.value;
var state_11 = _loop_27(type);
if (typeof state_11 === "object")
return state_11.value;
}
return count >= 10 && count * 2 >= types.length ? map : undefined;
}
@ -66514,7 +66562,7 @@ var ts;
var spreadIndex = getSpreadArgumentIndex(args);
if (spreadIndex >= 0) {
var effectiveArgs_1 = args.slice(0, spreadIndex);
var _loop_27 = function (i) {
var _loop_28 = function (i) {
var arg = args[i];
var spreadType = arg.kind === 230 && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression));
if (spreadType && isTupleType(spreadType)) {
@ -66530,7 +66578,7 @@ var ts;
}
};
for (var i = spreadIndex; i < args.length; i++) {
_loop_27(i);
_loop_28(i);
}
return effectiveArgs_1;
}
@ -66803,7 +66851,7 @@ var ts;
var min_3 = Number.MAX_VALUE;
var minIndex = 0;
var i_1 = 0;
var _loop_28 = function (c) {
var _loop_29 = function (c) {
var chain_2 = function () { return ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Overload_0_of_1_2_gave_the_following_error, i_1 + 1, candidates.length, signatureToString(c)); };
var diags_2 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0, true, chain_2);
if (diags_2) {
@ -66821,7 +66869,7 @@ var ts;
};
for (var _a = 0, candidatesForArgumentError_1 = candidatesForArgumentError; _a < candidatesForArgumentError_1.length; _a++) {
var c = candidatesForArgumentError_1[_a];
_loop_28(c);
_loop_29(c);
}
var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics);
ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures");
@ -66964,7 +67012,7 @@ var ts;
}
var _a = ts.minAndMax(candidates, getNumNonRestParameters), minArgumentCount = _a.min, maxNonRestParam = _a.max;
var parameters = [];
var _loop_29 = function (i) {
var _loop_30 = function (i) {
var symbols = ts.mapDefined(candidates, function (s) { return signatureHasRestParameter(s) ?
i < s.parameters.length - 1 ? s.parameters[i] : ts.last(s.parameters) :
i < s.parameters.length ? s.parameters[i] : undefined; });
@ -66972,7 +67020,7 @@ var ts;
parameters.push(createCombinedSymbolFromTypes(symbols, ts.mapDefined(candidates, function (candidate) { return tryGetTypeAtPosition(candidate, i); })));
};
for (var i = 0; i < maxNonRestParam; i++) {
_loop_29(i);
_loop_30(i);
}
var restParameterSymbols = ts.mapDefined(candidates, function (c) { return signatureHasRestParameter(c) ? ts.last(c.parameters) : undefined; });
var flags = 0;
@ -67786,7 +67834,7 @@ var ts;
}
function expressionCheckByJsDoc(declaration, node, sourceFile, checkConfig) {
var jsDocTags = ts.getJSDocTags(declaration);
var _loop_30 = function (i) {
var _loop_31 = function (i) {
var config = checkConfig[i];
var tagNameCheckNecessity = true;
if (config.checkJsDocSpecialValidCallback) {
@ -67819,7 +67867,7 @@ var ts;
}
};
for (var i = 0; i < checkConfig.length; i++) {
_loop_30(i);
_loop_31(i);
}
}
function collectDiagnostics(config, node, diagnostic) {
@ -70947,7 +70995,7 @@ var ts;
var indexSymbol = getIndexSymbol(getSymbolOfNode(node));
if (indexSymbol === null || indexSymbol === void 0 ? void 0 : indexSymbol.declarations) {
var indexSignatureMap_1 = new ts.Map();
var _loop_31 = function (declaration) {
var _loop_32 = function (declaration) {
if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
forEachType(getTypeFromTypeNode(declaration.parameters[0].type), function (type) {
var entry = indexSignatureMap_1.get(getTypeId(type));
@ -70962,7 +71010,7 @@ var ts;
};
for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
_loop_31(declaration);
_loop_32(declaration);
}
indexSignatureMap_1.forEach(function (entry) {
if (entry.declarations.length > 1) {
@ -73943,7 +73991,7 @@ var ts;
var propDeclaration = declaration && declaration.kind === 226 ||
name && name.kind === 166 ? declaration : undefined;
var localPropDeclaration = getParentOfSymbol(prop) === type.symbol ? declaration : undefined;
var _loop_32 = function (info) {
var _loop_33 = function (info) {
var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
var errorNode = localPropDeclaration || localIndexDeclaration ||
(interfaceDeclaration && !ts.some(getBaseTypes(type), function (base) { return !!getPropertyOfObjectType(base, prop.escapedName) && !!getIndexTypeOfType(base, info.keyType); }) ? interfaceDeclaration : undefined);
@ -73957,7 +74005,7 @@ var ts;
};
for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) {
var info = indexInfos_9[_i];
_loop_32(info);
_loop_33(info);
}
}
function checkIndexConstraintForIndexSignature(type, checkInfo) {
@ -73965,7 +74013,7 @@ var ts;
var indexInfos = getApplicableIndexInfos(type, checkInfo.keyType);
var interfaceDeclaration = ts.getObjectFlags(type) & 2 ? ts.getDeclarationOfKind(type.symbol, 265) : undefined;
var localCheckDeclaration = declaration && getParentOfSymbol(getSymbolOfNode(declaration)) === type.symbol ? declaration : undefined;
var _loop_33 = function (info) {
var _loop_34 = function (info) {
if (info === checkInfo)
return "continue";
var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
@ -73977,7 +74025,7 @@ var ts;
};
for (var _i = 0, indexInfos_10 = indexInfos; _i < indexInfos_10.length; _i++) {
var info = indexInfos_10[_i];
_loop_33(info);
_loop_34(info);
}
}
function checkTypeNameIsReserved(name, message) {
@ -74292,7 +74340,7 @@ var ts;
var baseTypes = baseTypeNode && getBaseTypes(type);
var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined;
var baseStaticType = getBaseConstructorTypeOfClass(type);
var _loop_34 = function (member) {
var _loop_35 = function (member) {
if (ts.hasAmbientModifier(member)) {
return "continue";
}
@ -74307,7 +74355,7 @@ var ts;
};
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
var member = _a[_i];
_loop_34(member);
_loop_35(member);
}
}
function checkExistingMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, member, memberIsParameterProperty, reportErrors) {
@ -74382,7 +74430,7 @@ var ts;
}
function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) {
var issuedMemberError = false;
var _loop_35 = function (member) {
var _loop_36 = function (member) {
if (ts.isStatic(member)) {
return "continue";
}
@ -74400,7 +74448,7 @@ var ts;
};
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
var member = _a[_i];
_loop_35(member);
_loop_36(member);
}
if (!issuedMemberError) {
checkTypeAssignableTo(typeWithThis, baseWithThis, node.name || node, broadDiag);
@ -74447,7 +74495,7 @@ var ts;
function checkKindsOfPropertyMemberOverrides(type, baseType) {
var _a, _b, _c, _d;
var baseProperties = getPropertiesOfType(baseType);
var _loop_36 = function (baseProperty) {
var _loop_37 = function (baseProperty) {
var base = getTargetSymbol(baseProperty);
if (base.flags & 4194304) {
return "continue";
@ -74545,8 +74593,8 @@ var ts;
};
basePropertyCheck: for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {
var baseProperty = baseProperties_1[_i];
var state_11 = _loop_36(baseProperty);
switch (state_11) {
var state_12 = _loop_37(baseProperty);
switch (state_12) {
case "continue-basePropertyCheck": continue basePropertyCheck;
}
}
@ -106370,7 +106418,7 @@ var ts;
importedFileFromNodeModules = importedFileFromNodeModules || isInNodeModules;
});
var sortedPaths = [];
var _loop_37 = function (directory) {
var _loop_38 = function (directory) {
var directoryStart = ts.ensureTrailingDirectorySeparator(directory);
var pathsInDirectory;
allFileNames.forEach(function (_a, fileName) {
@ -106394,9 +106442,9 @@ var ts;
};
var out_directory_1;
for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
var state_12 = _loop_37(directory);
var state_13 = _loop_38(directory);
directory = out_directory_1;
if (state_12 === "break")
if (state_13 === "break")
break;
}
if (allFileNames.size) {
@ -106455,7 +106503,7 @@ var ts;
}
function tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions) {
for (var key in paths) {
var _loop_38 = function (patternText_1) {
var _loop_39 = function (patternText_1) {
var pattern = ts.normalizePath(patternText_1);
var indexOfStar = pattern.indexOf("*");
var candidates = allowedEndings.map(function (ending) { return ({
@ -106486,9 +106534,9 @@ var ts;
};
for (var _i = 0, _a = paths[key]; _i < _a.length; _i++) {
var patternText_1 = _a[_i];
var state_13 = _loop_38(patternText_1);
if (typeof state_13 === "object")
return state_13.value;
var state_14 = _loop_39(patternText_1);
if (typeof state_14 === "object")
return state_14.value;
}
}
function validateEnding(_a) {

View File

@ -4648,6 +4648,8 @@ var ts;
EtsFlags[EtsFlags["EtsStateStylesContext"] = 64] = "EtsStateStylesContext";
EtsFlags[EtsFlags["EtsComponentsContext"] = 128] = "EtsComponentsContext";
EtsFlags[EtsFlags["EtsNewExpressionContext"] = 256] = "EtsNewExpressionContext";
EtsFlags[EtsFlags["UICallbackContext"] = 512] = "UICallbackContext";
EtsFlags[EtsFlags["SyntaxComponentContext"] = 1024] = "SyntaxComponentContext";
})(EtsFlags = ts.EtsFlags || (ts.EtsFlags = {}));
var ModifierFlags;
(function (ModifierFlags) {
@ -17782,6 +17784,18 @@ var ts;
return undefined;
}
ts.getRootEtsComponent = getRootEtsComponent;
function getRootComponent(node, compilerOptions) {
var _a, _b, _c;
while (node) {
if (ts.isEtsComponentExpression(node) || ts.isCallExpression(node) && ts.isIdentifier(node.expression) &&
((_c = (_b = (_a = compilerOptions.ets) === null || _a === void 0 ? void 0 : _a.syntaxComponents) === null || _b === void 0 ? void 0 : _b.attrUICallback) === null || _c === void 0 ? void 0 : _c.map(function (item) { return item.name; }).includes(node.expression.escapedText.toString()))) {
return node;
}
node = node.expression;
}
return undefined;
}
ts.getRootComponent = getRootComponent;
function getVirtualEtsComponent(node) {
while (node) {
if (ts.isPropertyAccessExpression(node) && node.expression && node.expression.virtual) {
@ -32992,6 +33006,12 @@ var ts;
function setEtsStateStylesContext(val) {
setEtsFlag(val, 64 /* EtsFlags.EtsStateStylesContext */);
}
function setUICallbackContext(val) {
setEtsFlag(val, 512 /* EtsFlags.UICallbackContext */);
}
function setSyntaxComponentContext(val) {
setEtsFlag(val, 1024 /* EtsFlags.SyntaxComponentContext */);
}
function doOutsideOfContext(context, func) {
// contextFlagsToClear will contain only the context flags that are
// currently set that we need to temporarily clear
@ -33122,6 +33142,12 @@ var ts;
function inEtsStateStylesContext() {
return inEtsContext() && (inBuildContext() || inBuilderContext() || inEtsExtendComponentsContext() || inEtsStylesComponentsContext()) && inEtsFlagsContext(64 /* EtsFlags.EtsStateStylesContext */);
}
function inUICallbackContext() {
return inEtsContext() && (inBuildContext() || inBuilderContext()) && inEtsFlagsContext(512 /* EtsFlags.UICallbackContext */);
}
function inSyntaxComponentContext() {
return inEtsContext() && (inBuildContext() || inBuilderContext()) && inEtsFlagsContext(1024 /* EtsFlags.SyntaxComponentContext */);
}
function parseErrorAtPosition(start, length, message, arg0) {
// Don't report another error if it would just be at the same position as the last error.
var lastError = ts.lastOrUndefined(parseDiagnostics);
@ -35663,7 +35689,7 @@ var ts;
return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher(allowReturnTypeInArrowFunction), pos);
}
// It's a CallExpression with open brace followed, therefore, we think it's an EtsComponentExpression
if ((inStructContext() || inBuildContext() || inBuilderContext()) && ts.isCallExpression(expr) && token() === 18 /* SyntaxKind.OpenBraceToken */) {
if ((inBuildContext() || inBuilderContext()) && inUICallbackContext() && ts.isCallExpression(expr) && token() === 18 /* SyntaxKind.OpenBraceToken */) {
return makeEtsComponentExpression(expr, pos);
}
// It wasn't an assignment or a lambda. This is a conditional expression:
@ -35986,9 +36012,13 @@ var ts;
// have an opening brace, just in case we're in an error state.
var lastToken = token();
var equalsGreaterThanToken = parseExpectedToken(38 /* SyntaxKind.EqualsGreaterThanToken */);
var originUIContextFlag = inUICallbackContext();
setUICallbackContext(inSyntaxComponentContext() ? true : false);
setSyntaxComponentContext(false);
var body = (lastToken === 38 /* SyntaxKind.EqualsGreaterThanToken */ || lastToken === 18 /* SyntaxKind.OpenBraceToken */)
? parseArrowFunctionExpressionBody(ts.some(modifiers, ts.isAsyncModifier), allowReturnTypeInArrowFunction)
: parseIdentifier();
setUICallbackContext(originUIContextFlag);
// Given:
// x ? y => ({ y }) : z => ({ z })
// We try to parse the body of the first arrow function by looking at:
@ -36864,9 +36894,9 @@ var ts;
return finishNode(tagExpression, pos);
}
function parseCallExpressionRest(pos, expression) {
var _a, _b, _c, _d, _e, _f;
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
var currentNodeName;
while (true) {
var _loop_5 = function () {
expression = parseMemberExpressionRest(pos, expression, /*allowOptionalChain*/ true);
var typeArguments = void 0;
var questionDotToken = parseOptionalToken(28 /* SyntaxKind.QuestionDotToken */);
@ -36874,7 +36904,7 @@ var ts;
typeArguments = tryParse(parseTypeArgumentsInExpression);
if (isTemplateStartOfTaggedTemplate()) {
expression = parseTaggedTemplateRest(pos, expression, questionDotToken, typeArguments);
continue;
return "continue";
}
}
if (typeArguments || token() === 20 /* SyntaxKind.OpenParenToken */) {
@ -36884,19 +36914,27 @@ var ts;
expression = expression.expression;
}
if (isValidVirtualTypeArgumentsContext() && ts.isPropertyAccessExpression(expression)) {
var rootNode = ts.getRootEtsComponent(expression);
var rootNode = ts.getRootComponent(expression, sourceFileCompilerOptions);
if (rootNode) {
var rootNodeName = (rootNode.expression).escapedText.toString();
var rootNodeName_1 = (rootNode.expression).escapedText.toString();
currentNodeName = ts.getTextOfPropertyName(expression.name).toString();
if (currentNodeName === ((_b = (_a = sourceFileCompilerOptions === null || sourceFileCompilerOptions === void 0 ? void 0 : sourceFileCompilerOptions.ets) === null || _a === void 0 ? void 0 : _a.styles) === null || _b === void 0 ? void 0 : _b.property)) {
setEtsStateStylesContext(true);
stateStylesRootNode = rootNodeName;
stateStylesRootNode = rootNodeName_1;
}
else {
setEtsStateStylesContext(false);
stateStylesRootNode = undefined;
}
typeArguments = parseEtsTypeArguments(pos, "".concat(rootNodeName, "Attribute"));
if ((_e = (_d = (_c = sourceFileCompilerOptions === null || sourceFileCompilerOptions === void 0 ? void 0 : sourceFileCompilerOptions.ets) === null || _c === void 0 ? void 0 : _c.syntaxComponents) === null || _d === void 0 ? void 0 : _d.attrUICallback) === null || _e === void 0 ? void 0 : _e.map(function (item) { return item.name; }).includes(rootNodeName_1)) {
var syntaxComponents = (_h = (_g = (_f = sourceFileCompilerOptions === null || sourceFileCompilerOptions === void 0 ? void 0 : sourceFileCompilerOptions.ets) === null || _f === void 0 ? void 0 : _f.syntaxComponents) === null || _g === void 0 ? void 0 : _g.attrUICallback) === null || _h === void 0 ? void 0 : _h.filter(function (item) { return item.name === rootNodeName_1; });
if (syntaxComponents.length && ((_k = (_j = syntaxComponents[0]) === null || _j === void 0 ? void 0 : _j.attributes) === null || _k === void 0 ? void 0 : _k.includes(currentNodeName))) {
setSyntaxComponentContext(true);
}
}
else {
typeArguments = parseEtsTypeArguments(pos, "".concat(rootNodeName_1, "Attribute"));
}
}
else if (inEtsStateStylesContext() && stateStylesRootNode) {
typeArguments = parseEtsTypeArguments(pos, "".concat(stateStylesRootNode, "Attribute"));
@ -36906,7 +36944,7 @@ var ts;
if (virtualNode) {
var rootNodeName = (virtualNode.expression).escapedText.toString();
currentNodeName = ts.getTextOfPropertyName(expression.name).toString();
if (currentNodeName === ((_d = (_c = sourceFileCompilerOptions === null || sourceFileCompilerOptions === void 0 ? void 0 : sourceFileCompilerOptions.ets) === null || _c === void 0 ? void 0 : _c.styles) === null || _d === void 0 ? void 0 : _d.property)) {
if (currentNodeName === ((_m = (_l = sourceFileCompilerOptions === null || sourceFileCompilerOptions === void 0 ? void 0 : sourceFileCompilerOptions.ets) === null || _l === void 0 ? void 0 : _l.styles) === null || _m === void 0 ? void 0 : _m.property)) {
setEtsStateStylesContext(true);
rootNodeName = rootNodeName.replace("Instance", "");
stateStylesRootNode = rootNodeName;
@ -36915,21 +36953,30 @@ var ts;
}
}
}
if (isValidVirtualTypeArgumentsContext() && ts.isIdentifier(expression) &&
((_q = (_p = (_o = sourceFileCompilerOptions === null || sourceFileCompilerOptions === void 0 ? void 0 : sourceFileCompilerOptions.ets) === null || _o === void 0 ? void 0 : _o.syntaxComponents) === null || _p === void 0 ? void 0 : _p.paramsUICallback) === null || _q === void 0 ? void 0 : _q.includes(expression.escapedText.toString()))) {
setSyntaxComponentContext(true);
}
var argumentList = parseArgumentList();
var callExpr = questionDotToken || tryReparseOptionalChain(expression) ?
factory.createCallChain(expression, questionDotToken, typeArguments, argumentList) :
factory.createCallExpression(expression, typeArguments, argumentList);
expression = finishNode(callExpr, pos);
continue;
return "continue";
}
if (questionDotToken) {
// We parsed `?.` but then failed to parse anything, so report a missing identifier here.
var name = createMissingNode(79 /* SyntaxKind.Identifier */, /*reportAtCurrentPosition*/ false, ts.Diagnostics.Identifier_expected);
expression = finishNode(factory.createPropertyAccessChain(expression, questionDotToken, name), pos);
}
break;
return "break";
};
while (true) {
var state_2 = _loop_5();
if (state_2 === "break")
break;
}
if (currentNodeName === ((_f = (_e = sourceFileCompilerOptions === null || sourceFileCompilerOptions === void 0 ? void 0 : sourceFileCompilerOptions.ets) === null || _e === void 0 ? void 0 : _e.styles) === null || _f === void 0 ? void 0 : _f.property)) {
if (currentNodeName === ((_s = (_r = sourceFileCompilerOptions === null || sourceFileCompilerOptions === void 0 ? void 0 : sourceFileCompilerOptions.ets) === null || _r === void 0 ? void 0 : _r.styles) === null || _s === void 0 ? void 0 : _s.property)) {
setEtsStateStylesContext(false);
stateStylesRootNode = undefined;
}
@ -38061,8 +38108,10 @@ var ts;
var methodName = (_a = ts.getPropertyNameForPropertyNameNode(name)) === null || _a === void 0 ? void 0 : _a.toString();
var orignalEtsBuildContext = inBuildContext();
var orignalEtsBuilderContext = inBuilderContext();
var orignalUICallbackContext = inUICallbackContext();
setEtsBuildContext(methodName === ((_d = (_c = (_b = sourceFileCompilerOptions === null || sourceFileCompilerOptions === void 0 ? void 0 : sourceFileCompilerOptions.ets) === null || _b === void 0 ? void 0 : _b.render) === null || _c === void 0 ? void 0 : _c.method) === null || _d === void 0 ? void 0 : _d.find(function (render) { return render === "build"; })));
setEtsBuilderContext(ts.hasEtsBuilderDecoratorNames(decorators, sourceFileCompilerOptions));
setUICallbackContext(inBuildContext() || inBuilderContext());
if (inStructContext() && ts.hasEtsStylesDecoratorNames(decorators, sourceFileCompilerOptions)) {
if (methodName && currentStructName) {
structStylesComponents.set(methodName, { structName: currentStructName, kind: 173 /* SyntaxKind.MethodDeclaration */ });
@ -38088,6 +38137,7 @@ var ts;
node.exclamationToken = exclamationToken;
setEtsBuildContext(orignalEtsBuildContext);
setEtsBuilderContext(orignalEtsBuilderContext);
setUICallbackContext(orignalUICallbackContext);
setEtsStylesComponentsContext(false);
stylesEtsComponentDeclaration = undefined;
setEtsComponentsContext(orignalEtsComponentsContext);
@ -42715,7 +42765,7 @@ var ts;
}
function convertObjectLiteralExpressionToJson(node, knownOptions, extraKeyDiagnostics, parentOption) {
var result = returnValue ? {} : undefined;
var _loop_5 = function (element) {
var _loop_6 = function (element) {
if (element.kind !== 303 /* SyntaxKind.PropertyAssignment */) {
errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, element, ts.Diagnostics.Property_assignment_expected));
return "continue";
@ -42768,7 +42818,7 @@ var ts;
};
for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
var element = _a[_i];
_loop_5(element);
_loop_6(element);
}
return result;
}
@ -42969,7 +43019,7 @@ var ts;
var optionsNameMap = _a.optionsNameMap;
var result = new ts.Map();
var getCanonicalFileName = pathOptions && ts.createGetCanonicalFileName(pathOptions.useCaseSensitiveFileNames);
var _loop_6 = function (name) {
var _loop_7 = function (name) {
if (ts.hasProperty(options, name)) {
// tsconfig only options cannot be specified via command line,
// so we can assume that only types that can appear here string | number | boolean
@ -43003,7 +43053,7 @@ var ts;
}
};
for (var name in options) {
_loop_6(name);
_loop_7(name);
}
return result;
}
@ -43777,7 +43827,7 @@ var ts;
}
var jsonOnlyIncludeRegexes;
if (validatedIncludeSpecs && validatedIncludeSpecs.length > 0) {
var _loop_7 = function (file) {
var _loop_8 = function (file) {
if (ts.fileExtensionIs(file, ".json" /* Extension.Json */)) {
// Valid only if *.json specified
if (!jsonOnlyIncludeRegexes) {
@ -43815,7 +43865,7 @@ var ts;
};
for (var _a = 0, _b = host.readDirectory(basePath, ts.flatten(supportedExtensionsWithJsonIfResolveJsonModule), validatedExcludeSpecs, validatedIncludeSpecs, /*depth*/ undefined); _a < _b.length; _a++) {
var file = _b[_a];
_loop_7(file);
_loop_8(file);
}
}
var literalFiles = ts.arrayFrom(literalFileMap.values());
@ -47232,7 +47282,7 @@ var ts;
break;
// 5. other uninstantiated module declarations.
case 269 /* SyntaxKind.ModuleBlock */: {
var state_2 = 0 /* ModuleInstanceState.NonInstantiated */;
var state_3 = 0 /* ModuleInstanceState.NonInstantiated */;
ts.forEachChild(node, function (n) {
var childState = getModuleInstanceStateCached(n, visited);
switch (childState) {
@ -47241,17 +47291,17 @@ var ts;
return;
case 2 /* ModuleInstanceState.ConstEnumOnly */:
// child is const enum only - record state and continue searching
state_2 = 2 /* ModuleInstanceState.ConstEnumOnly */;
state_3 = 2 /* ModuleInstanceState.ConstEnumOnly */;
return;
case 1 /* ModuleInstanceState.Instantiated */:
// child is instantiated - record state and stop
state_2 = 1 /* ModuleInstanceState.Instantiated */;
state_3 = 1 /* ModuleInstanceState.Instantiated */;
return true;
default:
ts.Debug.assertNever(childState);
}
});
return state_2;
return state_3;
}
case 268 /* SyntaxKind.ModuleDeclaration */:
return getModuleInstanceState(node, visited);
@ -51917,7 +51967,7 @@ var ts;
function addDuplicateDeclarationError(node, message, symbolName, relatedNodes) {
var errorNode = (ts.getExpandoInitializer(node, /*isPrototypeAssignment*/ false) ? ts.getNameOfExpando(node) : ts.getNameOfDeclaration(node)) || node;
var err = lookupOrIssueError(errorNode, message, symbolName);
var _loop_8 = function (relatedNode) {
var _loop_9 = function (relatedNode) {
var adjustedNode = (ts.getExpandoInitializer(relatedNode, /*isPrototypeAssignment*/ false) ? ts.getNameOfExpando(relatedNode) : ts.getNameOfDeclaration(relatedNode)) || relatedNode;
if (adjustedNode === errorNode)
return "continue";
@ -51930,7 +51980,7 @@ var ts;
};
for (var _i = 0, _a = relatedNodes || ts.emptyArray; _i < _a.length; _i++) {
var relatedNode = _a[_i];
_loop_8(relatedNode);
_loop_9(relatedNode);
}
}
function combineSymbolTables(first, second) {
@ -54717,7 +54767,7 @@ var ts;
}
function forEachSymbolTableInScope(enclosingDeclaration, callback) {
var result;
var _loop_9 = function (location) {
var _loop_10 = function (location) {
// Locals of a source file are not in scope (because they get merged into the global symbol table)
if (location.locals && !isGlobalSourceFile(location)) {
if (result = callback(location.locals, /*ignoreQualification*/ undefined, /*isLocalNameLookup*/ true, location)) {
@ -54763,9 +54813,9 @@ var ts;
}
};
for (var location = enclosingDeclaration; location; location = location.parent) {
var state_3 = _loop_9(location);
if (typeof state_3 === "object")
return state_3.value;
var state_4 = _loop_10(location);
if (typeof state_4 === "object")
return state_4.value;
}
return callback(globals, /*ignoreQualification*/ undefined, /*isLocalNameLookup*/ true);
}
@ -57168,7 +57218,7 @@ var ts;
if (ts.length(reexports) > 1) {
var groups = ts.group(reexports, function (decl) { return ts.isStringLiteral(decl.moduleSpecifier) ? ">" + decl.moduleSpecifier.text : ">"; });
if (groups.length !== reexports.length) {
var _loop_10 = function (group_1) {
var _loop_11 = function (group_1) {
if (group_1.length > 1) {
// remove group members from statements and then merge group members and add back to statements
statements = __spreadArray(__spreadArray([], ts.filter(statements, function (s) { return group_1.indexOf(s) === -1; }), true), [
@ -57180,7 +57230,7 @@ var ts;
};
for (var _i = 0, groups_1 = groups; _i < groups_1.length; _i++) {
var group_1 = groups_1[_i];
_loop_10(group_1);
_loop_11(group_1);
}
}
}
@ -61071,7 +61121,7 @@ var ts;
// signatures from the type, whose ordering would be non-obvious)
var masterList = signatureLists[indexWithLengthOverOne !== undefined ? indexWithLengthOverOne : 0];
var results = masterList.slice();
var _loop_11 = function (signatures) {
var _loop_12 = function (signatures) {
if (signatures !== masterList) {
var signature_1 = signatures[0];
ts.Debug.assert(!!signature_1, "getUnionSignatures bails early on empty signature lists and should not have empty lists on second pass");
@ -61083,8 +61133,8 @@ var ts;
};
for (var _b = 0, signatureLists_1 = signatureLists; _b < signatureLists_1.length; _b++) {
var signatures = signatureLists_1[_b];
var state_4 = _loop_11(signatures);
if (state_4 === "break")
var state_5 = _loop_12(signatures);
if (state_5 === "break")
break;
}
result = results;
@ -61190,7 +61240,7 @@ var ts;
var sourceInfos = getIndexInfosOfType(types[0]);
if (sourceInfos) {
var result = [];
var _loop_12 = function (info) {
var _loop_13 = function (info) {
var indexType = info.keyType;
if (ts.every(types, function (t) { return !!getIndexInfoOfType(t, indexType); })) {
result.push(createIndexInfo(indexType, getUnionType(ts.map(types, function (t) { return getIndexTypeOfType(t, indexType); })), ts.some(types, function (t) { return getIndexInfoOfType(t, indexType).isReadonly; })));
@ -61198,7 +61248,7 @@ var ts;
};
for (var _i = 0, sourceInfos_1 = sourceInfos; _i < sourceInfos_1.length; _i++) {
var info = sourceInfos_1[_i];
_loop_12(info);
_loop_13(info);
}
return result;
}
@ -61245,7 +61295,7 @@ var ts;
var types = type.types;
var mixinFlags = findMixins(types);
var mixinCount = ts.countWhere(mixinFlags, function (b) { return b; });
var _loop_13 = function (i) {
var _loop_14 = function (i) {
var t = type.types[i];
// When an intersection type contains mixin constructor types, the construct signatures from
// those types are discarded and their return types are mixed into the return types of all
@ -61267,19 +61317,19 @@ var ts;
indexInfos = ts.reduceLeft(getIndexInfosOfType(t), function (infos, newInfo) { return appendIndexInfo(infos, newInfo, /*union*/ false); }, indexInfos);
};
for (var i = 0; i < types.length; i++) {
_loop_13(i);
_loop_14(i);
}
setStructuredTypeMembers(type, emptySymbols, callSignatures || ts.emptyArray, constructSignatures || ts.emptyArray, indexInfos || ts.emptyArray);
}
function appendSignatures(signatures, newSignatures) {
var _loop_14 = function (sig) {
var _loop_15 = function (sig) {
if (!signatures || ts.every(signatures, function (s) { return !compareSignaturesIdentical(s, sig, /*partialMatch*/ false, /*ignoreThisTypes*/ false, /*ignoreReturnTypes*/ false, compareTypesIdentical); })) {
signatures = ts.append(signatures, sig);
}
};
for (var _i = 0, newSignatures_1 = newSignatures; _i < newSignatures_1.length; _i++) {
var sig = newSignatures_1[_i];
_loop_14(sig);
_loop_15(sig);
}
return signatures;
}
@ -62300,7 +62350,7 @@ var ts;
}
function getCommonDeclarationsOfSymbols(symbols) {
var commonDeclarations;
var _loop_15 = function (symbol) {
var _loop_16 = function (symbol) {
if (!symbol.declarations) {
return { value: undefined };
}
@ -62319,9 +62369,9 @@ var ts;
};
for (var _i = 0, symbols_3 = symbols; _i < symbols_3.length; _i++) {
var symbol = symbols_3[_i];
var state_5 = _loop_15(symbol);
if (typeof state_5 === "object")
return state_5.value;
var state_6 = _loop_16(symbol);
if (typeof state_6 === "object")
return state_6.value;
}
return commonDeclarations;
}
@ -63039,7 +63089,7 @@ var ts;
function getIndexInfosOfIndexSymbol(indexSymbol) {
if (indexSymbol.declarations) {
var indexInfos_4 = [];
var _loop_16 = function (declaration) {
var _loop_17 = function (declaration) {
if (declaration.parameters.length === 1) {
var parameter = declaration.parameters[0];
if (parameter.type) {
@ -63053,7 +63103,7 @@ var ts;
};
for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
_loop_16(declaration);
_loop_17(declaration);
}
return indexInfos_4;
}
@ -63070,7 +63120,7 @@ var ts;
var _a;
var inferences;
if ((_a = typeParameter.symbol) === null || _a === void 0 ? void 0 : _a.declarations) {
var _loop_17 = function (declaration) {
var _loop_18 = function (declaration) {
if (declaration.parent.kind === 194 /* SyntaxKind.InferType */) {
// When an 'infer T' declaration is immediately contained in a type reference node
// (such as 'Foo<infer T>'), T's constraint is inferred from the constraint of the
@ -63134,7 +63184,7 @@ var ts;
};
for (var _i = 0, _b = typeParameter.symbol.declarations; _i < _b.length; _i++) {
var declaration = _b[_i];
_loop_17(declaration);
_loop_18(declaration);
}
}
return inferences && getIntersectionType(inferences);
@ -64034,7 +64084,7 @@ var ts;
var lastRequiredIndex = -1;
var firstRestIndex = -1;
var lastOptionalOrRestIndex = -1;
var _loop_18 = function (i) {
var _loop_19 = function (i) {
var type = elementTypes[i];
var flags = target.elementFlags[i];
if (flags & 8 /* ElementFlags.Variadic */) {
@ -64064,9 +64114,9 @@ var ts;
}
};
for (var i = 0; i < elementTypes.length; i++) {
var state_6 = _loop_18(i);
if (typeof state_6 === "object")
return state_6.value;
var state_7 = _loop_19(i);
if (typeof state_7 === "object")
return state_7.value;
}
// Turn optional elements preceding the last required element into required elements
for (var i = 0; i < lastRequiredIndex; i++) {
@ -64260,7 +64310,7 @@ var ts;
var templates = ts.filter(types, isPatternLiteralType);
if (templates.length) {
var i = types.length;
var _loop_19 = function () {
var _loop_20 = function () {
i--;
var t = types[i];
if (t.flags & 128 /* TypeFlags.StringLiteral */ && ts.some(templates, function (template) { return isTypeMatchedByTemplateLiteralType(t, template); })) {
@ -64268,7 +64318,7 @@ var ts;
}
};
while (i > 0) {
_loop_19();
_loop_20();
}
}
}
@ -64345,14 +64395,14 @@ var ts;
var namedUnions = [];
addNamedUnions(namedUnions, types);
var reducedTypes = [];
var _loop_20 = function (t) {
var _loop_21 = function (t) {
if (!ts.some(namedUnions, function (union) { return containsType(union.types, t); })) {
reducedTypes.push(t);
}
};
for (var _i = 0, typeSet_1 = typeSet; _i < typeSet_1.length; _i++) {
var t = typeSet_1[_i];
_loop_20(t);
_loop_21(t);
}
if (!aliasSymbol && namedUnions.length === 1 && reducedTypes.length === 0) {
return namedUnions[0];
@ -68309,7 +68359,7 @@ var ts;
reducedTarget = findMatchingDiscriminantType(source, target, isRelatedTo) || filterPrimitivesIfContainsNonPrimitive(target);
checkTypes = reducedTarget.flags & 1048576 /* TypeFlags.Union */ ? reducedTarget.types : [reducedTarget];
}
var _loop_21 = function (prop) {
var _loop_22 = function (prop) {
if (shouldCheckAsExcessProperty(prop, source.symbol) && !isIgnoredJsxProperty(source, prop)) {
if (!isKnownProperty(reducedTarget, prop.escapedName, isComparingJsxAttributes)) {
if (reportErrors) {
@ -68372,9 +68422,9 @@ var ts;
};
for (var _i = 0, _b = getPropertiesOfType(source); _i < _b.length; _i++) {
var prop = _b[_i];
var state_7 = _loop_21(prop);
if (typeof state_7 === "object")
return state_7.value;
var state_8 = _loop_22(prop);
if (typeof state_8 === "object")
return state_8.value;
}
return false;
}
@ -69384,11 +69434,11 @@ var ts;
// constituents of 'target'. If any combination does not have a match then 'source' is not relatable.
var discriminantCombinations = ts.cartesianProduct(sourceDiscriminantTypes);
var matchingTypes = [];
var _loop_22 = function (combination) {
var _loop_23 = function (combination) {
var hasMatch = false;
outer: for (var _c = 0, _d = target.types; _c < _d.length; _c++) {
var type = _d[_c];
var _loop_23 = function (i) {
var _loop_24 = function (i) {
var sourceProperty = sourcePropertiesFiltered[i];
var targetProperty = getPropertyOfType(type, sourceProperty.escapedName);
if (!targetProperty)
@ -69404,8 +69454,8 @@ var ts;
}
};
for (var i = 0; i < sourcePropertiesFiltered.length; i++) {
var state_9 = _loop_23(i);
switch (state_9) {
var state_10 = _loop_24(i);
switch (state_10) {
case "continue-outer": continue outer;
}
}
@ -69418,9 +69468,9 @@ var ts;
};
for (var _a = 0, discriminantCombinations_1 = discriminantCombinations; _a < discriminantCombinations_1.length; _a++) {
var combination = discriminantCombinations_1[_a];
var state_8 = _loop_22(combination);
if (typeof state_8 === "object")
return state_8.value;
var state_9 = _loop_23(combination);
if (typeof state_9 === "object")
return state_9.value;
}
// Compare the remaining non-discriminant properties of each match.
var result = -1 /* Ternary.True */;
@ -70125,7 +70175,7 @@ var ts;
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes" /* tracing.Phase.CheckTypes */, "getVariancesWorker", { arity: typeParameters.length, id: getTypeId(getDeclaredTypeOfSymbol(symbol)) });
links.variances = ts.emptyArray;
var variances = [];
var _loop_24 = function (tp) {
var _loop_25 = function (tp) {
var modifiers = getVarianceModifiers(tp);
var variance = modifiers & 65536 /* ModifierFlags.Out */ ?
modifiers & 32768 /* ModifierFlags.In */ ? 0 /* VarianceFlags.Invariant */ : 1 /* VarianceFlags.Covariant */ :
@ -70163,7 +70213,7 @@ var ts;
};
for (var _i = 0, typeParameters_2 = typeParameters; _i < typeParameters_2.length; _i++) {
var tp = typeParameters_2[_i];
_loop_24(tp);
_loop_25(tp);
}
links.variances = variances;
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop({ variances: variances.map(ts.Debug.formatVariance) });
@ -72123,7 +72173,7 @@ var ts;
// upon instantiation, would collapse all the placeholders to just 'string', and an assignment check might
// succeed. That would be a pointless and confusing outcome.
if (matches || ts.every(target.texts, function (s) { return s.length === 0; })) {
var _loop_25 = function (i) {
var _loop_26 = function (i) {
var source_1 = matches ? matches[i] : neverType;
var target_3 = types[i];
// If we are inferring from a string literal type to a type variable whose constraint includes one of the
@ -72173,7 +72223,7 @@ var ts;
inferFromTypes(source_1, target_3);
};
for (var i = 0; i < types.length; i++) {
_loop_25(i);
_loop_26(i);
}
}
}
@ -72702,7 +72752,7 @@ var ts;
function mapTypesByKeyProperty(types, name) {
var map = new ts.Map();
var count = 0;
var _loop_26 = function (type) {
var _loop_27 = function (type) {
if (type.flags & (524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */)) {
var discriminant = getTypeOfPropertyOfType(type, name);
if (discriminant) {
@ -72728,9 +72778,9 @@ var ts;
};
for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
var type = types_15[_i];
var state_10 = _loop_26(type);
if (typeof state_10 === "object")
return state_10.value;
var state_11 = _loop_27(type);
if (typeof state_11 === "object")
return state_11.value;
}
return count >= 10 && count * 2 >= types.length ? map : undefined;
}
@ -79277,7 +79327,7 @@ var ts;
if (spreadIndex >= 0) {
// Create synthetic arguments from spreads of tuple types.
var effectiveArgs_1 = args.slice(0, spreadIndex);
var _loop_27 = function (i) {
var _loop_28 = function (i) {
var arg = args[i];
// We can call checkExpressionCached because spread expressions never have a contextual type.
var spreadType = arg.kind === 230 /* SyntaxKind.SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression));
@ -79294,7 +79344,7 @@ var ts;
}
};
for (var i = spreadIndex; i < args.length; i++) {
_loop_27(i);
_loop_28(i);
}
return effectiveArgs_1;
}
@ -79646,7 +79696,7 @@ var ts;
var min_3 = Number.MAX_VALUE;
var minIndex = 0;
var i_1 = 0;
var _loop_28 = function (c) {
var _loop_29 = function (c) {
var chain_2 = function () { return ts.chainDiagnosticMessages(/*details*/ undefined, ts.Diagnostics.Overload_0_of_1_2_gave_the_following_error, i_1 + 1, candidates.length, signatureToString(c)); };
var diags_2 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0 /* CheckMode.Normal */, /*reportErrors*/ true, chain_2);
if (diags_2) {
@ -79664,7 +79714,7 @@ var ts;
};
for (var _a = 0, candidatesForArgumentError_1 = candidatesForArgumentError; _a < candidatesForArgumentError_1.length; _a++) {
var c = candidatesForArgumentError_1[_a];
_loop_28(c);
_loop_29(c);
}
var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics);
ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures");
@ -79822,7 +79872,7 @@ var ts;
}
var _a = ts.minAndMax(candidates, getNumNonRestParameters), minArgumentCount = _a.min, maxNonRestParam = _a.max;
var parameters = [];
var _loop_29 = function (i) {
var _loop_30 = function (i) {
var symbols = ts.mapDefined(candidates, function (s) { return signatureHasRestParameter(s) ?
i < s.parameters.length - 1 ? s.parameters[i] : ts.last(s.parameters) :
i < s.parameters.length ? s.parameters[i] : undefined; });
@ -79830,7 +79880,7 @@ var ts;
parameters.push(createCombinedSymbolFromTypes(symbols, ts.mapDefined(candidates, function (candidate) { return tryGetTypeAtPosition(candidate, i); })));
};
for (var i = 0; i < maxNonRestParam; i++) {
_loop_29(i);
_loop_30(i);
}
var restParameterSymbols = ts.mapDefined(candidates, function (c) { return signatureHasRestParameter(c) ? ts.last(c.parameters) : undefined; });
var flags = 0 /* SignatureFlags.None */;
@ -80777,7 +80827,7 @@ var ts;
}
function expressionCheckByJsDoc(declaration, node, sourceFile, checkConfig) {
var jsDocTags = ts.getJSDocTags(declaration);
var _loop_30 = function (i) {
var _loop_31 = function (i) {
var config = checkConfig[i];
var tagNameCheckNecessity = true;
if (config.checkJsDocSpecialValidCallback) {
@ -80810,7 +80860,7 @@ var ts;
}
};
for (var i = 0; i < checkConfig.length; i++) {
_loop_30(i);
_loop_31(i);
}
}
function collectDiagnostics(config, node, diagnostic) {
@ -84241,7 +84291,7 @@ var ts;
var indexSymbol = getIndexSymbol(getSymbolOfNode(node));
if (indexSymbol === null || indexSymbol === void 0 ? void 0 : indexSymbol.declarations) {
var indexSignatureMap_1 = new ts.Map();
var _loop_31 = function (declaration) {
var _loop_32 = function (declaration) {
if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
forEachType(getTypeFromTypeNode(declaration.parameters[0].type), function (type) {
var entry = indexSignatureMap_1.get(getTypeId(type));
@ -84256,7 +84306,7 @@ var ts;
};
for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
_loop_31(declaration);
_loop_32(declaration);
}
indexSignatureMap_1.forEach(function (entry) {
if (entry.declarations.length > 1) {
@ -87901,7 +87951,7 @@ var ts;
var propDeclaration = declaration && declaration.kind === 226 /* SyntaxKind.BinaryExpression */ ||
name && name.kind === 166 /* SyntaxKind.ComputedPropertyName */ ? declaration : undefined;
var localPropDeclaration = getParentOfSymbol(prop) === type.symbol ? declaration : undefined;
var _loop_32 = function (info) {
var _loop_33 = function (info) {
var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
// We check only when (a) the property is declared in the containing type, or (b) the applicable index signature is declared
// in the containing type, or (c) the containing type is an interface and no base interface contains both the property and
@ -87918,7 +87968,7 @@ var ts;
};
for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) {
var info = indexInfos_9[_i];
_loop_32(info);
_loop_33(info);
}
}
function checkIndexConstraintForIndexSignature(type, checkInfo) {
@ -87926,7 +87976,7 @@ var ts;
var indexInfos = getApplicableIndexInfos(type, checkInfo.keyType);
var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 265 /* SyntaxKind.InterfaceDeclaration */) : undefined;
var localCheckDeclaration = declaration && getParentOfSymbol(getSymbolOfNode(declaration)) === type.symbol ? declaration : undefined;
var _loop_33 = function (info) {
var _loop_34 = function (info) {
if (info === checkInfo)
return "continue";
var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
@ -87941,7 +87991,7 @@ var ts;
};
for (var _i = 0, indexInfos_10 = indexInfos; _i < indexInfos_10.length; _i++) {
var info = indexInfos_10[_i];
_loop_33(info);
_loop_34(info);
}
}
function checkTypeNameIsReserved(name, message) {
@ -88281,7 +88331,7 @@ var ts;
var baseTypes = baseTypeNode && getBaseTypes(type);
var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined;
var baseStaticType = getBaseConstructorTypeOfClass(type);
var _loop_34 = function (member) {
var _loop_35 = function (member) {
if (ts.hasAmbientModifier(member)) {
return "continue";
}
@ -88298,7 +88348,7 @@ var ts;
};
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
var member = _a[_i];
_loop_34(member);
_loop_35(member);
}
}
/**
@ -88386,7 +88436,7 @@ var ts;
function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) {
// iterate over all implemented properties and issue errors on each one which isn't compatible, rather than the class as a whole, if possible
var issuedMemberError = false;
var _loop_35 = function (member) {
var _loop_36 = function (member) {
if (ts.isStatic(member)) {
return "continue";
}
@ -88405,7 +88455,7 @@ var ts;
};
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
var member = _a[_i];
_loop_35(member);
_loop_36(member);
}
if (!issuedMemberError) {
// check again with diagnostics to generate a less-specific error
@ -88476,7 +88526,7 @@ var ts;
var _a, _b, _c, _d;
// NOTE: assignability is checked in checkClassDeclaration
var baseProperties = getPropertiesOfType(baseType);
var _loop_36 = function (baseProperty) {
var _loop_37 = function (baseProperty) {
var base = getTargetSymbol(baseProperty);
if (base.flags & 4194304 /* SymbolFlags.Prototype */) {
return "continue";
@ -88586,8 +88636,8 @@ var ts;
};
basePropertyCheck: for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {
var baseProperty = baseProperties_1[_i];
var state_11 = _loop_36(baseProperty);
switch (state_11) {
var state_12 = _loop_37(baseProperty);
switch (state_12) {
case "continue-basePropertyCheck": continue basePropertyCheck;
}
}
@ -127945,7 +127995,7 @@ var ts;
});
// Sort by paths closest to importing file Name directory
var sortedPaths = [];
var _loop_37 = function (directory) {
var _loop_38 = function (directory) {
var directoryStart = ts.ensureTrailingDirectorySeparator(directory);
var pathsInDirectory;
allFileNames.forEach(function (_a, fileName) {
@ -127969,9 +128019,9 @@ var ts;
};
var out_directory_1;
for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
var state_12 = _loop_37(directory);
var state_13 = _loop_38(directory);
directory = out_directory_1;
if (state_12 === "break")
if (state_13 === "break")
break;
}
if (allFileNames.size) {
@ -128040,7 +128090,7 @@ var ts;
}
function tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions) {
for (var key in paths) {
var _loop_38 = function (patternText_1) {
var _loop_39 = function (patternText_1) {
var pattern = ts.normalizePath(patternText_1);
var indexOfStar = pattern.indexOf("*");
// In module resolution, if `pattern` itself has an extension, a file with that extension is looked up directly,
@ -128107,9 +128157,9 @@ var ts;
};
for (var _i = 0, _a = paths[key]; _i < _a.length; _i++) {
var patternText_1 = _a[_i];
var state_13 = _loop_38(patternText_1);
if (typeof state_13 === "object")
return state_13.value;
var state_14 = _loop_39(patternText_1);
if (typeof state_14 === "object")
return state_14.value;
}
}
function validateEnding(_a) {

View File

@ -553,7 +553,9 @@ declare namespace ts {
EtsBuilderContext = 32,
EtsStateStylesContext = 64,
EtsComponentsContext = 128,
EtsNewExpressionContext = 256
EtsNewExpressionContext = 256,
UICallbackContext = 512,
SyntaxComponentContext = 1024
}
export enum ModifierFlags {
None = 0,
@ -3210,6 +3212,13 @@ declare namespace ts {
name: string;
emitParameters: boolean;
}[];
syntaxComponents: {
paramsUICallback: string[];
attrUICallback: {
name: string;
attributes: string[];
}[];
};
}
export interface WatchOptions {
watchFile?: WatchFileKind;
@ -9201,6 +9210,13 @@ declare namespace ts.server.protocol {
name: string;
emitParameters: boolean;
}[];
syntaxComponents: {
paramsUICallback: string[];
attrUICallback: {
name: string;
attributes: string[];
}[];
};
}
/**
* Completions request; value of command field is "completions".

View File

@ -4647,6 +4647,8 @@ var ts;
EtsFlags[EtsFlags["EtsStateStylesContext"] = 64] = "EtsStateStylesContext";
EtsFlags[EtsFlags["EtsComponentsContext"] = 128] = "EtsComponentsContext";
EtsFlags[EtsFlags["EtsNewExpressionContext"] = 256] = "EtsNewExpressionContext";
EtsFlags[EtsFlags["UICallbackContext"] = 512] = "UICallbackContext";
EtsFlags[EtsFlags["SyntaxComponentContext"] = 1024] = "SyntaxComponentContext";
})(EtsFlags = ts.EtsFlags || (ts.EtsFlags = {}));
var ModifierFlags;
(function (ModifierFlags) {
@ -17781,6 +17783,18 @@ var ts;
return undefined;
}
ts.getRootEtsComponent = getRootEtsComponent;
function getRootComponent(node, compilerOptions) {
var _a, _b, _c;
while (node) {
if (ts.isEtsComponentExpression(node) || ts.isCallExpression(node) && ts.isIdentifier(node.expression) &&
((_c = (_b = (_a = compilerOptions.ets) === null || _a === void 0 ? void 0 : _a.syntaxComponents) === null || _b === void 0 ? void 0 : _b.attrUICallback) === null || _c === void 0 ? void 0 : _c.map(function (item) { return item.name; }).includes(node.expression.escapedText.toString()))) {
return node;
}
node = node.expression;
}
return undefined;
}
ts.getRootComponent = getRootComponent;
function getVirtualEtsComponent(node) {
while (node) {
if (ts.isPropertyAccessExpression(node) && node.expression && node.expression.virtual) {
@ -32991,6 +33005,12 @@ var ts;
function setEtsStateStylesContext(val) {
setEtsFlag(val, 64 /* EtsFlags.EtsStateStylesContext */);
}
function setUICallbackContext(val) {
setEtsFlag(val, 512 /* EtsFlags.UICallbackContext */);
}
function setSyntaxComponentContext(val) {
setEtsFlag(val, 1024 /* EtsFlags.SyntaxComponentContext */);
}
function doOutsideOfContext(context, func) {
// contextFlagsToClear will contain only the context flags that are
// currently set that we need to temporarily clear
@ -33121,6 +33141,12 @@ var ts;
function inEtsStateStylesContext() {
return inEtsContext() && (inBuildContext() || inBuilderContext() || inEtsExtendComponentsContext() || inEtsStylesComponentsContext()) && inEtsFlagsContext(64 /* EtsFlags.EtsStateStylesContext */);
}
function inUICallbackContext() {
return inEtsContext() && (inBuildContext() || inBuilderContext()) && inEtsFlagsContext(512 /* EtsFlags.UICallbackContext */);
}
function inSyntaxComponentContext() {
return inEtsContext() && (inBuildContext() || inBuilderContext()) && inEtsFlagsContext(1024 /* EtsFlags.SyntaxComponentContext */);
}
function parseErrorAtPosition(start, length, message, arg0) {
// Don't report another error if it would just be at the same position as the last error.
var lastError = ts.lastOrUndefined(parseDiagnostics);
@ -35662,7 +35688,7 @@ var ts;
return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher(allowReturnTypeInArrowFunction), pos);
}
// It's a CallExpression with open brace followed, therefore, we think it's an EtsComponentExpression
if ((inStructContext() || inBuildContext() || inBuilderContext()) && ts.isCallExpression(expr) && token() === 18 /* SyntaxKind.OpenBraceToken */) {
if ((inBuildContext() || inBuilderContext()) && inUICallbackContext() && ts.isCallExpression(expr) && token() === 18 /* SyntaxKind.OpenBraceToken */) {
return makeEtsComponentExpression(expr, pos);
}
// It wasn't an assignment or a lambda. This is a conditional expression:
@ -35985,9 +36011,13 @@ var ts;
// have an opening brace, just in case we're in an error state.
var lastToken = token();
var equalsGreaterThanToken = parseExpectedToken(38 /* SyntaxKind.EqualsGreaterThanToken */);
var originUIContextFlag = inUICallbackContext();
setUICallbackContext(inSyntaxComponentContext() ? true : false);
setSyntaxComponentContext(false);
var body = (lastToken === 38 /* SyntaxKind.EqualsGreaterThanToken */ || lastToken === 18 /* SyntaxKind.OpenBraceToken */)
? parseArrowFunctionExpressionBody(ts.some(modifiers, ts.isAsyncModifier), allowReturnTypeInArrowFunction)
: parseIdentifier();
setUICallbackContext(originUIContextFlag);
// Given:
// x ? y => ({ y }) : z => ({ z })
// We try to parse the body of the first arrow function by looking at:
@ -36863,9 +36893,9 @@ var ts;
return finishNode(tagExpression, pos);
}
function parseCallExpressionRest(pos, expression) {
var _a, _b, _c, _d, _e, _f;
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
var currentNodeName;
while (true) {
var _loop_5 = function () {
expression = parseMemberExpressionRest(pos, expression, /*allowOptionalChain*/ true);
var typeArguments = void 0;
var questionDotToken = parseOptionalToken(28 /* SyntaxKind.QuestionDotToken */);
@ -36873,7 +36903,7 @@ var ts;
typeArguments = tryParse(parseTypeArgumentsInExpression);
if (isTemplateStartOfTaggedTemplate()) {
expression = parseTaggedTemplateRest(pos, expression, questionDotToken, typeArguments);
continue;
return "continue";
}
}
if (typeArguments || token() === 20 /* SyntaxKind.OpenParenToken */) {
@ -36883,19 +36913,27 @@ var ts;
expression = expression.expression;
}
if (isValidVirtualTypeArgumentsContext() && ts.isPropertyAccessExpression(expression)) {
var rootNode = ts.getRootEtsComponent(expression);
var rootNode = ts.getRootComponent(expression, sourceFileCompilerOptions);
if (rootNode) {
var rootNodeName = (rootNode.expression).escapedText.toString();
var rootNodeName_1 = (rootNode.expression).escapedText.toString();
currentNodeName = ts.getTextOfPropertyName(expression.name).toString();
if (currentNodeName === ((_b = (_a = sourceFileCompilerOptions === null || sourceFileCompilerOptions === void 0 ? void 0 : sourceFileCompilerOptions.ets) === null || _a === void 0 ? void 0 : _a.styles) === null || _b === void 0 ? void 0 : _b.property)) {
setEtsStateStylesContext(true);
stateStylesRootNode = rootNodeName;
stateStylesRootNode = rootNodeName_1;
}
else {
setEtsStateStylesContext(false);
stateStylesRootNode = undefined;
}
typeArguments = parseEtsTypeArguments(pos, "".concat(rootNodeName, "Attribute"));
if ((_e = (_d = (_c = sourceFileCompilerOptions === null || sourceFileCompilerOptions === void 0 ? void 0 : sourceFileCompilerOptions.ets) === null || _c === void 0 ? void 0 : _c.syntaxComponents) === null || _d === void 0 ? void 0 : _d.attrUICallback) === null || _e === void 0 ? void 0 : _e.map(function (item) { return item.name; }).includes(rootNodeName_1)) {
var syntaxComponents = (_h = (_g = (_f = sourceFileCompilerOptions === null || sourceFileCompilerOptions === void 0 ? void 0 : sourceFileCompilerOptions.ets) === null || _f === void 0 ? void 0 : _f.syntaxComponents) === null || _g === void 0 ? void 0 : _g.attrUICallback) === null || _h === void 0 ? void 0 : _h.filter(function (item) { return item.name === rootNodeName_1; });
if (syntaxComponents.length && ((_k = (_j = syntaxComponents[0]) === null || _j === void 0 ? void 0 : _j.attributes) === null || _k === void 0 ? void 0 : _k.includes(currentNodeName))) {
setSyntaxComponentContext(true);
}
}
else {
typeArguments = parseEtsTypeArguments(pos, "".concat(rootNodeName_1, "Attribute"));
}
}
else if (inEtsStateStylesContext() && stateStylesRootNode) {
typeArguments = parseEtsTypeArguments(pos, "".concat(stateStylesRootNode, "Attribute"));
@ -36905,7 +36943,7 @@ var ts;
if (virtualNode) {
var rootNodeName = (virtualNode.expression).escapedText.toString();
currentNodeName = ts.getTextOfPropertyName(expression.name).toString();
if (currentNodeName === ((_d = (_c = sourceFileCompilerOptions === null || sourceFileCompilerOptions === void 0 ? void 0 : sourceFileCompilerOptions.ets) === null || _c === void 0 ? void 0 : _c.styles) === null || _d === void 0 ? void 0 : _d.property)) {
if (currentNodeName === ((_m = (_l = sourceFileCompilerOptions === null || sourceFileCompilerOptions === void 0 ? void 0 : sourceFileCompilerOptions.ets) === null || _l === void 0 ? void 0 : _l.styles) === null || _m === void 0 ? void 0 : _m.property)) {
setEtsStateStylesContext(true);
rootNodeName = rootNodeName.replace("Instance", "");
stateStylesRootNode = rootNodeName;
@ -36914,21 +36952,30 @@ var ts;
}
}
}
if (isValidVirtualTypeArgumentsContext() && ts.isIdentifier(expression) &&
((_q = (_p = (_o = sourceFileCompilerOptions === null || sourceFileCompilerOptions === void 0 ? void 0 : sourceFileCompilerOptions.ets) === null || _o === void 0 ? void 0 : _o.syntaxComponents) === null || _p === void 0 ? void 0 : _p.paramsUICallback) === null || _q === void 0 ? void 0 : _q.includes(expression.escapedText.toString()))) {
setSyntaxComponentContext(true);
}
var argumentList = parseArgumentList();
var callExpr = questionDotToken || tryReparseOptionalChain(expression) ?
factory.createCallChain(expression, questionDotToken, typeArguments, argumentList) :
factory.createCallExpression(expression, typeArguments, argumentList);
expression = finishNode(callExpr, pos);
continue;
return "continue";
}
if (questionDotToken) {
// We parsed `?.` but then failed to parse anything, so report a missing identifier here.
var name = createMissingNode(79 /* SyntaxKind.Identifier */, /*reportAtCurrentPosition*/ false, ts.Diagnostics.Identifier_expected);
expression = finishNode(factory.createPropertyAccessChain(expression, questionDotToken, name), pos);
}
break;
return "break";
};
while (true) {
var state_2 = _loop_5();
if (state_2 === "break")
break;
}
if (currentNodeName === ((_f = (_e = sourceFileCompilerOptions === null || sourceFileCompilerOptions === void 0 ? void 0 : sourceFileCompilerOptions.ets) === null || _e === void 0 ? void 0 : _e.styles) === null || _f === void 0 ? void 0 : _f.property)) {
if (currentNodeName === ((_s = (_r = sourceFileCompilerOptions === null || sourceFileCompilerOptions === void 0 ? void 0 : sourceFileCompilerOptions.ets) === null || _r === void 0 ? void 0 : _r.styles) === null || _s === void 0 ? void 0 : _s.property)) {
setEtsStateStylesContext(false);
stateStylesRootNode = undefined;
}
@ -38060,8 +38107,10 @@ var ts;
var methodName = (_a = ts.getPropertyNameForPropertyNameNode(name)) === null || _a === void 0 ? void 0 : _a.toString();
var orignalEtsBuildContext = inBuildContext();
var orignalEtsBuilderContext = inBuilderContext();
var orignalUICallbackContext = inUICallbackContext();
setEtsBuildContext(methodName === ((_d = (_c = (_b = sourceFileCompilerOptions === null || sourceFileCompilerOptions === void 0 ? void 0 : sourceFileCompilerOptions.ets) === null || _b === void 0 ? void 0 : _b.render) === null || _c === void 0 ? void 0 : _c.method) === null || _d === void 0 ? void 0 : _d.find(function (render) { return render === "build"; })));
setEtsBuilderContext(ts.hasEtsBuilderDecoratorNames(decorators, sourceFileCompilerOptions));
setUICallbackContext(inBuildContext() || inBuilderContext());
if (inStructContext() && ts.hasEtsStylesDecoratorNames(decorators, sourceFileCompilerOptions)) {
if (methodName && currentStructName) {
structStylesComponents.set(methodName, { structName: currentStructName, kind: 173 /* SyntaxKind.MethodDeclaration */ });
@ -38087,6 +38136,7 @@ var ts;
node.exclamationToken = exclamationToken;
setEtsBuildContext(orignalEtsBuildContext);
setEtsBuilderContext(orignalEtsBuilderContext);
setUICallbackContext(orignalUICallbackContext);
setEtsStylesComponentsContext(false);
stylesEtsComponentDeclaration = undefined;
setEtsComponentsContext(orignalEtsComponentsContext);
@ -42714,7 +42764,7 @@ var ts;
}
function convertObjectLiteralExpressionToJson(node, knownOptions, extraKeyDiagnostics, parentOption) {
var result = returnValue ? {} : undefined;
var _loop_5 = function (element) {
var _loop_6 = function (element) {
if (element.kind !== 303 /* SyntaxKind.PropertyAssignment */) {
errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, element, ts.Diagnostics.Property_assignment_expected));
return "continue";
@ -42767,7 +42817,7 @@ var ts;
};
for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
var element = _a[_i];
_loop_5(element);
_loop_6(element);
}
return result;
}
@ -42968,7 +43018,7 @@ var ts;
var optionsNameMap = _a.optionsNameMap;
var result = new ts.Map();
var getCanonicalFileName = pathOptions && ts.createGetCanonicalFileName(pathOptions.useCaseSensitiveFileNames);
var _loop_6 = function (name) {
var _loop_7 = function (name) {
if (ts.hasProperty(options, name)) {
// tsconfig only options cannot be specified via command line,
// so we can assume that only types that can appear here string | number | boolean
@ -43002,7 +43052,7 @@ var ts;
}
};
for (var name in options) {
_loop_6(name);
_loop_7(name);
}
return result;
}
@ -43776,7 +43826,7 @@ var ts;
}
var jsonOnlyIncludeRegexes;
if (validatedIncludeSpecs && validatedIncludeSpecs.length > 0) {
var _loop_7 = function (file) {
var _loop_8 = function (file) {
if (ts.fileExtensionIs(file, ".json" /* Extension.Json */)) {
// Valid only if *.json specified
if (!jsonOnlyIncludeRegexes) {
@ -43814,7 +43864,7 @@ var ts;
};
for (var _a = 0, _b = host.readDirectory(basePath, ts.flatten(supportedExtensionsWithJsonIfResolveJsonModule), validatedExcludeSpecs, validatedIncludeSpecs, /*depth*/ undefined); _a < _b.length; _a++) {
var file = _b[_a];
_loop_7(file);
_loop_8(file);
}
}
var literalFiles = ts.arrayFrom(literalFileMap.values());
@ -47231,7 +47281,7 @@ var ts;
break;
// 5. other uninstantiated module declarations.
case 269 /* SyntaxKind.ModuleBlock */: {
var state_2 = 0 /* ModuleInstanceState.NonInstantiated */;
var state_3 = 0 /* ModuleInstanceState.NonInstantiated */;
ts.forEachChild(node, function (n) {
var childState = getModuleInstanceStateCached(n, visited);
switch (childState) {
@ -47240,17 +47290,17 @@ var ts;
return;
case 2 /* ModuleInstanceState.ConstEnumOnly */:
// child is const enum only - record state and continue searching
state_2 = 2 /* ModuleInstanceState.ConstEnumOnly */;
state_3 = 2 /* ModuleInstanceState.ConstEnumOnly */;
return;
case 1 /* ModuleInstanceState.Instantiated */:
// child is instantiated - record state and stop
state_2 = 1 /* ModuleInstanceState.Instantiated */;
state_3 = 1 /* ModuleInstanceState.Instantiated */;
return true;
default:
ts.Debug.assertNever(childState);
}
});
return state_2;
return state_3;
}
case 268 /* SyntaxKind.ModuleDeclaration */:
return getModuleInstanceState(node, visited);
@ -51916,7 +51966,7 @@ var ts;
function addDuplicateDeclarationError(node, message, symbolName, relatedNodes) {
var errorNode = (ts.getExpandoInitializer(node, /*isPrototypeAssignment*/ false) ? ts.getNameOfExpando(node) : ts.getNameOfDeclaration(node)) || node;
var err = lookupOrIssueError(errorNode, message, symbolName);
var _loop_8 = function (relatedNode) {
var _loop_9 = function (relatedNode) {
var adjustedNode = (ts.getExpandoInitializer(relatedNode, /*isPrototypeAssignment*/ false) ? ts.getNameOfExpando(relatedNode) : ts.getNameOfDeclaration(relatedNode)) || relatedNode;
if (adjustedNode === errorNode)
return "continue";
@ -51929,7 +51979,7 @@ var ts;
};
for (var _i = 0, _a = relatedNodes || ts.emptyArray; _i < _a.length; _i++) {
var relatedNode = _a[_i];
_loop_8(relatedNode);
_loop_9(relatedNode);
}
}
function combineSymbolTables(first, second) {
@ -54716,7 +54766,7 @@ var ts;
}
function forEachSymbolTableInScope(enclosingDeclaration, callback) {
var result;
var _loop_9 = function (location) {
var _loop_10 = function (location) {
// Locals of a source file are not in scope (because they get merged into the global symbol table)
if (location.locals && !isGlobalSourceFile(location)) {
if (result = callback(location.locals, /*ignoreQualification*/ undefined, /*isLocalNameLookup*/ true, location)) {
@ -54762,9 +54812,9 @@ var ts;
}
};
for (var location = enclosingDeclaration; location; location = location.parent) {
var state_3 = _loop_9(location);
if (typeof state_3 === "object")
return state_3.value;
var state_4 = _loop_10(location);
if (typeof state_4 === "object")
return state_4.value;
}
return callback(globals, /*ignoreQualification*/ undefined, /*isLocalNameLookup*/ true);
}
@ -57167,7 +57217,7 @@ var ts;
if (ts.length(reexports) > 1) {
var groups = ts.group(reexports, function (decl) { return ts.isStringLiteral(decl.moduleSpecifier) ? ">" + decl.moduleSpecifier.text : ">"; });
if (groups.length !== reexports.length) {
var _loop_10 = function (group_1) {
var _loop_11 = function (group_1) {
if (group_1.length > 1) {
// remove group members from statements and then merge group members and add back to statements
statements = __spreadArray(__spreadArray([], ts.filter(statements, function (s) { return group_1.indexOf(s) === -1; }), true), [
@ -57179,7 +57229,7 @@ var ts;
};
for (var _i = 0, groups_1 = groups; _i < groups_1.length; _i++) {
var group_1 = groups_1[_i];
_loop_10(group_1);
_loop_11(group_1);
}
}
}
@ -61070,7 +61120,7 @@ var ts;
// signatures from the type, whose ordering would be non-obvious)
var masterList = signatureLists[indexWithLengthOverOne !== undefined ? indexWithLengthOverOne : 0];
var results = masterList.slice();
var _loop_11 = function (signatures) {
var _loop_12 = function (signatures) {
if (signatures !== masterList) {
var signature_1 = signatures[0];
ts.Debug.assert(!!signature_1, "getUnionSignatures bails early on empty signature lists and should not have empty lists on second pass");
@ -61082,8 +61132,8 @@ var ts;
};
for (var _b = 0, signatureLists_1 = signatureLists; _b < signatureLists_1.length; _b++) {
var signatures = signatureLists_1[_b];
var state_4 = _loop_11(signatures);
if (state_4 === "break")
var state_5 = _loop_12(signatures);
if (state_5 === "break")
break;
}
result = results;
@ -61189,7 +61239,7 @@ var ts;
var sourceInfos = getIndexInfosOfType(types[0]);
if (sourceInfos) {
var result = [];
var _loop_12 = function (info) {
var _loop_13 = function (info) {
var indexType = info.keyType;
if (ts.every(types, function (t) { return !!getIndexInfoOfType(t, indexType); })) {
result.push(createIndexInfo(indexType, getUnionType(ts.map(types, function (t) { return getIndexTypeOfType(t, indexType); })), ts.some(types, function (t) { return getIndexInfoOfType(t, indexType).isReadonly; })));
@ -61197,7 +61247,7 @@ var ts;
};
for (var _i = 0, sourceInfos_1 = sourceInfos; _i < sourceInfos_1.length; _i++) {
var info = sourceInfos_1[_i];
_loop_12(info);
_loop_13(info);
}
return result;
}
@ -61244,7 +61294,7 @@ var ts;
var types = type.types;
var mixinFlags = findMixins(types);
var mixinCount = ts.countWhere(mixinFlags, function (b) { return b; });
var _loop_13 = function (i) {
var _loop_14 = function (i) {
var t = type.types[i];
// When an intersection type contains mixin constructor types, the construct signatures from
// those types are discarded and their return types are mixed into the return types of all
@ -61266,19 +61316,19 @@ var ts;
indexInfos = ts.reduceLeft(getIndexInfosOfType(t), function (infos, newInfo) { return appendIndexInfo(infos, newInfo, /*union*/ false); }, indexInfos);
};
for (var i = 0; i < types.length; i++) {
_loop_13(i);
_loop_14(i);
}
setStructuredTypeMembers(type, emptySymbols, callSignatures || ts.emptyArray, constructSignatures || ts.emptyArray, indexInfos || ts.emptyArray);
}
function appendSignatures(signatures, newSignatures) {
var _loop_14 = function (sig) {
var _loop_15 = function (sig) {
if (!signatures || ts.every(signatures, function (s) { return !compareSignaturesIdentical(s, sig, /*partialMatch*/ false, /*ignoreThisTypes*/ false, /*ignoreReturnTypes*/ false, compareTypesIdentical); })) {
signatures = ts.append(signatures, sig);
}
};
for (var _i = 0, newSignatures_1 = newSignatures; _i < newSignatures_1.length; _i++) {
var sig = newSignatures_1[_i];
_loop_14(sig);
_loop_15(sig);
}
return signatures;
}
@ -62299,7 +62349,7 @@ var ts;
}
function getCommonDeclarationsOfSymbols(symbols) {
var commonDeclarations;
var _loop_15 = function (symbol) {
var _loop_16 = function (symbol) {
if (!symbol.declarations) {
return { value: undefined };
}
@ -62318,9 +62368,9 @@ var ts;
};
for (var _i = 0, symbols_3 = symbols; _i < symbols_3.length; _i++) {
var symbol = symbols_3[_i];
var state_5 = _loop_15(symbol);
if (typeof state_5 === "object")
return state_5.value;
var state_6 = _loop_16(symbol);
if (typeof state_6 === "object")
return state_6.value;
}
return commonDeclarations;
}
@ -63038,7 +63088,7 @@ var ts;
function getIndexInfosOfIndexSymbol(indexSymbol) {
if (indexSymbol.declarations) {
var indexInfos_4 = [];
var _loop_16 = function (declaration) {
var _loop_17 = function (declaration) {
if (declaration.parameters.length === 1) {
var parameter = declaration.parameters[0];
if (parameter.type) {
@ -63052,7 +63102,7 @@ var ts;
};
for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
_loop_16(declaration);
_loop_17(declaration);
}
return indexInfos_4;
}
@ -63069,7 +63119,7 @@ var ts;
var _a;
var inferences;
if ((_a = typeParameter.symbol) === null || _a === void 0 ? void 0 : _a.declarations) {
var _loop_17 = function (declaration) {
var _loop_18 = function (declaration) {
if (declaration.parent.kind === 194 /* SyntaxKind.InferType */) {
// When an 'infer T' declaration is immediately contained in a type reference node
// (such as 'Foo<infer T>'), T's constraint is inferred from the constraint of the
@ -63133,7 +63183,7 @@ var ts;
};
for (var _i = 0, _b = typeParameter.symbol.declarations; _i < _b.length; _i++) {
var declaration = _b[_i];
_loop_17(declaration);
_loop_18(declaration);
}
}
return inferences && getIntersectionType(inferences);
@ -64033,7 +64083,7 @@ var ts;
var lastRequiredIndex = -1;
var firstRestIndex = -1;
var lastOptionalOrRestIndex = -1;
var _loop_18 = function (i) {
var _loop_19 = function (i) {
var type = elementTypes[i];
var flags = target.elementFlags[i];
if (flags & 8 /* ElementFlags.Variadic */) {
@ -64063,9 +64113,9 @@ var ts;
}
};
for (var i = 0; i < elementTypes.length; i++) {
var state_6 = _loop_18(i);
if (typeof state_6 === "object")
return state_6.value;
var state_7 = _loop_19(i);
if (typeof state_7 === "object")
return state_7.value;
}
// Turn optional elements preceding the last required element into required elements
for (var i = 0; i < lastRequiredIndex; i++) {
@ -64259,7 +64309,7 @@ var ts;
var templates = ts.filter(types, isPatternLiteralType);
if (templates.length) {
var i = types.length;
var _loop_19 = function () {
var _loop_20 = function () {
i--;
var t = types[i];
if (t.flags & 128 /* TypeFlags.StringLiteral */ && ts.some(templates, function (template) { return isTypeMatchedByTemplateLiteralType(t, template); })) {
@ -64267,7 +64317,7 @@ var ts;
}
};
while (i > 0) {
_loop_19();
_loop_20();
}
}
}
@ -64344,14 +64394,14 @@ var ts;
var namedUnions = [];
addNamedUnions(namedUnions, types);
var reducedTypes = [];
var _loop_20 = function (t) {
var _loop_21 = function (t) {
if (!ts.some(namedUnions, function (union) { return containsType(union.types, t); })) {
reducedTypes.push(t);
}
};
for (var _i = 0, typeSet_1 = typeSet; _i < typeSet_1.length; _i++) {
var t = typeSet_1[_i];
_loop_20(t);
_loop_21(t);
}
if (!aliasSymbol && namedUnions.length === 1 && reducedTypes.length === 0) {
return namedUnions[0];
@ -68308,7 +68358,7 @@ var ts;
reducedTarget = findMatchingDiscriminantType(source, target, isRelatedTo) || filterPrimitivesIfContainsNonPrimitive(target);
checkTypes = reducedTarget.flags & 1048576 /* TypeFlags.Union */ ? reducedTarget.types : [reducedTarget];
}
var _loop_21 = function (prop) {
var _loop_22 = function (prop) {
if (shouldCheckAsExcessProperty(prop, source.symbol) && !isIgnoredJsxProperty(source, prop)) {
if (!isKnownProperty(reducedTarget, prop.escapedName, isComparingJsxAttributes)) {
if (reportErrors) {
@ -68371,9 +68421,9 @@ var ts;
};
for (var _i = 0, _b = getPropertiesOfType(source); _i < _b.length; _i++) {
var prop = _b[_i];
var state_7 = _loop_21(prop);
if (typeof state_7 === "object")
return state_7.value;
var state_8 = _loop_22(prop);
if (typeof state_8 === "object")
return state_8.value;
}
return false;
}
@ -69383,11 +69433,11 @@ var ts;
// constituents of 'target'. If any combination does not have a match then 'source' is not relatable.
var discriminantCombinations = ts.cartesianProduct(sourceDiscriminantTypes);
var matchingTypes = [];
var _loop_22 = function (combination) {
var _loop_23 = function (combination) {
var hasMatch = false;
outer: for (var _c = 0, _d = target.types; _c < _d.length; _c++) {
var type = _d[_c];
var _loop_23 = function (i) {
var _loop_24 = function (i) {
var sourceProperty = sourcePropertiesFiltered[i];
var targetProperty = getPropertyOfType(type, sourceProperty.escapedName);
if (!targetProperty)
@ -69403,8 +69453,8 @@ var ts;
}
};
for (var i = 0; i < sourcePropertiesFiltered.length; i++) {
var state_9 = _loop_23(i);
switch (state_9) {
var state_10 = _loop_24(i);
switch (state_10) {
case "continue-outer": continue outer;
}
}
@ -69417,9 +69467,9 @@ var ts;
};
for (var _a = 0, discriminantCombinations_1 = discriminantCombinations; _a < discriminantCombinations_1.length; _a++) {
var combination = discriminantCombinations_1[_a];
var state_8 = _loop_22(combination);
if (typeof state_8 === "object")
return state_8.value;
var state_9 = _loop_23(combination);
if (typeof state_9 === "object")
return state_9.value;
}
// Compare the remaining non-discriminant properties of each match.
var result = -1 /* Ternary.True */;
@ -70124,7 +70174,7 @@ var ts;
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes" /* tracing.Phase.CheckTypes */, "getVariancesWorker", { arity: typeParameters.length, id: getTypeId(getDeclaredTypeOfSymbol(symbol)) });
links.variances = ts.emptyArray;
var variances = [];
var _loop_24 = function (tp) {
var _loop_25 = function (tp) {
var modifiers = getVarianceModifiers(tp);
var variance = modifiers & 65536 /* ModifierFlags.Out */ ?
modifiers & 32768 /* ModifierFlags.In */ ? 0 /* VarianceFlags.Invariant */ : 1 /* VarianceFlags.Covariant */ :
@ -70162,7 +70212,7 @@ var ts;
};
for (var _i = 0, typeParameters_2 = typeParameters; _i < typeParameters_2.length; _i++) {
var tp = typeParameters_2[_i];
_loop_24(tp);
_loop_25(tp);
}
links.variances = variances;
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop({ variances: variances.map(ts.Debug.formatVariance) });
@ -72122,7 +72172,7 @@ var ts;
// upon instantiation, would collapse all the placeholders to just 'string', and an assignment check might
// succeed. That would be a pointless and confusing outcome.
if (matches || ts.every(target.texts, function (s) { return s.length === 0; })) {
var _loop_25 = function (i) {
var _loop_26 = function (i) {
var source_1 = matches ? matches[i] : neverType;
var target_3 = types[i];
// If we are inferring from a string literal type to a type variable whose constraint includes one of the
@ -72172,7 +72222,7 @@ var ts;
inferFromTypes(source_1, target_3);
};
for (var i = 0; i < types.length; i++) {
_loop_25(i);
_loop_26(i);
}
}
}
@ -72701,7 +72751,7 @@ var ts;
function mapTypesByKeyProperty(types, name) {
var map = new ts.Map();
var count = 0;
var _loop_26 = function (type) {
var _loop_27 = function (type) {
if (type.flags & (524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */)) {
var discriminant = getTypeOfPropertyOfType(type, name);
if (discriminant) {
@ -72727,9 +72777,9 @@ var ts;
};
for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
var type = types_15[_i];
var state_10 = _loop_26(type);
if (typeof state_10 === "object")
return state_10.value;
var state_11 = _loop_27(type);
if (typeof state_11 === "object")
return state_11.value;
}
return count >= 10 && count * 2 >= types.length ? map : undefined;
}
@ -79276,7 +79326,7 @@ var ts;
if (spreadIndex >= 0) {
// Create synthetic arguments from spreads of tuple types.
var effectiveArgs_1 = args.slice(0, spreadIndex);
var _loop_27 = function (i) {
var _loop_28 = function (i) {
var arg = args[i];
// We can call checkExpressionCached because spread expressions never have a contextual type.
var spreadType = arg.kind === 230 /* SyntaxKind.SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression));
@ -79293,7 +79343,7 @@ var ts;
}
};
for (var i = spreadIndex; i < args.length; i++) {
_loop_27(i);
_loop_28(i);
}
return effectiveArgs_1;
}
@ -79645,7 +79695,7 @@ var ts;
var min_3 = Number.MAX_VALUE;
var minIndex = 0;
var i_1 = 0;
var _loop_28 = function (c) {
var _loop_29 = function (c) {
var chain_2 = function () { return ts.chainDiagnosticMessages(/*details*/ undefined, ts.Diagnostics.Overload_0_of_1_2_gave_the_following_error, i_1 + 1, candidates.length, signatureToString(c)); };
var diags_2 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0 /* CheckMode.Normal */, /*reportErrors*/ true, chain_2);
if (diags_2) {
@ -79663,7 +79713,7 @@ var ts;
};
for (var _a = 0, candidatesForArgumentError_1 = candidatesForArgumentError; _a < candidatesForArgumentError_1.length; _a++) {
var c = candidatesForArgumentError_1[_a];
_loop_28(c);
_loop_29(c);
}
var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics);
ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures");
@ -79821,7 +79871,7 @@ var ts;
}
var _a = ts.minAndMax(candidates, getNumNonRestParameters), minArgumentCount = _a.min, maxNonRestParam = _a.max;
var parameters = [];
var _loop_29 = function (i) {
var _loop_30 = function (i) {
var symbols = ts.mapDefined(candidates, function (s) { return signatureHasRestParameter(s) ?
i < s.parameters.length - 1 ? s.parameters[i] : ts.last(s.parameters) :
i < s.parameters.length ? s.parameters[i] : undefined; });
@ -79829,7 +79879,7 @@ var ts;
parameters.push(createCombinedSymbolFromTypes(symbols, ts.mapDefined(candidates, function (candidate) { return tryGetTypeAtPosition(candidate, i); })));
};
for (var i = 0; i < maxNonRestParam; i++) {
_loop_29(i);
_loop_30(i);
}
var restParameterSymbols = ts.mapDefined(candidates, function (c) { return signatureHasRestParameter(c) ? ts.last(c.parameters) : undefined; });
var flags = 0 /* SignatureFlags.None */;
@ -80776,7 +80826,7 @@ var ts;
}
function expressionCheckByJsDoc(declaration, node, sourceFile, checkConfig) {
var jsDocTags = ts.getJSDocTags(declaration);
var _loop_30 = function (i) {
var _loop_31 = function (i) {
var config = checkConfig[i];
var tagNameCheckNecessity = true;
if (config.checkJsDocSpecialValidCallback) {
@ -80809,7 +80859,7 @@ var ts;
}
};
for (var i = 0; i < checkConfig.length; i++) {
_loop_30(i);
_loop_31(i);
}
}
function collectDiagnostics(config, node, diagnostic) {
@ -84240,7 +84290,7 @@ var ts;
var indexSymbol = getIndexSymbol(getSymbolOfNode(node));
if (indexSymbol === null || indexSymbol === void 0 ? void 0 : indexSymbol.declarations) {
var indexSignatureMap_1 = new ts.Map();
var _loop_31 = function (declaration) {
var _loop_32 = function (declaration) {
if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
forEachType(getTypeFromTypeNode(declaration.parameters[0].type), function (type) {
var entry = indexSignatureMap_1.get(getTypeId(type));
@ -84255,7 +84305,7 @@ var ts;
};
for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
_loop_31(declaration);
_loop_32(declaration);
}
indexSignatureMap_1.forEach(function (entry) {
if (entry.declarations.length > 1) {
@ -87900,7 +87950,7 @@ var ts;
var propDeclaration = declaration && declaration.kind === 226 /* SyntaxKind.BinaryExpression */ ||
name && name.kind === 166 /* SyntaxKind.ComputedPropertyName */ ? declaration : undefined;
var localPropDeclaration = getParentOfSymbol(prop) === type.symbol ? declaration : undefined;
var _loop_32 = function (info) {
var _loop_33 = function (info) {
var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
// We check only when (a) the property is declared in the containing type, or (b) the applicable index signature is declared
// in the containing type, or (c) the containing type is an interface and no base interface contains both the property and
@ -87917,7 +87967,7 @@ var ts;
};
for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) {
var info = indexInfos_9[_i];
_loop_32(info);
_loop_33(info);
}
}
function checkIndexConstraintForIndexSignature(type, checkInfo) {
@ -87925,7 +87975,7 @@ var ts;
var indexInfos = getApplicableIndexInfos(type, checkInfo.keyType);
var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 265 /* SyntaxKind.InterfaceDeclaration */) : undefined;
var localCheckDeclaration = declaration && getParentOfSymbol(getSymbolOfNode(declaration)) === type.symbol ? declaration : undefined;
var _loop_33 = function (info) {
var _loop_34 = function (info) {
if (info === checkInfo)
return "continue";
var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
@ -87940,7 +87990,7 @@ var ts;
};
for (var _i = 0, indexInfos_10 = indexInfos; _i < indexInfos_10.length; _i++) {
var info = indexInfos_10[_i];
_loop_33(info);
_loop_34(info);
}
}
function checkTypeNameIsReserved(name, message) {
@ -88280,7 +88330,7 @@ var ts;
var baseTypes = baseTypeNode && getBaseTypes(type);
var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined;
var baseStaticType = getBaseConstructorTypeOfClass(type);
var _loop_34 = function (member) {
var _loop_35 = function (member) {
if (ts.hasAmbientModifier(member)) {
return "continue";
}
@ -88297,7 +88347,7 @@ var ts;
};
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
var member = _a[_i];
_loop_34(member);
_loop_35(member);
}
}
/**
@ -88385,7 +88435,7 @@ var ts;
function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) {
// iterate over all implemented properties and issue errors on each one which isn't compatible, rather than the class as a whole, if possible
var issuedMemberError = false;
var _loop_35 = function (member) {
var _loop_36 = function (member) {
if (ts.isStatic(member)) {
return "continue";
}
@ -88404,7 +88454,7 @@ var ts;
};
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
var member = _a[_i];
_loop_35(member);
_loop_36(member);
}
if (!issuedMemberError) {
// check again with diagnostics to generate a less-specific error
@ -88475,7 +88525,7 @@ var ts;
var _a, _b, _c, _d;
// NOTE: assignability is checked in checkClassDeclaration
var baseProperties = getPropertiesOfType(baseType);
var _loop_36 = function (baseProperty) {
var _loop_37 = function (baseProperty) {
var base = getTargetSymbol(baseProperty);
if (base.flags & 4194304 /* SymbolFlags.Prototype */) {
return "continue";
@ -88585,8 +88635,8 @@ var ts;
};
basePropertyCheck: for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {
var baseProperty = baseProperties_1[_i];
var state_11 = _loop_36(baseProperty);
switch (state_11) {
var state_12 = _loop_37(baseProperty);
switch (state_12) {
case "continue-basePropertyCheck": continue basePropertyCheck;
}
}
@ -127944,7 +127994,7 @@ var ts;
});
// Sort by paths closest to importing file Name directory
var sortedPaths = [];
var _loop_37 = function (directory) {
var _loop_38 = function (directory) {
var directoryStart = ts.ensureTrailingDirectorySeparator(directory);
var pathsInDirectory;
allFileNames.forEach(function (_a, fileName) {
@ -127968,9 +128018,9 @@ var ts;
};
var out_directory_1;
for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
var state_12 = _loop_37(directory);
var state_13 = _loop_38(directory);
directory = out_directory_1;
if (state_12 === "break")
if (state_13 === "break")
break;
}
if (allFileNames.size) {
@ -128039,7 +128089,7 @@ var ts;
}
function tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions) {
for (var key in paths) {
var _loop_38 = function (patternText_1) {
var _loop_39 = function (patternText_1) {
var pattern = ts.normalizePath(patternText_1);
var indexOfStar = pattern.indexOf("*");
// In module resolution, if `pattern` itself has an extension, a file with that extension is looked up directly,
@ -128106,9 +128156,9 @@ var ts;
};
for (var _i = 0, _a = paths[key]; _i < _a.length; _i++) {
var patternText_1 = _a[_i];
var state_13 = _loop_38(patternText_1);
if (typeof state_13 === "object")
return state_13.value;
var state_14 = _loop_39(patternText_1);
if (typeof state_14 === "object")
return state_14.value;
}
}
function validateEnding(_a) {

11
lib/typescript.d.ts vendored
View File

@ -553,7 +553,9 @@ declare namespace ts {
EtsBuilderContext = 32,
EtsStateStylesContext = 64,
EtsComponentsContext = 128,
EtsNewExpressionContext = 256
EtsNewExpressionContext = 256,
UICallbackContext = 512,
SyntaxComponentContext = 1024
}
export enum ModifierFlags {
None = 0,
@ -3210,6 +3212,13 @@ declare namespace ts {
name: string;
emitParameters: boolean;
}[];
syntaxComponents: {
paramsUICallback: string[];
attrUICallback: {
name: string;
attributes: string[];
}[];
};
}
export interface WatchOptions {
watchFile?: WatchFileKind;

View File

@ -4638,6 +4638,8 @@ var ts;
EtsFlags[EtsFlags["EtsStateStylesContext"] = 64] = "EtsStateStylesContext";
EtsFlags[EtsFlags["EtsComponentsContext"] = 128] = "EtsComponentsContext";
EtsFlags[EtsFlags["EtsNewExpressionContext"] = 256] = "EtsNewExpressionContext";
EtsFlags[EtsFlags["UICallbackContext"] = 512] = "UICallbackContext";
EtsFlags[EtsFlags["SyntaxComponentContext"] = 1024] = "SyntaxComponentContext";
})(EtsFlags = ts.EtsFlags || (ts.EtsFlags = {}));
var ModifierFlags;
(function (ModifierFlags) {
@ -17772,6 +17774,18 @@ var ts;
return undefined;
}
ts.getRootEtsComponent = getRootEtsComponent;
function getRootComponent(node, compilerOptions) {
var _a, _b, _c;
while (node) {
if (ts.isEtsComponentExpression(node) || ts.isCallExpression(node) && ts.isIdentifier(node.expression) &&
((_c = (_b = (_a = compilerOptions.ets) === null || _a === void 0 ? void 0 : _a.syntaxComponents) === null || _b === void 0 ? void 0 : _b.attrUICallback) === null || _c === void 0 ? void 0 : _c.map(function (item) { return item.name; }).includes(node.expression.escapedText.toString()))) {
return node;
}
node = node.expression;
}
return undefined;
}
ts.getRootComponent = getRootComponent;
function getVirtualEtsComponent(node) {
while (node) {
if (ts.isPropertyAccessExpression(node) && node.expression && node.expression.virtual) {
@ -32982,6 +32996,12 @@ var ts;
function setEtsStateStylesContext(val) {
setEtsFlag(val, 64 /* EtsFlags.EtsStateStylesContext */);
}
function setUICallbackContext(val) {
setEtsFlag(val, 512 /* EtsFlags.UICallbackContext */);
}
function setSyntaxComponentContext(val) {
setEtsFlag(val, 1024 /* EtsFlags.SyntaxComponentContext */);
}
function doOutsideOfContext(context, func) {
// contextFlagsToClear will contain only the context flags that are
// currently set that we need to temporarily clear
@ -33112,6 +33132,12 @@ var ts;
function inEtsStateStylesContext() {
return inEtsContext() && (inBuildContext() || inBuilderContext() || inEtsExtendComponentsContext() || inEtsStylesComponentsContext()) && inEtsFlagsContext(64 /* EtsFlags.EtsStateStylesContext */);
}
function inUICallbackContext() {
return inEtsContext() && (inBuildContext() || inBuilderContext()) && inEtsFlagsContext(512 /* EtsFlags.UICallbackContext */);
}
function inSyntaxComponentContext() {
return inEtsContext() && (inBuildContext() || inBuilderContext()) && inEtsFlagsContext(1024 /* EtsFlags.SyntaxComponentContext */);
}
function parseErrorAtPosition(start, length, message, arg0) {
// Don't report another error if it would just be at the same position as the last error.
var lastError = ts.lastOrUndefined(parseDiagnostics);
@ -35653,7 +35679,7 @@ var ts;
return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher(allowReturnTypeInArrowFunction), pos);
}
// It's a CallExpression with open brace followed, therefore, we think it's an EtsComponentExpression
if ((inStructContext() || inBuildContext() || inBuilderContext()) && ts.isCallExpression(expr) && token() === 18 /* SyntaxKind.OpenBraceToken */) {
if ((inBuildContext() || inBuilderContext()) && inUICallbackContext() && ts.isCallExpression(expr) && token() === 18 /* SyntaxKind.OpenBraceToken */) {
return makeEtsComponentExpression(expr, pos);
}
// It wasn't an assignment or a lambda. This is a conditional expression:
@ -35976,9 +36002,13 @@ var ts;
// have an opening brace, just in case we're in an error state.
var lastToken = token();
var equalsGreaterThanToken = parseExpectedToken(38 /* SyntaxKind.EqualsGreaterThanToken */);
var originUIContextFlag = inUICallbackContext();
setUICallbackContext(inSyntaxComponentContext() ? true : false);
setSyntaxComponentContext(false);
var body = (lastToken === 38 /* SyntaxKind.EqualsGreaterThanToken */ || lastToken === 18 /* SyntaxKind.OpenBraceToken */)
? parseArrowFunctionExpressionBody(ts.some(modifiers, ts.isAsyncModifier), allowReturnTypeInArrowFunction)
: parseIdentifier();
setUICallbackContext(originUIContextFlag);
// Given:
// x ? y => ({ y }) : z => ({ z })
// We try to parse the body of the first arrow function by looking at:
@ -36854,9 +36884,9 @@ var ts;
return finishNode(tagExpression, pos);
}
function parseCallExpressionRest(pos, expression) {
var _a, _b, _c, _d, _e, _f;
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
var currentNodeName;
while (true) {
var _loop_5 = function () {
expression = parseMemberExpressionRest(pos, expression, /*allowOptionalChain*/ true);
var typeArguments = void 0;
var questionDotToken = parseOptionalToken(28 /* SyntaxKind.QuestionDotToken */);
@ -36864,7 +36894,7 @@ var ts;
typeArguments = tryParse(parseTypeArgumentsInExpression);
if (isTemplateStartOfTaggedTemplate()) {
expression = parseTaggedTemplateRest(pos, expression, questionDotToken, typeArguments);
continue;
return "continue";
}
}
if (typeArguments || token() === 20 /* SyntaxKind.OpenParenToken */) {
@ -36874,19 +36904,27 @@ var ts;
expression = expression.expression;
}
if (isValidVirtualTypeArgumentsContext() && ts.isPropertyAccessExpression(expression)) {
var rootNode = ts.getRootEtsComponent(expression);
var rootNode = ts.getRootComponent(expression, sourceFileCompilerOptions);
if (rootNode) {
var rootNodeName = (rootNode.expression).escapedText.toString();
var rootNodeName_1 = (rootNode.expression).escapedText.toString();
currentNodeName = ts.getTextOfPropertyName(expression.name).toString();
if (currentNodeName === ((_b = (_a = sourceFileCompilerOptions === null || sourceFileCompilerOptions === void 0 ? void 0 : sourceFileCompilerOptions.ets) === null || _a === void 0 ? void 0 : _a.styles) === null || _b === void 0 ? void 0 : _b.property)) {
setEtsStateStylesContext(true);
stateStylesRootNode = rootNodeName;
stateStylesRootNode = rootNodeName_1;
}
else {
setEtsStateStylesContext(false);
stateStylesRootNode = undefined;
}
typeArguments = parseEtsTypeArguments(pos, "".concat(rootNodeName, "Attribute"));
if ((_e = (_d = (_c = sourceFileCompilerOptions === null || sourceFileCompilerOptions === void 0 ? void 0 : sourceFileCompilerOptions.ets) === null || _c === void 0 ? void 0 : _c.syntaxComponents) === null || _d === void 0 ? void 0 : _d.attrUICallback) === null || _e === void 0 ? void 0 : _e.map(function (item) { return item.name; }).includes(rootNodeName_1)) {
var syntaxComponents = (_h = (_g = (_f = sourceFileCompilerOptions === null || sourceFileCompilerOptions === void 0 ? void 0 : sourceFileCompilerOptions.ets) === null || _f === void 0 ? void 0 : _f.syntaxComponents) === null || _g === void 0 ? void 0 : _g.attrUICallback) === null || _h === void 0 ? void 0 : _h.filter(function (item) { return item.name === rootNodeName_1; });
if (syntaxComponents.length && ((_k = (_j = syntaxComponents[0]) === null || _j === void 0 ? void 0 : _j.attributes) === null || _k === void 0 ? void 0 : _k.includes(currentNodeName))) {
setSyntaxComponentContext(true);
}
}
else {
typeArguments = parseEtsTypeArguments(pos, "".concat(rootNodeName_1, "Attribute"));
}
}
else if (inEtsStateStylesContext() && stateStylesRootNode) {
typeArguments = parseEtsTypeArguments(pos, "".concat(stateStylesRootNode, "Attribute"));
@ -36896,7 +36934,7 @@ var ts;
if (virtualNode) {
var rootNodeName = (virtualNode.expression).escapedText.toString();
currentNodeName = ts.getTextOfPropertyName(expression.name).toString();
if (currentNodeName === ((_d = (_c = sourceFileCompilerOptions === null || sourceFileCompilerOptions === void 0 ? void 0 : sourceFileCompilerOptions.ets) === null || _c === void 0 ? void 0 : _c.styles) === null || _d === void 0 ? void 0 : _d.property)) {
if (currentNodeName === ((_m = (_l = sourceFileCompilerOptions === null || sourceFileCompilerOptions === void 0 ? void 0 : sourceFileCompilerOptions.ets) === null || _l === void 0 ? void 0 : _l.styles) === null || _m === void 0 ? void 0 : _m.property)) {
setEtsStateStylesContext(true);
rootNodeName = rootNodeName.replace("Instance", "");
stateStylesRootNode = rootNodeName;
@ -36905,21 +36943,30 @@ var ts;
}
}
}
if (isValidVirtualTypeArgumentsContext() && ts.isIdentifier(expression) &&
((_q = (_p = (_o = sourceFileCompilerOptions === null || sourceFileCompilerOptions === void 0 ? void 0 : sourceFileCompilerOptions.ets) === null || _o === void 0 ? void 0 : _o.syntaxComponents) === null || _p === void 0 ? void 0 : _p.paramsUICallback) === null || _q === void 0 ? void 0 : _q.includes(expression.escapedText.toString()))) {
setSyntaxComponentContext(true);
}
var argumentList = parseArgumentList();
var callExpr = questionDotToken || tryReparseOptionalChain(expression) ?
factory.createCallChain(expression, questionDotToken, typeArguments, argumentList) :
factory.createCallExpression(expression, typeArguments, argumentList);
expression = finishNode(callExpr, pos);
continue;
return "continue";
}
if (questionDotToken) {
// We parsed `?.` but then failed to parse anything, so report a missing identifier here.
var name = createMissingNode(79 /* SyntaxKind.Identifier */, /*reportAtCurrentPosition*/ false, ts.Diagnostics.Identifier_expected);
expression = finishNode(factory.createPropertyAccessChain(expression, questionDotToken, name), pos);
}
break;
return "break";
};
while (true) {
var state_2 = _loop_5();
if (state_2 === "break")
break;
}
if (currentNodeName === ((_f = (_e = sourceFileCompilerOptions === null || sourceFileCompilerOptions === void 0 ? void 0 : sourceFileCompilerOptions.ets) === null || _e === void 0 ? void 0 : _e.styles) === null || _f === void 0 ? void 0 : _f.property)) {
if (currentNodeName === ((_s = (_r = sourceFileCompilerOptions === null || sourceFileCompilerOptions === void 0 ? void 0 : sourceFileCompilerOptions.ets) === null || _r === void 0 ? void 0 : _r.styles) === null || _s === void 0 ? void 0 : _s.property)) {
setEtsStateStylesContext(false);
stateStylesRootNode = undefined;
}
@ -38051,8 +38098,10 @@ var ts;
var methodName = (_a = ts.getPropertyNameForPropertyNameNode(name)) === null || _a === void 0 ? void 0 : _a.toString();
var orignalEtsBuildContext = inBuildContext();
var orignalEtsBuilderContext = inBuilderContext();
var orignalUICallbackContext = inUICallbackContext();
setEtsBuildContext(methodName === ((_d = (_c = (_b = sourceFileCompilerOptions === null || sourceFileCompilerOptions === void 0 ? void 0 : sourceFileCompilerOptions.ets) === null || _b === void 0 ? void 0 : _b.render) === null || _c === void 0 ? void 0 : _c.method) === null || _d === void 0 ? void 0 : _d.find(function (render) { return render === "build"; })));
setEtsBuilderContext(ts.hasEtsBuilderDecoratorNames(decorators, sourceFileCompilerOptions));
setUICallbackContext(inBuildContext() || inBuilderContext());
if (inStructContext() && ts.hasEtsStylesDecoratorNames(decorators, sourceFileCompilerOptions)) {
if (methodName && currentStructName) {
structStylesComponents.set(methodName, { structName: currentStructName, kind: 173 /* SyntaxKind.MethodDeclaration */ });
@ -38078,6 +38127,7 @@ var ts;
node.exclamationToken = exclamationToken;
setEtsBuildContext(orignalEtsBuildContext);
setEtsBuilderContext(orignalEtsBuilderContext);
setUICallbackContext(orignalUICallbackContext);
setEtsStylesComponentsContext(false);
stylesEtsComponentDeclaration = undefined;
setEtsComponentsContext(orignalEtsComponentsContext);
@ -42705,7 +42755,7 @@ var ts;
}
function convertObjectLiteralExpressionToJson(node, knownOptions, extraKeyDiagnostics, parentOption) {
var result = returnValue ? {} : undefined;
var _loop_5 = function (element) {
var _loop_6 = function (element) {
if (element.kind !== 303 /* SyntaxKind.PropertyAssignment */) {
errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, element, ts.Diagnostics.Property_assignment_expected));
return "continue";
@ -42758,7 +42808,7 @@ var ts;
};
for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
var element = _a[_i];
_loop_5(element);
_loop_6(element);
}
return result;
}
@ -42959,7 +43009,7 @@ var ts;
var optionsNameMap = _a.optionsNameMap;
var result = new ts.Map();
var getCanonicalFileName = pathOptions && ts.createGetCanonicalFileName(pathOptions.useCaseSensitiveFileNames);
var _loop_6 = function (name) {
var _loop_7 = function (name) {
if (ts.hasProperty(options, name)) {
// tsconfig only options cannot be specified via command line,
// so we can assume that only types that can appear here string | number | boolean
@ -42993,7 +43043,7 @@ var ts;
}
};
for (var name in options) {
_loop_6(name);
_loop_7(name);
}
return result;
}
@ -43767,7 +43817,7 @@ var ts;
}
var jsonOnlyIncludeRegexes;
if (validatedIncludeSpecs && validatedIncludeSpecs.length > 0) {
var _loop_7 = function (file) {
var _loop_8 = function (file) {
if (ts.fileExtensionIs(file, ".json" /* Extension.Json */)) {
// Valid only if *.json specified
if (!jsonOnlyIncludeRegexes) {
@ -43805,7 +43855,7 @@ var ts;
};
for (var _a = 0, _b = host.readDirectory(basePath, ts.flatten(supportedExtensionsWithJsonIfResolveJsonModule), validatedExcludeSpecs, validatedIncludeSpecs, /*depth*/ undefined); _a < _b.length; _a++) {
var file = _b[_a];
_loop_7(file);
_loop_8(file);
}
}
var literalFiles = ts.arrayFrom(literalFileMap.values());
@ -47222,7 +47272,7 @@ var ts;
break;
// 5. other uninstantiated module declarations.
case 269 /* SyntaxKind.ModuleBlock */: {
var state_2 = 0 /* ModuleInstanceState.NonInstantiated */;
var state_3 = 0 /* ModuleInstanceState.NonInstantiated */;
ts.forEachChild(node, function (n) {
var childState = getModuleInstanceStateCached(n, visited);
switch (childState) {
@ -47231,17 +47281,17 @@ var ts;
return;
case 2 /* ModuleInstanceState.ConstEnumOnly */:
// child is const enum only - record state and continue searching
state_2 = 2 /* ModuleInstanceState.ConstEnumOnly */;
state_3 = 2 /* ModuleInstanceState.ConstEnumOnly */;
return;
case 1 /* ModuleInstanceState.Instantiated */:
// child is instantiated - record state and stop
state_2 = 1 /* ModuleInstanceState.Instantiated */;
state_3 = 1 /* ModuleInstanceState.Instantiated */;
return true;
default:
ts.Debug.assertNever(childState);
}
});
return state_2;
return state_3;
}
case 268 /* SyntaxKind.ModuleDeclaration */:
return getModuleInstanceState(node, visited);
@ -51907,7 +51957,7 @@ var ts;
function addDuplicateDeclarationError(node, message, symbolName, relatedNodes) {
var errorNode = (ts.getExpandoInitializer(node, /*isPrototypeAssignment*/ false) ? ts.getNameOfExpando(node) : ts.getNameOfDeclaration(node)) || node;
var err = lookupOrIssueError(errorNode, message, symbolName);
var _loop_8 = function (relatedNode) {
var _loop_9 = function (relatedNode) {
var adjustedNode = (ts.getExpandoInitializer(relatedNode, /*isPrototypeAssignment*/ false) ? ts.getNameOfExpando(relatedNode) : ts.getNameOfDeclaration(relatedNode)) || relatedNode;
if (adjustedNode === errorNode)
return "continue";
@ -51920,7 +51970,7 @@ var ts;
};
for (var _i = 0, _a = relatedNodes || ts.emptyArray; _i < _a.length; _i++) {
var relatedNode = _a[_i];
_loop_8(relatedNode);
_loop_9(relatedNode);
}
}
function combineSymbolTables(first, second) {
@ -54707,7 +54757,7 @@ var ts;
}
function forEachSymbolTableInScope(enclosingDeclaration, callback) {
var result;
var _loop_9 = function (location) {
var _loop_10 = function (location) {
// Locals of a source file are not in scope (because they get merged into the global symbol table)
if (location.locals && !isGlobalSourceFile(location)) {
if (result = callback(location.locals, /*ignoreQualification*/ undefined, /*isLocalNameLookup*/ true, location)) {
@ -54753,9 +54803,9 @@ var ts;
}
};
for (var location = enclosingDeclaration; location; location = location.parent) {
var state_3 = _loop_9(location);
if (typeof state_3 === "object")
return state_3.value;
var state_4 = _loop_10(location);
if (typeof state_4 === "object")
return state_4.value;
}
return callback(globals, /*ignoreQualification*/ undefined, /*isLocalNameLookup*/ true);
}
@ -57158,7 +57208,7 @@ var ts;
if (ts.length(reexports) > 1) {
var groups = ts.group(reexports, function (decl) { return ts.isStringLiteral(decl.moduleSpecifier) ? ">" + decl.moduleSpecifier.text : ">"; });
if (groups.length !== reexports.length) {
var _loop_10 = function (group_1) {
var _loop_11 = function (group_1) {
if (group_1.length > 1) {
// remove group members from statements and then merge group members and add back to statements
statements = __spreadArray(__spreadArray([], ts.filter(statements, function (s) { return group_1.indexOf(s) === -1; }), true), [
@ -57170,7 +57220,7 @@ var ts;
};
for (var _i = 0, groups_1 = groups; _i < groups_1.length; _i++) {
var group_1 = groups_1[_i];
_loop_10(group_1);
_loop_11(group_1);
}
}
}
@ -61061,7 +61111,7 @@ var ts;
// signatures from the type, whose ordering would be non-obvious)
var masterList = signatureLists[indexWithLengthOverOne !== undefined ? indexWithLengthOverOne : 0];
var results = masterList.slice();
var _loop_11 = function (signatures) {
var _loop_12 = function (signatures) {
if (signatures !== masterList) {
var signature_1 = signatures[0];
ts.Debug.assert(!!signature_1, "getUnionSignatures bails early on empty signature lists and should not have empty lists on second pass");
@ -61073,8 +61123,8 @@ var ts;
};
for (var _b = 0, signatureLists_1 = signatureLists; _b < signatureLists_1.length; _b++) {
var signatures = signatureLists_1[_b];
var state_4 = _loop_11(signatures);
if (state_4 === "break")
var state_5 = _loop_12(signatures);
if (state_5 === "break")
break;
}
result = results;
@ -61180,7 +61230,7 @@ var ts;
var sourceInfos = getIndexInfosOfType(types[0]);
if (sourceInfos) {
var result = [];
var _loop_12 = function (info) {
var _loop_13 = function (info) {
var indexType = info.keyType;
if (ts.every(types, function (t) { return !!getIndexInfoOfType(t, indexType); })) {
result.push(createIndexInfo(indexType, getUnionType(ts.map(types, function (t) { return getIndexTypeOfType(t, indexType); })), ts.some(types, function (t) { return getIndexInfoOfType(t, indexType).isReadonly; })));
@ -61188,7 +61238,7 @@ var ts;
};
for (var _i = 0, sourceInfos_1 = sourceInfos; _i < sourceInfos_1.length; _i++) {
var info = sourceInfos_1[_i];
_loop_12(info);
_loop_13(info);
}
return result;
}
@ -61235,7 +61285,7 @@ var ts;
var types = type.types;
var mixinFlags = findMixins(types);
var mixinCount = ts.countWhere(mixinFlags, function (b) { return b; });
var _loop_13 = function (i) {
var _loop_14 = function (i) {
var t = type.types[i];
// When an intersection type contains mixin constructor types, the construct signatures from
// those types are discarded and their return types are mixed into the return types of all
@ -61257,19 +61307,19 @@ var ts;
indexInfos = ts.reduceLeft(getIndexInfosOfType(t), function (infos, newInfo) { return appendIndexInfo(infos, newInfo, /*union*/ false); }, indexInfos);
};
for (var i = 0; i < types.length; i++) {
_loop_13(i);
_loop_14(i);
}
setStructuredTypeMembers(type, emptySymbols, callSignatures || ts.emptyArray, constructSignatures || ts.emptyArray, indexInfos || ts.emptyArray);
}
function appendSignatures(signatures, newSignatures) {
var _loop_14 = function (sig) {
var _loop_15 = function (sig) {
if (!signatures || ts.every(signatures, function (s) { return !compareSignaturesIdentical(s, sig, /*partialMatch*/ false, /*ignoreThisTypes*/ false, /*ignoreReturnTypes*/ false, compareTypesIdentical); })) {
signatures = ts.append(signatures, sig);
}
};
for (var _i = 0, newSignatures_1 = newSignatures; _i < newSignatures_1.length; _i++) {
var sig = newSignatures_1[_i];
_loop_14(sig);
_loop_15(sig);
}
return signatures;
}
@ -62290,7 +62340,7 @@ var ts;
}
function getCommonDeclarationsOfSymbols(symbols) {
var commonDeclarations;
var _loop_15 = function (symbol) {
var _loop_16 = function (symbol) {
if (!symbol.declarations) {
return { value: undefined };
}
@ -62309,9 +62359,9 @@ var ts;
};
for (var _i = 0, symbols_3 = symbols; _i < symbols_3.length; _i++) {
var symbol = symbols_3[_i];
var state_5 = _loop_15(symbol);
if (typeof state_5 === "object")
return state_5.value;
var state_6 = _loop_16(symbol);
if (typeof state_6 === "object")
return state_6.value;
}
return commonDeclarations;
}
@ -63029,7 +63079,7 @@ var ts;
function getIndexInfosOfIndexSymbol(indexSymbol) {
if (indexSymbol.declarations) {
var indexInfos_4 = [];
var _loop_16 = function (declaration) {
var _loop_17 = function (declaration) {
if (declaration.parameters.length === 1) {
var parameter = declaration.parameters[0];
if (parameter.type) {
@ -63043,7 +63093,7 @@ var ts;
};
for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
_loop_16(declaration);
_loop_17(declaration);
}
return indexInfos_4;
}
@ -63060,7 +63110,7 @@ var ts;
var _a;
var inferences;
if ((_a = typeParameter.symbol) === null || _a === void 0 ? void 0 : _a.declarations) {
var _loop_17 = function (declaration) {
var _loop_18 = function (declaration) {
if (declaration.parent.kind === 194 /* SyntaxKind.InferType */) {
// When an 'infer T' declaration is immediately contained in a type reference node
// (such as 'Foo<infer T>'), T's constraint is inferred from the constraint of the
@ -63124,7 +63174,7 @@ var ts;
};
for (var _i = 0, _b = typeParameter.symbol.declarations; _i < _b.length; _i++) {
var declaration = _b[_i];
_loop_17(declaration);
_loop_18(declaration);
}
}
return inferences && getIntersectionType(inferences);
@ -64024,7 +64074,7 @@ var ts;
var lastRequiredIndex = -1;
var firstRestIndex = -1;
var lastOptionalOrRestIndex = -1;
var _loop_18 = function (i) {
var _loop_19 = function (i) {
var type = elementTypes[i];
var flags = target.elementFlags[i];
if (flags & 8 /* ElementFlags.Variadic */) {
@ -64054,9 +64104,9 @@ var ts;
}
};
for (var i = 0; i < elementTypes.length; i++) {
var state_6 = _loop_18(i);
if (typeof state_6 === "object")
return state_6.value;
var state_7 = _loop_19(i);
if (typeof state_7 === "object")
return state_7.value;
}
// Turn optional elements preceding the last required element into required elements
for (var i = 0; i < lastRequiredIndex; i++) {
@ -64250,7 +64300,7 @@ var ts;
var templates = ts.filter(types, isPatternLiteralType);
if (templates.length) {
var i = types.length;
var _loop_19 = function () {
var _loop_20 = function () {
i--;
var t = types[i];
if (t.flags & 128 /* TypeFlags.StringLiteral */ && ts.some(templates, function (template) { return isTypeMatchedByTemplateLiteralType(t, template); })) {
@ -64258,7 +64308,7 @@ var ts;
}
};
while (i > 0) {
_loop_19();
_loop_20();
}
}
}
@ -64335,14 +64385,14 @@ var ts;
var namedUnions = [];
addNamedUnions(namedUnions, types);
var reducedTypes = [];
var _loop_20 = function (t) {
var _loop_21 = function (t) {
if (!ts.some(namedUnions, function (union) { return containsType(union.types, t); })) {
reducedTypes.push(t);
}
};
for (var _i = 0, typeSet_1 = typeSet; _i < typeSet_1.length; _i++) {
var t = typeSet_1[_i];
_loop_20(t);
_loop_21(t);
}
if (!aliasSymbol && namedUnions.length === 1 && reducedTypes.length === 0) {
return namedUnions[0];
@ -68299,7 +68349,7 @@ var ts;
reducedTarget = findMatchingDiscriminantType(source, target, isRelatedTo) || filterPrimitivesIfContainsNonPrimitive(target);
checkTypes = reducedTarget.flags & 1048576 /* TypeFlags.Union */ ? reducedTarget.types : [reducedTarget];
}
var _loop_21 = function (prop) {
var _loop_22 = function (prop) {
if (shouldCheckAsExcessProperty(prop, source.symbol) && !isIgnoredJsxProperty(source, prop)) {
if (!isKnownProperty(reducedTarget, prop.escapedName, isComparingJsxAttributes)) {
if (reportErrors) {
@ -68362,9 +68412,9 @@ var ts;
};
for (var _i = 0, _b = getPropertiesOfType(source); _i < _b.length; _i++) {
var prop = _b[_i];
var state_7 = _loop_21(prop);
if (typeof state_7 === "object")
return state_7.value;
var state_8 = _loop_22(prop);
if (typeof state_8 === "object")
return state_8.value;
}
return false;
}
@ -69374,11 +69424,11 @@ var ts;
// constituents of 'target'. If any combination does not have a match then 'source' is not relatable.
var discriminantCombinations = ts.cartesianProduct(sourceDiscriminantTypes);
var matchingTypes = [];
var _loop_22 = function (combination) {
var _loop_23 = function (combination) {
var hasMatch = false;
outer: for (var _c = 0, _d = target.types; _c < _d.length; _c++) {
var type = _d[_c];
var _loop_23 = function (i) {
var _loop_24 = function (i) {
var sourceProperty = sourcePropertiesFiltered[i];
var targetProperty = getPropertyOfType(type, sourceProperty.escapedName);
if (!targetProperty)
@ -69394,8 +69444,8 @@ var ts;
}
};
for (var i = 0; i < sourcePropertiesFiltered.length; i++) {
var state_9 = _loop_23(i);
switch (state_9) {
var state_10 = _loop_24(i);
switch (state_10) {
case "continue-outer": continue outer;
}
}
@ -69408,9 +69458,9 @@ var ts;
};
for (var _a = 0, discriminantCombinations_1 = discriminantCombinations; _a < discriminantCombinations_1.length; _a++) {
var combination = discriminantCombinations_1[_a];
var state_8 = _loop_22(combination);
if (typeof state_8 === "object")
return state_8.value;
var state_9 = _loop_23(combination);
if (typeof state_9 === "object")
return state_9.value;
}
// Compare the remaining non-discriminant properties of each match.
var result = -1 /* Ternary.True */;
@ -70115,7 +70165,7 @@ var ts;
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes" /* tracing.Phase.CheckTypes */, "getVariancesWorker", { arity: typeParameters.length, id: getTypeId(getDeclaredTypeOfSymbol(symbol)) });
links.variances = ts.emptyArray;
var variances = [];
var _loop_24 = function (tp) {
var _loop_25 = function (tp) {
var modifiers = getVarianceModifiers(tp);
var variance = modifiers & 65536 /* ModifierFlags.Out */ ?
modifiers & 32768 /* ModifierFlags.In */ ? 0 /* VarianceFlags.Invariant */ : 1 /* VarianceFlags.Covariant */ :
@ -70153,7 +70203,7 @@ var ts;
};
for (var _i = 0, typeParameters_2 = typeParameters; _i < typeParameters_2.length; _i++) {
var tp = typeParameters_2[_i];
_loop_24(tp);
_loop_25(tp);
}
links.variances = variances;
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop({ variances: variances.map(ts.Debug.formatVariance) });
@ -72113,7 +72163,7 @@ var ts;
// upon instantiation, would collapse all the placeholders to just 'string', and an assignment check might
// succeed. That would be a pointless and confusing outcome.
if (matches || ts.every(target.texts, function (s) { return s.length === 0; })) {
var _loop_25 = function (i) {
var _loop_26 = function (i) {
var source_1 = matches ? matches[i] : neverType;
var target_3 = types[i];
// If we are inferring from a string literal type to a type variable whose constraint includes one of the
@ -72163,7 +72213,7 @@ var ts;
inferFromTypes(source_1, target_3);
};
for (var i = 0; i < types.length; i++) {
_loop_25(i);
_loop_26(i);
}
}
}
@ -72692,7 +72742,7 @@ var ts;
function mapTypesByKeyProperty(types, name) {
var map = new ts.Map();
var count = 0;
var _loop_26 = function (type) {
var _loop_27 = function (type) {
if (type.flags & (524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */)) {
var discriminant = getTypeOfPropertyOfType(type, name);
if (discriminant) {
@ -72718,9 +72768,9 @@ var ts;
};
for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
var type = types_15[_i];
var state_10 = _loop_26(type);
if (typeof state_10 === "object")
return state_10.value;
var state_11 = _loop_27(type);
if (typeof state_11 === "object")
return state_11.value;
}
return count >= 10 && count * 2 >= types.length ? map : undefined;
}
@ -79267,7 +79317,7 @@ var ts;
if (spreadIndex >= 0) {
// Create synthetic arguments from spreads of tuple types.
var effectiveArgs_1 = args.slice(0, spreadIndex);
var _loop_27 = function (i) {
var _loop_28 = function (i) {
var arg = args[i];
// We can call checkExpressionCached because spread expressions never have a contextual type.
var spreadType = arg.kind === 230 /* SyntaxKind.SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression));
@ -79284,7 +79334,7 @@ var ts;
}
};
for (var i = spreadIndex; i < args.length; i++) {
_loop_27(i);
_loop_28(i);
}
return effectiveArgs_1;
}
@ -79636,7 +79686,7 @@ var ts;
var min_3 = Number.MAX_VALUE;
var minIndex = 0;
var i_1 = 0;
var _loop_28 = function (c) {
var _loop_29 = function (c) {
var chain_2 = function () { return ts.chainDiagnosticMessages(/*details*/ undefined, ts.Diagnostics.Overload_0_of_1_2_gave_the_following_error, i_1 + 1, candidates.length, signatureToString(c)); };
var diags_2 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0 /* CheckMode.Normal */, /*reportErrors*/ true, chain_2);
if (diags_2) {
@ -79654,7 +79704,7 @@ var ts;
};
for (var _a = 0, candidatesForArgumentError_1 = candidatesForArgumentError; _a < candidatesForArgumentError_1.length; _a++) {
var c = candidatesForArgumentError_1[_a];
_loop_28(c);
_loop_29(c);
}
var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics);
ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures");
@ -79812,7 +79862,7 @@ var ts;
}
var _a = ts.minAndMax(candidates, getNumNonRestParameters), minArgumentCount = _a.min, maxNonRestParam = _a.max;
var parameters = [];
var _loop_29 = function (i) {
var _loop_30 = function (i) {
var symbols = ts.mapDefined(candidates, function (s) { return signatureHasRestParameter(s) ?
i < s.parameters.length - 1 ? s.parameters[i] : ts.last(s.parameters) :
i < s.parameters.length ? s.parameters[i] : undefined; });
@ -79820,7 +79870,7 @@ var ts;
parameters.push(createCombinedSymbolFromTypes(symbols, ts.mapDefined(candidates, function (candidate) { return tryGetTypeAtPosition(candidate, i); })));
};
for (var i = 0; i < maxNonRestParam; i++) {
_loop_29(i);
_loop_30(i);
}
var restParameterSymbols = ts.mapDefined(candidates, function (c) { return signatureHasRestParameter(c) ? ts.last(c.parameters) : undefined; });
var flags = 0 /* SignatureFlags.None */;
@ -80767,7 +80817,7 @@ var ts;
}
function expressionCheckByJsDoc(declaration, node, sourceFile, checkConfig) {
var jsDocTags = ts.getJSDocTags(declaration);
var _loop_30 = function (i) {
var _loop_31 = function (i) {
var config = checkConfig[i];
var tagNameCheckNecessity = true;
if (config.checkJsDocSpecialValidCallback) {
@ -80800,7 +80850,7 @@ var ts;
}
};
for (var i = 0; i < checkConfig.length; i++) {
_loop_30(i);
_loop_31(i);
}
}
function collectDiagnostics(config, node, diagnostic) {
@ -84231,7 +84281,7 @@ var ts;
var indexSymbol = getIndexSymbol(getSymbolOfNode(node));
if (indexSymbol === null || indexSymbol === void 0 ? void 0 : indexSymbol.declarations) {
var indexSignatureMap_1 = new ts.Map();
var _loop_31 = function (declaration) {
var _loop_32 = function (declaration) {
if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
forEachType(getTypeFromTypeNode(declaration.parameters[0].type), function (type) {
var entry = indexSignatureMap_1.get(getTypeId(type));
@ -84246,7 +84296,7 @@ var ts;
};
for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
_loop_31(declaration);
_loop_32(declaration);
}
indexSignatureMap_1.forEach(function (entry) {
if (entry.declarations.length > 1) {
@ -87891,7 +87941,7 @@ var ts;
var propDeclaration = declaration && declaration.kind === 226 /* SyntaxKind.BinaryExpression */ ||
name && name.kind === 166 /* SyntaxKind.ComputedPropertyName */ ? declaration : undefined;
var localPropDeclaration = getParentOfSymbol(prop) === type.symbol ? declaration : undefined;
var _loop_32 = function (info) {
var _loop_33 = function (info) {
var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
// We check only when (a) the property is declared in the containing type, or (b) the applicable index signature is declared
// in the containing type, or (c) the containing type is an interface and no base interface contains both the property and
@ -87908,7 +87958,7 @@ var ts;
};
for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) {
var info = indexInfos_9[_i];
_loop_32(info);
_loop_33(info);
}
}
function checkIndexConstraintForIndexSignature(type, checkInfo) {
@ -87916,7 +87966,7 @@ var ts;
var indexInfos = getApplicableIndexInfos(type, checkInfo.keyType);
var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 265 /* SyntaxKind.InterfaceDeclaration */) : undefined;
var localCheckDeclaration = declaration && getParentOfSymbol(getSymbolOfNode(declaration)) === type.symbol ? declaration : undefined;
var _loop_33 = function (info) {
var _loop_34 = function (info) {
if (info === checkInfo)
return "continue";
var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
@ -87931,7 +87981,7 @@ var ts;
};
for (var _i = 0, indexInfos_10 = indexInfos; _i < indexInfos_10.length; _i++) {
var info = indexInfos_10[_i];
_loop_33(info);
_loop_34(info);
}
}
function checkTypeNameIsReserved(name, message) {
@ -88271,7 +88321,7 @@ var ts;
var baseTypes = baseTypeNode && getBaseTypes(type);
var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined;
var baseStaticType = getBaseConstructorTypeOfClass(type);
var _loop_34 = function (member) {
var _loop_35 = function (member) {
if (ts.hasAmbientModifier(member)) {
return "continue";
}
@ -88288,7 +88338,7 @@ var ts;
};
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
var member = _a[_i];
_loop_34(member);
_loop_35(member);
}
}
/**
@ -88376,7 +88426,7 @@ var ts;
function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) {
// iterate over all implemented properties and issue errors on each one which isn't compatible, rather than the class as a whole, if possible
var issuedMemberError = false;
var _loop_35 = function (member) {
var _loop_36 = function (member) {
if (ts.isStatic(member)) {
return "continue";
}
@ -88395,7 +88445,7 @@ var ts;
};
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
var member = _a[_i];
_loop_35(member);
_loop_36(member);
}
if (!issuedMemberError) {
// check again with diagnostics to generate a less-specific error
@ -88466,7 +88516,7 @@ var ts;
var _a, _b, _c, _d;
// NOTE: assignability is checked in checkClassDeclaration
var baseProperties = getPropertiesOfType(baseType);
var _loop_36 = function (baseProperty) {
var _loop_37 = function (baseProperty) {
var base = getTargetSymbol(baseProperty);
if (base.flags & 4194304 /* SymbolFlags.Prototype */) {
return "continue";
@ -88576,8 +88626,8 @@ var ts;
};
basePropertyCheck: for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {
var baseProperty = baseProperties_1[_i];
var state_11 = _loop_36(baseProperty);
switch (state_11) {
var state_12 = _loop_37(baseProperty);
switch (state_12) {
case "continue-basePropertyCheck": continue basePropertyCheck;
}
}
@ -127935,7 +127985,7 @@ var ts;
});
// Sort by paths closest to importing file Name directory
var sortedPaths = [];
var _loop_37 = function (directory) {
var _loop_38 = function (directory) {
var directoryStart = ts.ensureTrailingDirectorySeparator(directory);
var pathsInDirectory;
allFileNames.forEach(function (_a, fileName) {
@ -127959,9 +128009,9 @@ var ts;
};
var out_directory_1;
for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
var state_12 = _loop_37(directory);
var state_13 = _loop_38(directory);
directory = out_directory_1;
if (state_12 === "break")
if (state_13 === "break")
break;
}
if (allFileNames.size) {
@ -128030,7 +128080,7 @@ var ts;
}
function tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions) {
for (var key in paths) {
var _loop_38 = function (patternText_1) {
var _loop_39 = function (patternText_1) {
var pattern = ts.normalizePath(patternText_1);
var indexOfStar = pattern.indexOf("*");
// In module resolution, if `pattern` itself has an extension, a file with that extension is looked up directly,
@ -128097,9 +128147,9 @@ var ts;
};
for (var _i = 0, _a = paths[key]; _i < _a.length; _i++) {
var patternText_1 = _a[_i];
var state_13 = _loop_38(patternText_1);
if (typeof state_13 === "object")
return state_13.value;
var state_14 = _loop_39(patternText_1);
if (typeof state_14 === "object")
return state_14.value;
}
}
function validateEnding(_a) {

View File

@ -553,7 +553,9 @@ declare namespace ts {
EtsBuilderContext = 32,
EtsStateStylesContext = 64,
EtsComponentsContext = 128,
EtsNewExpressionContext = 256
EtsNewExpressionContext = 256,
UICallbackContext = 512,
SyntaxComponentContext = 1024
}
export enum ModifierFlags {
None = 0,
@ -3210,6 +3212,13 @@ declare namespace ts {
name: string;
emitParameters: boolean;
}[];
syntaxComponents: {
paramsUICallback: string[];
attrUICallback: {
name: string;
attributes: string[];
}[];
};
}
export interface WatchOptions {
watchFile?: WatchFileKind;

View File

@ -4638,6 +4638,8 @@ var ts;
EtsFlags[EtsFlags["EtsStateStylesContext"] = 64] = "EtsStateStylesContext";
EtsFlags[EtsFlags["EtsComponentsContext"] = 128] = "EtsComponentsContext";
EtsFlags[EtsFlags["EtsNewExpressionContext"] = 256] = "EtsNewExpressionContext";
EtsFlags[EtsFlags["UICallbackContext"] = 512] = "UICallbackContext";
EtsFlags[EtsFlags["SyntaxComponentContext"] = 1024] = "SyntaxComponentContext";
})(EtsFlags = ts.EtsFlags || (ts.EtsFlags = {}));
var ModifierFlags;
(function (ModifierFlags) {
@ -17772,6 +17774,18 @@ var ts;
return undefined;
}
ts.getRootEtsComponent = getRootEtsComponent;
function getRootComponent(node, compilerOptions) {
var _a, _b, _c;
while (node) {
if (ts.isEtsComponentExpression(node) || ts.isCallExpression(node) && ts.isIdentifier(node.expression) &&
((_c = (_b = (_a = compilerOptions.ets) === null || _a === void 0 ? void 0 : _a.syntaxComponents) === null || _b === void 0 ? void 0 : _b.attrUICallback) === null || _c === void 0 ? void 0 : _c.map(function (item) { return item.name; }).includes(node.expression.escapedText.toString()))) {
return node;
}
node = node.expression;
}
return undefined;
}
ts.getRootComponent = getRootComponent;
function getVirtualEtsComponent(node) {
while (node) {
if (ts.isPropertyAccessExpression(node) && node.expression && node.expression.virtual) {
@ -32982,6 +32996,12 @@ var ts;
function setEtsStateStylesContext(val) {
setEtsFlag(val, 64 /* EtsFlags.EtsStateStylesContext */);
}
function setUICallbackContext(val) {
setEtsFlag(val, 512 /* EtsFlags.UICallbackContext */);
}
function setSyntaxComponentContext(val) {
setEtsFlag(val, 1024 /* EtsFlags.SyntaxComponentContext */);
}
function doOutsideOfContext(context, func) {
// contextFlagsToClear will contain only the context flags that are
// currently set that we need to temporarily clear
@ -33112,6 +33132,12 @@ var ts;
function inEtsStateStylesContext() {
return inEtsContext() && (inBuildContext() || inBuilderContext() || inEtsExtendComponentsContext() || inEtsStylesComponentsContext()) && inEtsFlagsContext(64 /* EtsFlags.EtsStateStylesContext */);
}
function inUICallbackContext() {
return inEtsContext() && (inBuildContext() || inBuilderContext()) && inEtsFlagsContext(512 /* EtsFlags.UICallbackContext */);
}
function inSyntaxComponentContext() {
return inEtsContext() && (inBuildContext() || inBuilderContext()) && inEtsFlagsContext(1024 /* EtsFlags.SyntaxComponentContext */);
}
function parseErrorAtPosition(start, length, message, arg0) {
// Don't report another error if it would just be at the same position as the last error.
var lastError = ts.lastOrUndefined(parseDiagnostics);
@ -35653,7 +35679,7 @@ var ts;
return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher(allowReturnTypeInArrowFunction), pos);
}
// It's a CallExpression with open brace followed, therefore, we think it's an EtsComponentExpression
if ((inStructContext() || inBuildContext() || inBuilderContext()) && ts.isCallExpression(expr) && token() === 18 /* SyntaxKind.OpenBraceToken */) {
if ((inBuildContext() || inBuilderContext()) && inUICallbackContext() && ts.isCallExpression(expr) && token() === 18 /* SyntaxKind.OpenBraceToken */) {
return makeEtsComponentExpression(expr, pos);
}
// It wasn't an assignment or a lambda. This is a conditional expression:
@ -35976,9 +36002,13 @@ var ts;
// have an opening brace, just in case we're in an error state.
var lastToken = token();
var equalsGreaterThanToken = parseExpectedToken(38 /* SyntaxKind.EqualsGreaterThanToken */);
var originUIContextFlag = inUICallbackContext();
setUICallbackContext(inSyntaxComponentContext() ? true : false);
setSyntaxComponentContext(false);
var body = (lastToken === 38 /* SyntaxKind.EqualsGreaterThanToken */ || lastToken === 18 /* SyntaxKind.OpenBraceToken */)
? parseArrowFunctionExpressionBody(ts.some(modifiers, ts.isAsyncModifier), allowReturnTypeInArrowFunction)
: parseIdentifier();
setUICallbackContext(originUIContextFlag);
// Given:
// x ? y => ({ y }) : z => ({ z })
// We try to parse the body of the first arrow function by looking at:
@ -36854,9 +36884,9 @@ var ts;
return finishNode(tagExpression, pos);
}
function parseCallExpressionRest(pos, expression) {
var _a, _b, _c, _d, _e, _f;
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
var currentNodeName;
while (true) {
var _loop_5 = function () {
expression = parseMemberExpressionRest(pos, expression, /*allowOptionalChain*/ true);
var typeArguments = void 0;
var questionDotToken = parseOptionalToken(28 /* SyntaxKind.QuestionDotToken */);
@ -36864,7 +36894,7 @@ var ts;
typeArguments = tryParse(parseTypeArgumentsInExpression);
if (isTemplateStartOfTaggedTemplate()) {
expression = parseTaggedTemplateRest(pos, expression, questionDotToken, typeArguments);
continue;
return "continue";
}
}
if (typeArguments || token() === 20 /* SyntaxKind.OpenParenToken */) {
@ -36874,19 +36904,27 @@ var ts;
expression = expression.expression;
}
if (isValidVirtualTypeArgumentsContext() && ts.isPropertyAccessExpression(expression)) {
var rootNode = ts.getRootEtsComponent(expression);
var rootNode = ts.getRootComponent(expression, sourceFileCompilerOptions);
if (rootNode) {
var rootNodeName = (rootNode.expression).escapedText.toString();
var rootNodeName_1 = (rootNode.expression).escapedText.toString();
currentNodeName = ts.getTextOfPropertyName(expression.name).toString();
if (currentNodeName === ((_b = (_a = sourceFileCompilerOptions === null || sourceFileCompilerOptions === void 0 ? void 0 : sourceFileCompilerOptions.ets) === null || _a === void 0 ? void 0 : _a.styles) === null || _b === void 0 ? void 0 : _b.property)) {
setEtsStateStylesContext(true);
stateStylesRootNode = rootNodeName;
stateStylesRootNode = rootNodeName_1;
}
else {
setEtsStateStylesContext(false);
stateStylesRootNode = undefined;
}
typeArguments = parseEtsTypeArguments(pos, "".concat(rootNodeName, "Attribute"));
if ((_e = (_d = (_c = sourceFileCompilerOptions === null || sourceFileCompilerOptions === void 0 ? void 0 : sourceFileCompilerOptions.ets) === null || _c === void 0 ? void 0 : _c.syntaxComponents) === null || _d === void 0 ? void 0 : _d.attrUICallback) === null || _e === void 0 ? void 0 : _e.map(function (item) { return item.name; }).includes(rootNodeName_1)) {
var syntaxComponents = (_h = (_g = (_f = sourceFileCompilerOptions === null || sourceFileCompilerOptions === void 0 ? void 0 : sourceFileCompilerOptions.ets) === null || _f === void 0 ? void 0 : _f.syntaxComponents) === null || _g === void 0 ? void 0 : _g.attrUICallback) === null || _h === void 0 ? void 0 : _h.filter(function (item) { return item.name === rootNodeName_1; });
if (syntaxComponents.length && ((_k = (_j = syntaxComponents[0]) === null || _j === void 0 ? void 0 : _j.attributes) === null || _k === void 0 ? void 0 : _k.includes(currentNodeName))) {
setSyntaxComponentContext(true);
}
}
else {
typeArguments = parseEtsTypeArguments(pos, "".concat(rootNodeName_1, "Attribute"));
}
}
else if (inEtsStateStylesContext() && stateStylesRootNode) {
typeArguments = parseEtsTypeArguments(pos, "".concat(stateStylesRootNode, "Attribute"));
@ -36896,7 +36934,7 @@ var ts;
if (virtualNode) {
var rootNodeName = (virtualNode.expression).escapedText.toString();
currentNodeName = ts.getTextOfPropertyName(expression.name).toString();
if (currentNodeName === ((_d = (_c = sourceFileCompilerOptions === null || sourceFileCompilerOptions === void 0 ? void 0 : sourceFileCompilerOptions.ets) === null || _c === void 0 ? void 0 : _c.styles) === null || _d === void 0 ? void 0 : _d.property)) {
if (currentNodeName === ((_m = (_l = sourceFileCompilerOptions === null || sourceFileCompilerOptions === void 0 ? void 0 : sourceFileCompilerOptions.ets) === null || _l === void 0 ? void 0 : _l.styles) === null || _m === void 0 ? void 0 : _m.property)) {
setEtsStateStylesContext(true);
rootNodeName = rootNodeName.replace("Instance", "");
stateStylesRootNode = rootNodeName;
@ -36905,21 +36943,30 @@ var ts;
}
}
}
if (isValidVirtualTypeArgumentsContext() && ts.isIdentifier(expression) &&
((_q = (_p = (_o = sourceFileCompilerOptions === null || sourceFileCompilerOptions === void 0 ? void 0 : sourceFileCompilerOptions.ets) === null || _o === void 0 ? void 0 : _o.syntaxComponents) === null || _p === void 0 ? void 0 : _p.paramsUICallback) === null || _q === void 0 ? void 0 : _q.includes(expression.escapedText.toString()))) {
setSyntaxComponentContext(true);
}
var argumentList = parseArgumentList();
var callExpr = questionDotToken || tryReparseOptionalChain(expression) ?
factory.createCallChain(expression, questionDotToken, typeArguments, argumentList) :
factory.createCallExpression(expression, typeArguments, argumentList);
expression = finishNode(callExpr, pos);
continue;
return "continue";
}
if (questionDotToken) {
// We parsed `?.` but then failed to parse anything, so report a missing identifier here.
var name = createMissingNode(79 /* SyntaxKind.Identifier */, /*reportAtCurrentPosition*/ false, ts.Diagnostics.Identifier_expected);
expression = finishNode(factory.createPropertyAccessChain(expression, questionDotToken, name), pos);
}
break;
return "break";
};
while (true) {
var state_2 = _loop_5();
if (state_2 === "break")
break;
}
if (currentNodeName === ((_f = (_e = sourceFileCompilerOptions === null || sourceFileCompilerOptions === void 0 ? void 0 : sourceFileCompilerOptions.ets) === null || _e === void 0 ? void 0 : _e.styles) === null || _f === void 0 ? void 0 : _f.property)) {
if (currentNodeName === ((_s = (_r = sourceFileCompilerOptions === null || sourceFileCompilerOptions === void 0 ? void 0 : sourceFileCompilerOptions.ets) === null || _r === void 0 ? void 0 : _r.styles) === null || _s === void 0 ? void 0 : _s.property)) {
setEtsStateStylesContext(false);
stateStylesRootNode = undefined;
}
@ -38051,8 +38098,10 @@ var ts;
var methodName = (_a = ts.getPropertyNameForPropertyNameNode(name)) === null || _a === void 0 ? void 0 : _a.toString();
var orignalEtsBuildContext = inBuildContext();
var orignalEtsBuilderContext = inBuilderContext();
var orignalUICallbackContext = inUICallbackContext();
setEtsBuildContext(methodName === ((_d = (_c = (_b = sourceFileCompilerOptions === null || sourceFileCompilerOptions === void 0 ? void 0 : sourceFileCompilerOptions.ets) === null || _b === void 0 ? void 0 : _b.render) === null || _c === void 0 ? void 0 : _c.method) === null || _d === void 0 ? void 0 : _d.find(function (render) { return render === "build"; })));
setEtsBuilderContext(ts.hasEtsBuilderDecoratorNames(decorators, sourceFileCompilerOptions));
setUICallbackContext(inBuildContext() || inBuilderContext());
if (inStructContext() && ts.hasEtsStylesDecoratorNames(decorators, sourceFileCompilerOptions)) {
if (methodName && currentStructName) {
structStylesComponents.set(methodName, { structName: currentStructName, kind: 173 /* SyntaxKind.MethodDeclaration */ });
@ -38078,6 +38127,7 @@ var ts;
node.exclamationToken = exclamationToken;
setEtsBuildContext(orignalEtsBuildContext);
setEtsBuilderContext(orignalEtsBuilderContext);
setUICallbackContext(orignalUICallbackContext);
setEtsStylesComponentsContext(false);
stylesEtsComponentDeclaration = undefined;
setEtsComponentsContext(orignalEtsComponentsContext);
@ -42705,7 +42755,7 @@ var ts;
}
function convertObjectLiteralExpressionToJson(node, knownOptions, extraKeyDiagnostics, parentOption) {
var result = returnValue ? {} : undefined;
var _loop_5 = function (element) {
var _loop_6 = function (element) {
if (element.kind !== 303 /* SyntaxKind.PropertyAssignment */) {
errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, element, ts.Diagnostics.Property_assignment_expected));
return "continue";
@ -42758,7 +42808,7 @@ var ts;
};
for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
var element = _a[_i];
_loop_5(element);
_loop_6(element);
}
return result;
}
@ -42959,7 +43009,7 @@ var ts;
var optionsNameMap = _a.optionsNameMap;
var result = new ts.Map();
var getCanonicalFileName = pathOptions && ts.createGetCanonicalFileName(pathOptions.useCaseSensitiveFileNames);
var _loop_6 = function (name) {
var _loop_7 = function (name) {
if (ts.hasProperty(options, name)) {
// tsconfig only options cannot be specified via command line,
// so we can assume that only types that can appear here string | number | boolean
@ -42993,7 +43043,7 @@ var ts;
}
};
for (var name in options) {
_loop_6(name);
_loop_7(name);
}
return result;
}
@ -43767,7 +43817,7 @@ var ts;
}
var jsonOnlyIncludeRegexes;
if (validatedIncludeSpecs && validatedIncludeSpecs.length > 0) {
var _loop_7 = function (file) {
var _loop_8 = function (file) {
if (ts.fileExtensionIs(file, ".json" /* Extension.Json */)) {
// Valid only if *.json specified
if (!jsonOnlyIncludeRegexes) {
@ -43805,7 +43855,7 @@ var ts;
};
for (var _a = 0, _b = host.readDirectory(basePath, ts.flatten(supportedExtensionsWithJsonIfResolveJsonModule), validatedExcludeSpecs, validatedIncludeSpecs, /*depth*/ undefined); _a < _b.length; _a++) {
var file = _b[_a];
_loop_7(file);
_loop_8(file);
}
}
var literalFiles = ts.arrayFrom(literalFileMap.values());
@ -47222,7 +47272,7 @@ var ts;
break;
// 5. other uninstantiated module declarations.
case 269 /* SyntaxKind.ModuleBlock */: {
var state_2 = 0 /* ModuleInstanceState.NonInstantiated */;
var state_3 = 0 /* ModuleInstanceState.NonInstantiated */;
ts.forEachChild(node, function (n) {
var childState = getModuleInstanceStateCached(n, visited);
switch (childState) {
@ -47231,17 +47281,17 @@ var ts;
return;
case 2 /* ModuleInstanceState.ConstEnumOnly */:
// child is const enum only - record state and continue searching
state_2 = 2 /* ModuleInstanceState.ConstEnumOnly */;
state_3 = 2 /* ModuleInstanceState.ConstEnumOnly */;
return;
case 1 /* ModuleInstanceState.Instantiated */:
// child is instantiated - record state and stop
state_2 = 1 /* ModuleInstanceState.Instantiated */;
state_3 = 1 /* ModuleInstanceState.Instantiated */;
return true;
default:
ts.Debug.assertNever(childState);
}
});
return state_2;
return state_3;
}
case 268 /* SyntaxKind.ModuleDeclaration */:
return getModuleInstanceState(node, visited);
@ -51907,7 +51957,7 @@ var ts;
function addDuplicateDeclarationError(node, message, symbolName, relatedNodes) {
var errorNode = (ts.getExpandoInitializer(node, /*isPrototypeAssignment*/ false) ? ts.getNameOfExpando(node) : ts.getNameOfDeclaration(node)) || node;
var err = lookupOrIssueError(errorNode, message, symbolName);
var _loop_8 = function (relatedNode) {
var _loop_9 = function (relatedNode) {
var adjustedNode = (ts.getExpandoInitializer(relatedNode, /*isPrototypeAssignment*/ false) ? ts.getNameOfExpando(relatedNode) : ts.getNameOfDeclaration(relatedNode)) || relatedNode;
if (adjustedNode === errorNode)
return "continue";
@ -51920,7 +51970,7 @@ var ts;
};
for (var _i = 0, _a = relatedNodes || ts.emptyArray; _i < _a.length; _i++) {
var relatedNode = _a[_i];
_loop_8(relatedNode);
_loop_9(relatedNode);
}
}
function combineSymbolTables(first, second) {
@ -54707,7 +54757,7 @@ var ts;
}
function forEachSymbolTableInScope(enclosingDeclaration, callback) {
var result;
var _loop_9 = function (location) {
var _loop_10 = function (location) {
// Locals of a source file are not in scope (because they get merged into the global symbol table)
if (location.locals && !isGlobalSourceFile(location)) {
if (result = callback(location.locals, /*ignoreQualification*/ undefined, /*isLocalNameLookup*/ true, location)) {
@ -54753,9 +54803,9 @@ var ts;
}
};
for (var location = enclosingDeclaration; location; location = location.parent) {
var state_3 = _loop_9(location);
if (typeof state_3 === "object")
return state_3.value;
var state_4 = _loop_10(location);
if (typeof state_4 === "object")
return state_4.value;
}
return callback(globals, /*ignoreQualification*/ undefined, /*isLocalNameLookup*/ true);
}
@ -57158,7 +57208,7 @@ var ts;
if (ts.length(reexports) > 1) {
var groups = ts.group(reexports, function (decl) { return ts.isStringLiteral(decl.moduleSpecifier) ? ">" + decl.moduleSpecifier.text : ">"; });
if (groups.length !== reexports.length) {
var _loop_10 = function (group_1) {
var _loop_11 = function (group_1) {
if (group_1.length > 1) {
// remove group members from statements and then merge group members and add back to statements
statements = __spreadArray(__spreadArray([], ts.filter(statements, function (s) { return group_1.indexOf(s) === -1; }), true), [
@ -57170,7 +57220,7 @@ var ts;
};
for (var _i = 0, groups_1 = groups; _i < groups_1.length; _i++) {
var group_1 = groups_1[_i];
_loop_10(group_1);
_loop_11(group_1);
}
}
}
@ -61061,7 +61111,7 @@ var ts;
// signatures from the type, whose ordering would be non-obvious)
var masterList = signatureLists[indexWithLengthOverOne !== undefined ? indexWithLengthOverOne : 0];
var results = masterList.slice();
var _loop_11 = function (signatures) {
var _loop_12 = function (signatures) {
if (signatures !== masterList) {
var signature_1 = signatures[0];
ts.Debug.assert(!!signature_1, "getUnionSignatures bails early on empty signature lists and should not have empty lists on second pass");
@ -61073,8 +61123,8 @@ var ts;
};
for (var _b = 0, signatureLists_1 = signatureLists; _b < signatureLists_1.length; _b++) {
var signatures = signatureLists_1[_b];
var state_4 = _loop_11(signatures);
if (state_4 === "break")
var state_5 = _loop_12(signatures);
if (state_5 === "break")
break;
}
result = results;
@ -61180,7 +61230,7 @@ var ts;
var sourceInfos = getIndexInfosOfType(types[0]);
if (sourceInfos) {
var result = [];
var _loop_12 = function (info) {
var _loop_13 = function (info) {
var indexType = info.keyType;
if (ts.every(types, function (t) { return !!getIndexInfoOfType(t, indexType); })) {
result.push(createIndexInfo(indexType, getUnionType(ts.map(types, function (t) { return getIndexTypeOfType(t, indexType); })), ts.some(types, function (t) { return getIndexInfoOfType(t, indexType).isReadonly; })));
@ -61188,7 +61238,7 @@ var ts;
};
for (var _i = 0, sourceInfos_1 = sourceInfos; _i < sourceInfos_1.length; _i++) {
var info = sourceInfos_1[_i];
_loop_12(info);
_loop_13(info);
}
return result;
}
@ -61235,7 +61285,7 @@ var ts;
var types = type.types;
var mixinFlags = findMixins(types);
var mixinCount = ts.countWhere(mixinFlags, function (b) { return b; });
var _loop_13 = function (i) {
var _loop_14 = function (i) {
var t = type.types[i];
// When an intersection type contains mixin constructor types, the construct signatures from
// those types are discarded and their return types are mixed into the return types of all
@ -61257,19 +61307,19 @@ var ts;
indexInfos = ts.reduceLeft(getIndexInfosOfType(t), function (infos, newInfo) { return appendIndexInfo(infos, newInfo, /*union*/ false); }, indexInfos);
};
for (var i = 0; i < types.length; i++) {
_loop_13(i);
_loop_14(i);
}
setStructuredTypeMembers(type, emptySymbols, callSignatures || ts.emptyArray, constructSignatures || ts.emptyArray, indexInfos || ts.emptyArray);
}
function appendSignatures(signatures, newSignatures) {
var _loop_14 = function (sig) {
var _loop_15 = function (sig) {
if (!signatures || ts.every(signatures, function (s) { return !compareSignaturesIdentical(s, sig, /*partialMatch*/ false, /*ignoreThisTypes*/ false, /*ignoreReturnTypes*/ false, compareTypesIdentical); })) {
signatures = ts.append(signatures, sig);
}
};
for (var _i = 0, newSignatures_1 = newSignatures; _i < newSignatures_1.length; _i++) {
var sig = newSignatures_1[_i];
_loop_14(sig);
_loop_15(sig);
}
return signatures;
}
@ -62290,7 +62340,7 @@ var ts;
}
function getCommonDeclarationsOfSymbols(symbols) {
var commonDeclarations;
var _loop_15 = function (symbol) {
var _loop_16 = function (symbol) {
if (!symbol.declarations) {
return { value: undefined };
}
@ -62309,9 +62359,9 @@ var ts;
};
for (var _i = 0, symbols_3 = symbols; _i < symbols_3.length; _i++) {
var symbol = symbols_3[_i];
var state_5 = _loop_15(symbol);
if (typeof state_5 === "object")
return state_5.value;
var state_6 = _loop_16(symbol);
if (typeof state_6 === "object")
return state_6.value;
}
return commonDeclarations;
}
@ -63029,7 +63079,7 @@ var ts;
function getIndexInfosOfIndexSymbol(indexSymbol) {
if (indexSymbol.declarations) {
var indexInfos_4 = [];
var _loop_16 = function (declaration) {
var _loop_17 = function (declaration) {
if (declaration.parameters.length === 1) {
var parameter = declaration.parameters[0];
if (parameter.type) {
@ -63043,7 +63093,7 @@ var ts;
};
for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
_loop_16(declaration);
_loop_17(declaration);
}
return indexInfos_4;
}
@ -63060,7 +63110,7 @@ var ts;
var _a;
var inferences;
if ((_a = typeParameter.symbol) === null || _a === void 0 ? void 0 : _a.declarations) {
var _loop_17 = function (declaration) {
var _loop_18 = function (declaration) {
if (declaration.parent.kind === 194 /* SyntaxKind.InferType */) {
// When an 'infer T' declaration is immediately contained in a type reference node
// (such as 'Foo<infer T>'), T's constraint is inferred from the constraint of the
@ -63124,7 +63174,7 @@ var ts;
};
for (var _i = 0, _b = typeParameter.symbol.declarations; _i < _b.length; _i++) {
var declaration = _b[_i];
_loop_17(declaration);
_loop_18(declaration);
}
}
return inferences && getIntersectionType(inferences);
@ -64024,7 +64074,7 @@ var ts;
var lastRequiredIndex = -1;
var firstRestIndex = -1;
var lastOptionalOrRestIndex = -1;
var _loop_18 = function (i) {
var _loop_19 = function (i) {
var type = elementTypes[i];
var flags = target.elementFlags[i];
if (flags & 8 /* ElementFlags.Variadic */) {
@ -64054,9 +64104,9 @@ var ts;
}
};
for (var i = 0; i < elementTypes.length; i++) {
var state_6 = _loop_18(i);
if (typeof state_6 === "object")
return state_6.value;
var state_7 = _loop_19(i);
if (typeof state_7 === "object")
return state_7.value;
}
// Turn optional elements preceding the last required element into required elements
for (var i = 0; i < lastRequiredIndex; i++) {
@ -64250,7 +64300,7 @@ var ts;
var templates = ts.filter(types, isPatternLiteralType);
if (templates.length) {
var i = types.length;
var _loop_19 = function () {
var _loop_20 = function () {
i--;
var t = types[i];
if (t.flags & 128 /* TypeFlags.StringLiteral */ && ts.some(templates, function (template) { return isTypeMatchedByTemplateLiteralType(t, template); })) {
@ -64258,7 +64308,7 @@ var ts;
}
};
while (i > 0) {
_loop_19();
_loop_20();
}
}
}
@ -64335,14 +64385,14 @@ var ts;
var namedUnions = [];
addNamedUnions(namedUnions, types);
var reducedTypes = [];
var _loop_20 = function (t) {
var _loop_21 = function (t) {
if (!ts.some(namedUnions, function (union) { return containsType(union.types, t); })) {
reducedTypes.push(t);
}
};
for (var _i = 0, typeSet_1 = typeSet; _i < typeSet_1.length; _i++) {
var t = typeSet_1[_i];
_loop_20(t);
_loop_21(t);
}
if (!aliasSymbol && namedUnions.length === 1 && reducedTypes.length === 0) {
return namedUnions[0];
@ -68299,7 +68349,7 @@ var ts;
reducedTarget = findMatchingDiscriminantType(source, target, isRelatedTo) || filterPrimitivesIfContainsNonPrimitive(target);
checkTypes = reducedTarget.flags & 1048576 /* TypeFlags.Union */ ? reducedTarget.types : [reducedTarget];
}
var _loop_21 = function (prop) {
var _loop_22 = function (prop) {
if (shouldCheckAsExcessProperty(prop, source.symbol) && !isIgnoredJsxProperty(source, prop)) {
if (!isKnownProperty(reducedTarget, prop.escapedName, isComparingJsxAttributes)) {
if (reportErrors) {
@ -68362,9 +68412,9 @@ var ts;
};
for (var _i = 0, _b = getPropertiesOfType(source); _i < _b.length; _i++) {
var prop = _b[_i];
var state_7 = _loop_21(prop);
if (typeof state_7 === "object")
return state_7.value;
var state_8 = _loop_22(prop);
if (typeof state_8 === "object")
return state_8.value;
}
return false;
}
@ -69374,11 +69424,11 @@ var ts;
// constituents of 'target'. If any combination does not have a match then 'source' is not relatable.
var discriminantCombinations = ts.cartesianProduct(sourceDiscriminantTypes);
var matchingTypes = [];
var _loop_22 = function (combination) {
var _loop_23 = function (combination) {
var hasMatch = false;
outer: for (var _c = 0, _d = target.types; _c < _d.length; _c++) {
var type = _d[_c];
var _loop_23 = function (i) {
var _loop_24 = function (i) {
var sourceProperty = sourcePropertiesFiltered[i];
var targetProperty = getPropertyOfType(type, sourceProperty.escapedName);
if (!targetProperty)
@ -69394,8 +69444,8 @@ var ts;
}
};
for (var i = 0; i < sourcePropertiesFiltered.length; i++) {
var state_9 = _loop_23(i);
switch (state_9) {
var state_10 = _loop_24(i);
switch (state_10) {
case "continue-outer": continue outer;
}
}
@ -69408,9 +69458,9 @@ var ts;
};
for (var _a = 0, discriminantCombinations_1 = discriminantCombinations; _a < discriminantCombinations_1.length; _a++) {
var combination = discriminantCombinations_1[_a];
var state_8 = _loop_22(combination);
if (typeof state_8 === "object")
return state_8.value;
var state_9 = _loop_23(combination);
if (typeof state_9 === "object")
return state_9.value;
}
// Compare the remaining non-discriminant properties of each match.
var result = -1 /* Ternary.True */;
@ -70115,7 +70165,7 @@ var ts;
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes" /* tracing.Phase.CheckTypes */, "getVariancesWorker", { arity: typeParameters.length, id: getTypeId(getDeclaredTypeOfSymbol(symbol)) });
links.variances = ts.emptyArray;
var variances = [];
var _loop_24 = function (tp) {
var _loop_25 = function (tp) {
var modifiers = getVarianceModifiers(tp);
var variance = modifiers & 65536 /* ModifierFlags.Out */ ?
modifiers & 32768 /* ModifierFlags.In */ ? 0 /* VarianceFlags.Invariant */ : 1 /* VarianceFlags.Covariant */ :
@ -70153,7 +70203,7 @@ var ts;
};
for (var _i = 0, typeParameters_2 = typeParameters; _i < typeParameters_2.length; _i++) {
var tp = typeParameters_2[_i];
_loop_24(tp);
_loop_25(tp);
}
links.variances = variances;
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop({ variances: variances.map(ts.Debug.formatVariance) });
@ -72113,7 +72163,7 @@ var ts;
// upon instantiation, would collapse all the placeholders to just 'string', and an assignment check might
// succeed. That would be a pointless and confusing outcome.
if (matches || ts.every(target.texts, function (s) { return s.length === 0; })) {
var _loop_25 = function (i) {
var _loop_26 = function (i) {
var source_1 = matches ? matches[i] : neverType;
var target_3 = types[i];
// If we are inferring from a string literal type to a type variable whose constraint includes one of the
@ -72163,7 +72213,7 @@ var ts;
inferFromTypes(source_1, target_3);
};
for (var i = 0; i < types.length; i++) {
_loop_25(i);
_loop_26(i);
}
}
}
@ -72692,7 +72742,7 @@ var ts;
function mapTypesByKeyProperty(types, name) {
var map = new ts.Map();
var count = 0;
var _loop_26 = function (type) {
var _loop_27 = function (type) {
if (type.flags & (524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */)) {
var discriminant = getTypeOfPropertyOfType(type, name);
if (discriminant) {
@ -72718,9 +72768,9 @@ var ts;
};
for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
var type = types_15[_i];
var state_10 = _loop_26(type);
if (typeof state_10 === "object")
return state_10.value;
var state_11 = _loop_27(type);
if (typeof state_11 === "object")
return state_11.value;
}
return count >= 10 && count * 2 >= types.length ? map : undefined;
}
@ -79267,7 +79317,7 @@ var ts;
if (spreadIndex >= 0) {
// Create synthetic arguments from spreads of tuple types.
var effectiveArgs_1 = args.slice(0, spreadIndex);
var _loop_27 = function (i) {
var _loop_28 = function (i) {
var arg = args[i];
// We can call checkExpressionCached because spread expressions never have a contextual type.
var spreadType = arg.kind === 230 /* SyntaxKind.SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression));
@ -79284,7 +79334,7 @@ var ts;
}
};
for (var i = spreadIndex; i < args.length; i++) {
_loop_27(i);
_loop_28(i);
}
return effectiveArgs_1;
}
@ -79636,7 +79686,7 @@ var ts;
var min_3 = Number.MAX_VALUE;
var minIndex = 0;
var i_1 = 0;
var _loop_28 = function (c) {
var _loop_29 = function (c) {
var chain_2 = function () { return ts.chainDiagnosticMessages(/*details*/ undefined, ts.Diagnostics.Overload_0_of_1_2_gave_the_following_error, i_1 + 1, candidates.length, signatureToString(c)); };
var diags_2 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0 /* CheckMode.Normal */, /*reportErrors*/ true, chain_2);
if (diags_2) {
@ -79654,7 +79704,7 @@ var ts;
};
for (var _a = 0, candidatesForArgumentError_1 = candidatesForArgumentError; _a < candidatesForArgumentError_1.length; _a++) {
var c = candidatesForArgumentError_1[_a];
_loop_28(c);
_loop_29(c);
}
var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics);
ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures");
@ -79812,7 +79862,7 @@ var ts;
}
var _a = ts.minAndMax(candidates, getNumNonRestParameters), minArgumentCount = _a.min, maxNonRestParam = _a.max;
var parameters = [];
var _loop_29 = function (i) {
var _loop_30 = function (i) {
var symbols = ts.mapDefined(candidates, function (s) { return signatureHasRestParameter(s) ?
i < s.parameters.length - 1 ? s.parameters[i] : ts.last(s.parameters) :
i < s.parameters.length ? s.parameters[i] : undefined; });
@ -79820,7 +79870,7 @@ var ts;
parameters.push(createCombinedSymbolFromTypes(symbols, ts.mapDefined(candidates, function (candidate) { return tryGetTypeAtPosition(candidate, i); })));
};
for (var i = 0; i < maxNonRestParam; i++) {
_loop_29(i);
_loop_30(i);
}
var restParameterSymbols = ts.mapDefined(candidates, function (c) { return signatureHasRestParameter(c) ? ts.last(c.parameters) : undefined; });
var flags = 0 /* SignatureFlags.None */;
@ -80767,7 +80817,7 @@ var ts;
}
function expressionCheckByJsDoc(declaration, node, sourceFile, checkConfig) {
var jsDocTags = ts.getJSDocTags(declaration);
var _loop_30 = function (i) {
var _loop_31 = function (i) {
var config = checkConfig[i];
var tagNameCheckNecessity = true;
if (config.checkJsDocSpecialValidCallback) {
@ -80800,7 +80850,7 @@ var ts;
}
};
for (var i = 0; i < checkConfig.length; i++) {
_loop_30(i);
_loop_31(i);
}
}
function collectDiagnostics(config, node, diagnostic) {
@ -84231,7 +84281,7 @@ var ts;
var indexSymbol = getIndexSymbol(getSymbolOfNode(node));
if (indexSymbol === null || indexSymbol === void 0 ? void 0 : indexSymbol.declarations) {
var indexSignatureMap_1 = new ts.Map();
var _loop_31 = function (declaration) {
var _loop_32 = function (declaration) {
if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
forEachType(getTypeFromTypeNode(declaration.parameters[0].type), function (type) {
var entry = indexSignatureMap_1.get(getTypeId(type));
@ -84246,7 +84296,7 @@ var ts;
};
for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
_loop_31(declaration);
_loop_32(declaration);
}
indexSignatureMap_1.forEach(function (entry) {
if (entry.declarations.length > 1) {
@ -87891,7 +87941,7 @@ var ts;
var propDeclaration = declaration && declaration.kind === 226 /* SyntaxKind.BinaryExpression */ ||
name && name.kind === 166 /* SyntaxKind.ComputedPropertyName */ ? declaration : undefined;
var localPropDeclaration = getParentOfSymbol(prop) === type.symbol ? declaration : undefined;
var _loop_32 = function (info) {
var _loop_33 = function (info) {
var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
// We check only when (a) the property is declared in the containing type, or (b) the applicable index signature is declared
// in the containing type, or (c) the containing type is an interface and no base interface contains both the property and
@ -87908,7 +87958,7 @@ var ts;
};
for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) {
var info = indexInfos_9[_i];
_loop_32(info);
_loop_33(info);
}
}
function checkIndexConstraintForIndexSignature(type, checkInfo) {
@ -87916,7 +87966,7 @@ var ts;
var indexInfos = getApplicableIndexInfos(type, checkInfo.keyType);
var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 265 /* SyntaxKind.InterfaceDeclaration */) : undefined;
var localCheckDeclaration = declaration && getParentOfSymbol(getSymbolOfNode(declaration)) === type.symbol ? declaration : undefined;
var _loop_33 = function (info) {
var _loop_34 = function (info) {
if (info === checkInfo)
return "continue";
var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
@ -87931,7 +87981,7 @@ var ts;
};
for (var _i = 0, indexInfos_10 = indexInfos; _i < indexInfos_10.length; _i++) {
var info = indexInfos_10[_i];
_loop_33(info);
_loop_34(info);
}
}
function checkTypeNameIsReserved(name, message) {
@ -88271,7 +88321,7 @@ var ts;
var baseTypes = baseTypeNode && getBaseTypes(type);
var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined;
var baseStaticType = getBaseConstructorTypeOfClass(type);
var _loop_34 = function (member) {
var _loop_35 = function (member) {
if (ts.hasAmbientModifier(member)) {
return "continue";
}
@ -88288,7 +88338,7 @@ var ts;
};
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
var member = _a[_i];
_loop_34(member);
_loop_35(member);
}
}
/**
@ -88376,7 +88426,7 @@ var ts;
function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) {
// iterate over all implemented properties and issue errors on each one which isn't compatible, rather than the class as a whole, if possible
var issuedMemberError = false;
var _loop_35 = function (member) {
var _loop_36 = function (member) {
if (ts.isStatic(member)) {
return "continue";
}
@ -88395,7 +88445,7 @@ var ts;
};
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
var member = _a[_i];
_loop_35(member);
_loop_36(member);
}
if (!issuedMemberError) {
// check again with diagnostics to generate a less-specific error
@ -88466,7 +88516,7 @@ var ts;
var _a, _b, _c, _d;
// NOTE: assignability is checked in checkClassDeclaration
var baseProperties = getPropertiesOfType(baseType);
var _loop_36 = function (baseProperty) {
var _loop_37 = function (baseProperty) {
var base = getTargetSymbol(baseProperty);
if (base.flags & 4194304 /* SymbolFlags.Prototype */) {
return "continue";
@ -88576,8 +88626,8 @@ var ts;
};
basePropertyCheck: for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {
var baseProperty = baseProperties_1[_i];
var state_11 = _loop_36(baseProperty);
switch (state_11) {
var state_12 = _loop_37(baseProperty);
switch (state_12) {
case "continue-basePropertyCheck": continue basePropertyCheck;
}
}
@ -127935,7 +127985,7 @@ var ts;
});
// Sort by paths closest to importing file Name directory
var sortedPaths = [];
var _loop_37 = function (directory) {
var _loop_38 = function (directory) {
var directoryStart = ts.ensureTrailingDirectorySeparator(directory);
var pathsInDirectory;
allFileNames.forEach(function (_a, fileName) {
@ -127959,9 +128009,9 @@ var ts;
};
var out_directory_1;
for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
var state_12 = _loop_37(directory);
var state_13 = _loop_38(directory);
directory = out_directory_1;
if (state_12 === "break")
if (state_13 === "break")
break;
}
if (allFileNames.size) {
@ -128030,7 +128080,7 @@ var ts;
}
function tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions) {
for (var key in paths) {
var _loop_38 = function (patternText_1) {
var _loop_39 = function (patternText_1) {
var pattern = ts.normalizePath(patternText_1);
var indexOfStar = pattern.indexOf("*");
// In module resolution, if `pattern` itself has an extension, a file with that extension is looked up directly,
@ -128097,9 +128147,9 @@ var ts;
};
for (var _i = 0, _a = paths[key]; _i < _a.length; _i++) {
var patternText_1 = _a[_i];
var state_13 = _loop_38(patternText_1);
if (typeof state_13 === "object")
return state_13.value;
var state_14 = _loop_39(patternText_1);
if (typeof state_14 === "object")
return state_14.value;
}
}
function validateEnding(_a) {

View File

@ -4628,6 +4628,8 @@ var ts;
EtsFlags[EtsFlags["EtsStateStylesContext"] = 64] = "EtsStateStylesContext";
EtsFlags[EtsFlags["EtsComponentsContext"] = 128] = "EtsComponentsContext";
EtsFlags[EtsFlags["EtsNewExpressionContext"] = 256] = "EtsNewExpressionContext";
EtsFlags[EtsFlags["UICallbackContext"] = 512] = "UICallbackContext";
EtsFlags[EtsFlags["SyntaxComponentContext"] = 1024] = "SyntaxComponentContext";
})(EtsFlags = ts.EtsFlags || (ts.EtsFlags = {}));
var ModifierFlags;
(function (ModifierFlags) {
@ -17762,6 +17764,18 @@ var ts;
return undefined;
}
ts.getRootEtsComponent = getRootEtsComponent;
function getRootComponent(node, compilerOptions) {
var _a, _b, _c;
while (node) {
if (ts.isEtsComponentExpression(node) || ts.isCallExpression(node) && ts.isIdentifier(node.expression) &&
((_c = (_b = (_a = compilerOptions.ets) === null || _a === void 0 ? void 0 : _a.syntaxComponents) === null || _b === void 0 ? void 0 : _b.attrUICallback) === null || _c === void 0 ? void 0 : _c.map(function (item) { return item.name; }).includes(node.expression.escapedText.toString()))) {
return node;
}
node = node.expression;
}
return undefined;
}
ts.getRootComponent = getRootComponent;
function getVirtualEtsComponent(node) {
while (node) {
if (ts.isPropertyAccessExpression(node) && node.expression && node.expression.virtual) {
@ -32972,6 +32986,12 @@ var ts;
function setEtsStateStylesContext(val) {
setEtsFlag(val, 64 /* EtsFlags.EtsStateStylesContext */);
}
function setUICallbackContext(val) {
setEtsFlag(val, 512 /* EtsFlags.UICallbackContext */);
}
function setSyntaxComponentContext(val) {
setEtsFlag(val, 1024 /* EtsFlags.SyntaxComponentContext */);
}
function doOutsideOfContext(context, func) {
// contextFlagsToClear will contain only the context flags that are
// currently set that we need to temporarily clear
@ -33102,6 +33122,12 @@ var ts;
function inEtsStateStylesContext() {
return inEtsContext() && (inBuildContext() || inBuilderContext() || inEtsExtendComponentsContext() || inEtsStylesComponentsContext()) && inEtsFlagsContext(64 /* EtsFlags.EtsStateStylesContext */);
}
function inUICallbackContext() {
return inEtsContext() && (inBuildContext() || inBuilderContext()) && inEtsFlagsContext(512 /* EtsFlags.UICallbackContext */);
}
function inSyntaxComponentContext() {
return inEtsContext() && (inBuildContext() || inBuilderContext()) && inEtsFlagsContext(1024 /* EtsFlags.SyntaxComponentContext */);
}
function parseErrorAtPosition(start, length, message, arg0) {
// Don't report another error if it would just be at the same position as the last error.
var lastError = ts.lastOrUndefined(parseDiagnostics);
@ -35643,7 +35669,7 @@ var ts;
return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher(allowReturnTypeInArrowFunction), pos);
}
// It's a CallExpression with open brace followed, therefore, we think it's an EtsComponentExpression
if ((inStructContext() || inBuildContext() || inBuilderContext()) && ts.isCallExpression(expr) && token() === 18 /* SyntaxKind.OpenBraceToken */) {
if ((inBuildContext() || inBuilderContext()) && inUICallbackContext() && ts.isCallExpression(expr) && token() === 18 /* SyntaxKind.OpenBraceToken */) {
return makeEtsComponentExpression(expr, pos);
}
// It wasn't an assignment or a lambda. This is a conditional expression:
@ -35966,9 +35992,13 @@ var ts;
// have an opening brace, just in case we're in an error state.
var lastToken = token();
var equalsGreaterThanToken = parseExpectedToken(38 /* SyntaxKind.EqualsGreaterThanToken */);
var originUIContextFlag = inUICallbackContext();
setUICallbackContext(inSyntaxComponentContext() ? true : false);
setSyntaxComponentContext(false);
var body = (lastToken === 38 /* SyntaxKind.EqualsGreaterThanToken */ || lastToken === 18 /* SyntaxKind.OpenBraceToken */)
? parseArrowFunctionExpressionBody(ts.some(modifiers, ts.isAsyncModifier), allowReturnTypeInArrowFunction)
: parseIdentifier();
setUICallbackContext(originUIContextFlag);
// Given:
// x ? y => ({ y }) : z => ({ z })
// We try to parse the body of the first arrow function by looking at:
@ -36844,9 +36874,9 @@ var ts;
return finishNode(tagExpression, pos);
}
function parseCallExpressionRest(pos, expression) {
var _a, _b, _c, _d, _e, _f;
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
var currentNodeName;
while (true) {
var _loop_5 = function () {
expression = parseMemberExpressionRest(pos, expression, /*allowOptionalChain*/ true);
var typeArguments = void 0;
var questionDotToken = parseOptionalToken(28 /* SyntaxKind.QuestionDotToken */);
@ -36854,7 +36884,7 @@ var ts;
typeArguments = tryParse(parseTypeArgumentsInExpression);
if (isTemplateStartOfTaggedTemplate()) {
expression = parseTaggedTemplateRest(pos, expression, questionDotToken, typeArguments);
continue;
return "continue";
}
}
if (typeArguments || token() === 20 /* SyntaxKind.OpenParenToken */) {
@ -36864,19 +36894,27 @@ var ts;
expression = expression.expression;
}
if (isValidVirtualTypeArgumentsContext() && ts.isPropertyAccessExpression(expression)) {
var rootNode = ts.getRootEtsComponent(expression);
var rootNode = ts.getRootComponent(expression, sourceFileCompilerOptions);
if (rootNode) {
var rootNodeName = (rootNode.expression).escapedText.toString();
var rootNodeName_1 = (rootNode.expression).escapedText.toString();
currentNodeName = ts.getTextOfPropertyName(expression.name).toString();
if (currentNodeName === ((_b = (_a = sourceFileCompilerOptions === null || sourceFileCompilerOptions === void 0 ? void 0 : sourceFileCompilerOptions.ets) === null || _a === void 0 ? void 0 : _a.styles) === null || _b === void 0 ? void 0 : _b.property)) {
setEtsStateStylesContext(true);
stateStylesRootNode = rootNodeName;
stateStylesRootNode = rootNodeName_1;
}
else {
setEtsStateStylesContext(false);
stateStylesRootNode = undefined;
}
typeArguments = parseEtsTypeArguments(pos, "".concat(rootNodeName, "Attribute"));
if ((_e = (_d = (_c = sourceFileCompilerOptions === null || sourceFileCompilerOptions === void 0 ? void 0 : sourceFileCompilerOptions.ets) === null || _c === void 0 ? void 0 : _c.syntaxComponents) === null || _d === void 0 ? void 0 : _d.attrUICallback) === null || _e === void 0 ? void 0 : _e.map(function (item) { return item.name; }).includes(rootNodeName_1)) {
var syntaxComponents = (_h = (_g = (_f = sourceFileCompilerOptions === null || sourceFileCompilerOptions === void 0 ? void 0 : sourceFileCompilerOptions.ets) === null || _f === void 0 ? void 0 : _f.syntaxComponents) === null || _g === void 0 ? void 0 : _g.attrUICallback) === null || _h === void 0 ? void 0 : _h.filter(function (item) { return item.name === rootNodeName_1; });
if (syntaxComponents.length && ((_k = (_j = syntaxComponents[0]) === null || _j === void 0 ? void 0 : _j.attributes) === null || _k === void 0 ? void 0 : _k.includes(currentNodeName))) {
setSyntaxComponentContext(true);
}
}
else {
typeArguments = parseEtsTypeArguments(pos, "".concat(rootNodeName_1, "Attribute"));
}
}
else if (inEtsStateStylesContext() && stateStylesRootNode) {
typeArguments = parseEtsTypeArguments(pos, "".concat(stateStylesRootNode, "Attribute"));
@ -36886,7 +36924,7 @@ var ts;
if (virtualNode) {
var rootNodeName = (virtualNode.expression).escapedText.toString();
currentNodeName = ts.getTextOfPropertyName(expression.name).toString();
if (currentNodeName === ((_d = (_c = sourceFileCompilerOptions === null || sourceFileCompilerOptions === void 0 ? void 0 : sourceFileCompilerOptions.ets) === null || _c === void 0 ? void 0 : _c.styles) === null || _d === void 0 ? void 0 : _d.property)) {
if (currentNodeName === ((_m = (_l = sourceFileCompilerOptions === null || sourceFileCompilerOptions === void 0 ? void 0 : sourceFileCompilerOptions.ets) === null || _l === void 0 ? void 0 : _l.styles) === null || _m === void 0 ? void 0 : _m.property)) {
setEtsStateStylesContext(true);
rootNodeName = rootNodeName.replace("Instance", "");
stateStylesRootNode = rootNodeName;
@ -36895,21 +36933,30 @@ var ts;
}
}
}
if (isValidVirtualTypeArgumentsContext() && ts.isIdentifier(expression) &&
((_q = (_p = (_o = sourceFileCompilerOptions === null || sourceFileCompilerOptions === void 0 ? void 0 : sourceFileCompilerOptions.ets) === null || _o === void 0 ? void 0 : _o.syntaxComponents) === null || _p === void 0 ? void 0 : _p.paramsUICallback) === null || _q === void 0 ? void 0 : _q.includes(expression.escapedText.toString()))) {
setSyntaxComponentContext(true);
}
var argumentList = parseArgumentList();
var callExpr = questionDotToken || tryReparseOptionalChain(expression) ?
factory.createCallChain(expression, questionDotToken, typeArguments, argumentList) :
factory.createCallExpression(expression, typeArguments, argumentList);
expression = finishNode(callExpr, pos);
continue;
return "continue";
}
if (questionDotToken) {
// We parsed `?.` but then failed to parse anything, so report a missing identifier here.
var name = createMissingNode(79 /* SyntaxKind.Identifier */, /*reportAtCurrentPosition*/ false, ts.Diagnostics.Identifier_expected);
expression = finishNode(factory.createPropertyAccessChain(expression, questionDotToken, name), pos);
}
break;
return "break";
};
while (true) {
var state_2 = _loop_5();
if (state_2 === "break")
break;
}
if (currentNodeName === ((_f = (_e = sourceFileCompilerOptions === null || sourceFileCompilerOptions === void 0 ? void 0 : sourceFileCompilerOptions.ets) === null || _e === void 0 ? void 0 : _e.styles) === null || _f === void 0 ? void 0 : _f.property)) {
if (currentNodeName === ((_s = (_r = sourceFileCompilerOptions === null || sourceFileCompilerOptions === void 0 ? void 0 : sourceFileCompilerOptions.ets) === null || _r === void 0 ? void 0 : _r.styles) === null || _s === void 0 ? void 0 : _s.property)) {
setEtsStateStylesContext(false);
stateStylesRootNode = undefined;
}
@ -38041,8 +38088,10 @@ var ts;
var methodName = (_a = ts.getPropertyNameForPropertyNameNode(name)) === null || _a === void 0 ? void 0 : _a.toString();
var orignalEtsBuildContext = inBuildContext();
var orignalEtsBuilderContext = inBuilderContext();
var orignalUICallbackContext = inUICallbackContext();
setEtsBuildContext(methodName === ((_d = (_c = (_b = sourceFileCompilerOptions === null || sourceFileCompilerOptions === void 0 ? void 0 : sourceFileCompilerOptions.ets) === null || _b === void 0 ? void 0 : _b.render) === null || _c === void 0 ? void 0 : _c.method) === null || _d === void 0 ? void 0 : _d.find(function (render) { return render === "build"; })));
setEtsBuilderContext(ts.hasEtsBuilderDecoratorNames(decorators, sourceFileCompilerOptions));
setUICallbackContext(inBuildContext() || inBuilderContext());
if (inStructContext() && ts.hasEtsStylesDecoratorNames(decorators, sourceFileCompilerOptions)) {
if (methodName && currentStructName) {
structStylesComponents.set(methodName, { structName: currentStructName, kind: 173 /* SyntaxKind.MethodDeclaration */ });
@ -38068,6 +38117,7 @@ var ts;
node.exclamationToken = exclamationToken;
setEtsBuildContext(orignalEtsBuildContext);
setEtsBuilderContext(orignalEtsBuilderContext);
setUICallbackContext(orignalUICallbackContext);
setEtsStylesComponentsContext(false);
stylesEtsComponentDeclaration = undefined;
setEtsComponentsContext(orignalEtsComponentsContext);
@ -42695,7 +42745,7 @@ var ts;
}
function convertObjectLiteralExpressionToJson(node, knownOptions, extraKeyDiagnostics, parentOption) {
var result = returnValue ? {} : undefined;
var _loop_5 = function (element) {
var _loop_6 = function (element) {
if (element.kind !== 303 /* SyntaxKind.PropertyAssignment */) {
errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, element, ts.Diagnostics.Property_assignment_expected));
return "continue";
@ -42748,7 +42798,7 @@ var ts;
};
for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
var element = _a[_i];
_loop_5(element);
_loop_6(element);
}
return result;
}
@ -42949,7 +42999,7 @@ var ts;
var optionsNameMap = _a.optionsNameMap;
var result = new ts.Map();
var getCanonicalFileName = pathOptions && ts.createGetCanonicalFileName(pathOptions.useCaseSensitiveFileNames);
var _loop_6 = function (name) {
var _loop_7 = function (name) {
if (ts.hasProperty(options, name)) {
// tsconfig only options cannot be specified via command line,
// so we can assume that only types that can appear here string | number | boolean
@ -42983,7 +43033,7 @@ var ts;
}
};
for (var name in options) {
_loop_6(name);
_loop_7(name);
}
return result;
}
@ -43757,7 +43807,7 @@ var ts;
}
var jsonOnlyIncludeRegexes;
if (validatedIncludeSpecs && validatedIncludeSpecs.length > 0) {
var _loop_7 = function (file) {
var _loop_8 = function (file) {
if (ts.fileExtensionIs(file, ".json" /* Extension.Json */)) {
// Valid only if *.json specified
if (!jsonOnlyIncludeRegexes) {
@ -43795,7 +43845,7 @@ var ts;
};
for (var _a = 0, _b = host.readDirectory(basePath, ts.flatten(supportedExtensionsWithJsonIfResolveJsonModule), validatedExcludeSpecs, validatedIncludeSpecs, /*depth*/ undefined); _a < _b.length; _a++) {
var file = _b[_a];
_loop_7(file);
_loop_8(file);
}
}
var literalFiles = ts.arrayFrom(literalFileMap.values());
@ -47212,7 +47262,7 @@ var ts;
break;
// 5. other uninstantiated module declarations.
case 269 /* SyntaxKind.ModuleBlock */: {
var state_2 = 0 /* ModuleInstanceState.NonInstantiated */;
var state_3 = 0 /* ModuleInstanceState.NonInstantiated */;
ts.forEachChild(node, function (n) {
var childState = getModuleInstanceStateCached(n, visited);
switch (childState) {
@ -47221,17 +47271,17 @@ var ts;
return;
case 2 /* ModuleInstanceState.ConstEnumOnly */:
// child is const enum only - record state and continue searching
state_2 = 2 /* ModuleInstanceState.ConstEnumOnly */;
state_3 = 2 /* ModuleInstanceState.ConstEnumOnly */;
return;
case 1 /* ModuleInstanceState.Instantiated */:
// child is instantiated - record state and stop
state_2 = 1 /* ModuleInstanceState.Instantiated */;
state_3 = 1 /* ModuleInstanceState.Instantiated */;
return true;
default:
ts.Debug.assertNever(childState);
}
});
return state_2;
return state_3;
}
case 268 /* SyntaxKind.ModuleDeclaration */:
return getModuleInstanceState(node, visited);
@ -51897,7 +51947,7 @@ var ts;
function addDuplicateDeclarationError(node, message, symbolName, relatedNodes) {
var errorNode = (ts.getExpandoInitializer(node, /*isPrototypeAssignment*/ false) ? ts.getNameOfExpando(node) : ts.getNameOfDeclaration(node)) || node;
var err = lookupOrIssueError(errorNode, message, symbolName);
var _loop_8 = function (relatedNode) {
var _loop_9 = function (relatedNode) {
var adjustedNode = (ts.getExpandoInitializer(relatedNode, /*isPrototypeAssignment*/ false) ? ts.getNameOfExpando(relatedNode) : ts.getNameOfDeclaration(relatedNode)) || relatedNode;
if (adjustedNode === errorNode)
return "continue";
@ -51910,7 +51960,7 @@ var ts;
};
for (var _i = 0, _a = relatedNodes || ts.emptyArray; _i < _a.length; _i++) {
var relatedNode = _a[_i];
_loop_8(relatedNode);
_loop_9(relatedNode);
}
}
function combineSymbolTables(first, second) {
@ -54697,7 +54747,7 @@ var ts;
}
function forEachSymbolTableInScope(enclosingDeclaration, callback) {
var result;
var _loop_9 = function (location) {
var _loop_10 = function (location) {
// Locals of a source file are not in scope (because they get merged into the global symbol table)
if (location.locals && !isGlobalSourceFile(location)) {
if (result = callback(location.locals, /*ignoreQualification*/ undefined, /*isLocalNameLookup*/ true, location)) {
@ -54743,9 +54793,9 @@ var ts;
}
};
for (var location = enclosingDeclaration; location; location = location.parent) {
var state_3 = _loop_9(location);
if (typeof state_3 === "object")
return state_3.value;
var state_4 = _loop_10(location);
if (typeof state_4 === "object")
return state_4.value;
}
return callback(globals, /*ignoreQualification*/ undefined, /*isLocalNameLookup*/ true);
}
@ -57148,7 +57198,7 @@ var ts;
if (ts.length(reexports) > 1) {
var groups = ts.group(reexports, function (decl) { return ts.isStringLiteral(decl.moduleSpecifier) ? ">" + decl.moduleSpecifier.text : ">"; });
if (groups.length !== reexports.length) {
var _loop_10 = function (group_1) {
var _loop_11 = function (group_1) {
if (group_1.length > 1) {
// remove group members from statements and then merge group members and add back to statements
statements = __spreadArray(__spreadArray([], ts.filter(statements, function (s) { return group_1.indexOf(s) === -1; }), true), [
@ -57160,7 +57210,7 @@ var ts;
};
for (var _i = 0, groups_1 = groups; _i < groups_1.length; _i++) {
var group_1 = groups_1[_i];
_loop_10(group_1);
_loop_11(group_1);
}
}
}
@ -61051,7 +61101,7 @@ var ts;
// signatures from the type, whose ordering would be non-obvious)
var masterList = signatureLists[indexWithLengthOverOne !== undefined ? indexWithLengthOverOne : 0];
var results = masterList.slice();
var _loop_11 = function (signatures) {
var _loop_12 = function (signatures) {
if (signatures !== masterList) {
var signature_1 = signatures[0];
ts.Debug.assert(!!signature_1, "getUnionSignatures bails early on empty signature lists and should not have empty lists on second pass");
@ -61063,8 +61113,8 @@ var ts;
};
for (var _b = 0, signatureLists_1 = signatureLists; _b < signatureLists_1.length; _b++) {
var signatures = signatureLists_1[_b];
var state_4 = _loop_11(signatures);
if (state_4 === "break")
var state_5 = _loop_12(signatures);
if (state_5 === "break")
break;
}
result = results;
@ -61170,7 +61220,7 @@ var ts;
var sourceInfos = getIndexInfosOfType(types[0]);
if (sourceInfos) {
var result = [];
var _loop_12 = function (info) {
var _loop_13 = function (info) {
var indexType = info.keyType;
if (ts.every(types, function (t) { return !!getIndexInfoOfType(t, indexType); })) {
result.push(createIndexInfo(indexType, getUnionType(ts.map(types, function (t) { return getIndexTypeOfType(t, indexType); })), ts.some(types, function (t) { return getIndexInfoOfType(t, indexType).isReadonly; })));
@ -61178,7 +61228,7 @@ var ts;
};
for (var _i = 0, sourceInfos_1 = sourceInfos; _i < sourceInfos_1.length; _i++) {
var info = sourceInfos_1[_i];
_loop_12(info);
_loop_13(info);
}
return result;
}
@ -61225,7 +61275,7 @@ var ts;
var types = type.types;
var mixinFlags = findMixins(types);
var mixinCount = ts.countWhere(mixinFlags, function (b) { return b; });
var _loop_13 = function (i) {
var _loop_14 = function (i) {
var t = type.types[i];
// When an intersection type contains mixin constructor types, the construct signatures from
// those types are discarded and their return types are mixed into the return types of all
@ -61247,19 +61297,19 @@ var ts;
indexInfos = ts.reduceLeft(getIndexInfosOfType(t), function (infos, newInfo) { return appendIndexInfo(infos, newInfo, /*union*/ false); }, indexInfos);
};
for (var i = 0; i < types.length; i++) {
_loop_13(i);
_loop_14(i);
}
setStructuredTypeMembers(type, emptySymbols, callSignatures || ts.emptyArray, constructSignatures || ts.emptyArray, indexInfos || ts.emptyArray);
}
function appendSignatures(signatures, newSignatures) {
var _loop_14 = function (sig) {
var _loop_15 = function (sig) {
if (!signatures || ts.every(signatures, function (s) { return !compareSignaturesIdentical(s, sig, /*partialMatch*/ false, /*ignoreThisTypes*/ false, /*ignoreReturnTypes*/ false, compareTypesIdentical); })) {
signatures = ts.append(signatures, sig);
}
};
for (var _i = 0, newSignatures_1 = newSignatures; _i < newSignatures_1.length; _i++) {
var sig = newSignatures_1[_i];
_loop_14(sig);
_loop_15(sig);
}
return signatures;
}
@ -62280,7 +62330,7 @@ var ts;
}
function getCommonDeclarationsOfSymbols(symbols) {
var commonDeclarations;
var _loop_15 = function (symbol) {
var _loop_16 = function (symbol) {
if (!symbol.declarations) {
return { value: undefined };
}
@ -62299,9 +62349,9 @@ var ts;
};
for (var _i = 0, symbols_3 = symbols; _i < symbols_3.length; _i++) {
var symbol = symbols_3[_i];
var state_5 = _loop_15(symbol);
if (typeof state_5 === "object")
return state_5.value;
var state_6 = _loop_16(symbol);
if (typeof state_6 === "object")
return state_6.value;
}
return commonDeclarations;
}
@ -63019,7 +63069,7 @@ var ts;
function getIndexInfosOfIndexSymbol(indexSymbol) {
if (indexSymbol.declarations) {
var indexInfos_4 = [];
var _loop_16 = function (declaration) {
var _loop_17 = function (declaration) {
if (declaration.parameters.length === 1) {
var parameter = declaration.parameters[0];
if (parameter.type) {
@ -63033,7 +63083,7 @@ var ts;
};
for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
_loop_16(declaration);
_loop_17(declaration);
}
return indexInfos_4;
}
@ -63050,7 +63100,7 @@ var ts;
var _a;
var inferences;
if ((_a = typeParameter.symbol) === null || _a === void 0 ? void 0 : _a.declarations) {
var _loop_17 = function (declaration) {
var _loop_18 = function (declaration) {
if (declaration.parent.kind === 194 /* SyntaxKind.InferType */) {
// When an 'infer T' declaration is immediately contained in a type reference node
// (such as 'Foo<infer T>'), T's constraint is inferred from the constraint of the
@ -63114,7 +63164,7 @@ var ts;
};
for (var _i = 0, _b = typeParameter.symbol.declarations; _i < _b.length; _i++) {
var declaration = _b[_i];
_loop_17(declaration);
_loop_18(declaration);
}
}
return inferences && getIntersectionType(inferences);
@ -64014,7 +64064,7 @@ var ts;
var lastRequiredIndex = -1;
var firstRestIndex = -1;
var lastOptionalOrRestIndex = -1;
var _loop_18 = function (i) {
var _loop_19 = function (i) {
var type = elementTypes[i];
var flags = target.elementFlags[i];
if (flags & 8 /* ElementFlags.Variadic */) {
@ -64044,9 +64094,9 @@ var ts;
}
};
for (var i = 0; i < elementTypes.length; i++) {
var state_6 = _loop_18(i);
if (typeof state_6 === "object")
return state_6.value;
var state_7 = _loop_19(i);
if (typeof state_7 === "object")
return state_7.value;
}
// Turn optional elements preceding the last required element into required elements
for (var i = 0; i < lastRequiredIndex; i++) {
@ -64240,7 +64290,7 @@ var ts;
var templates = ts.filter(types, isPatternLiteralType);
if (templates.length) {
var i = types.length;
var _loop_19 = function () {
var _loop_20 = function () {
i--;
var t = types[i];
if (t.flags & 128 /* TypeFlags.StringLiteral */ && ts.some(templates, function (template) { return isTypeMatchedByTemplateLiteralType(t, template); })) {
@ -64248,7 +64298,7 @@ var ts;
}
};
while (i > 0) {
_loop_19();
_loop_20();
}
}
}
@ -64325,14 +64375,14 @@ var ts;
var namedUnions = [];
addNamedUnions(namedUnions, types);
var reducedTypes = [];
var _loop_20 = function (t) {
var _loop_21 = function (t) {
if (!ts.some(namedUnions, function (union) { return containsType(union.types, t); })) {
reducedTypes.push(t);
}
};
for (var _i = 0, typeSet_1 = typeSet; _i < typeSet_1.length; _i++) {
var t = typeSet_1[_i];
_loop_20(t);
_loop_21(t);
}
if (!aliasSymbol && namedUnions.length === 1 && reducedTypes.length === 0) {
return namedUnions[0];
@ -68289,7 +68339,7 @@ var ts;
reducedTarget = findMatchingDiscriminantType(source, target, isRelatedTo) || filterPrimitivesIfContainsNonPrimitive(target);
checkTypes = reducedTarget.flags & 1048576 /* TypeFlags.Union */ ? reducedTarget.types : [reducedTarget];
}
var _loop_21 = function (prop) {
var _loop_22 = function (prop) {
if (shouldCheckAsExcessProperty(prop, source.symbol) && !isIgnoredJsxProperty(source, prop)) {
if (!isKnownProperty(reducedTarget, prop.escapedName, isComparingJsxAttributes)) {
if (reportErrors) {
@ -68352,9 +68402,9 @@ var ts;
};
for (var _i = 0, _b = getPropertiesOfType(source); _i < _b.length; _i++) {
var prop = _b[_i];
var state_7 = _loop_21(prop);
if (typeof state_7 === "object")
return state_7.value;
var state_8 = _loop_22(prop);
if (typeof state_8 === "object")
return state_8.value;
}
return false;
}
@ -69364,11 +69414,11 @@ var ts;
// constituents of 'target'. If any combination does not have a match then 'source' is not relatable.
var discriminantCombinations = ts.cartesianProduct(sourceDiscriminantTypes);
var matchingTypes = [];
var _loop_22 = function (combination) {
var _loop_23 = function (combination) {
var hasMatch = false;
outer: for (var _c = 0, _d = target.types; _c < _d.length; _c++) {
var type = _d[_c];
var _loop_23 = function (i) {
var _loop_24 = function (i) {
var sourceProperty = sourcePropertiesFiltered[i];
var targetProperty = getPropertyOfType(type, sourceProperty.escapedName);
if (!targetProperty)
@ -69384,8 +69434,8 @@ var ts;
}
};
for (var i = 0; i < sourcePropertiesFiltered.length; i++) {
var state_9 = _loop_23(i);
switch (state_9) {
var state_10 = _loop_24(i);
switch (state_10) {
case "continue-outer": continue outer;
}
}
@ -69398,9 +69448,9 @@ var ts;
};
for (var _a = 0, discriminantCombinations_1 = discriminantCombinations; _a < discriminantCombinations_1.length; _a++) {
var combination = discriminantCombinations_1[_a];
var state_8 = _loop_22(combination);
if (typeof state_8 === "object")
return state_8.value;
var state_9 = _loop_23(combination);
if (typeof state_9 === "object")
return state_9.value;
}
// Compare the remaining non-discriminant properties of each match.
var result = -1 /* Ternary.True */;
@ -70105,7 +70155,7 @@ var ts;
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes" /* tracing.Phase.CheckTypes */, "getVariancesWorker", { arity: typeParameters.length, id: getTypeId(getDeclaredTypeOfSymbol(symbol)) });
links.variances = ts.emptyArray;
var variances = [];
var _loop_24 = function (tp) {
var _loop_25 = function (tp) {
var modifiers = getVarianceModifiers(tp);
var variance = modifiers & 65536 /* ModifierFlags.Out */ ?
modifiers & 32768 /* ModifierFlags.In */ ? 0 /* VarianceFlags.Invariant */ : 1 /* VarianceFlags.Covariant */ :
@ -70143,7 +70193,7 @@ var ts;
};
for (var _i = 0, typeParameters_2 = typeParameters; _i < typeParameters_2.length; _i++) {
var tp = typeParameters_2[_i];
_loop_24(tp);
_loop_25(tp);
}
links.variances = variances;
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop({ variances: variances.map(ts.Debug.formatVariance) });
@ -72103,7 +72153,7 @@ var ts;
// upon instantiation, would collapse all the placeholders to just 'string', and an assignment check might
// succeed. That would be a pointless and confusing outcome.
if (matches || ts.every(target.texts, function (s) { return s.length === 0; })) {
var _loop_25 = function (i) {
var _loop_26 = function (i) {
var source_1 = matches ? matches[i] : neverType;
var target_3 = types[i];
// If we are inferring from a string literal type to a type variable whose constraint includes one of the
@ -72153,7 +72203,7 @@ var ts;
inferFromTypes(source_1, target_3);
};
for (var i = 0; i < types.length; i++) {
_loop_25(i);
_loop_26(i);
}
}
}
@ -72682,7 +72732,7 @@ var ts;
function mapTypesByKeyProperty(types, name) {
var map = new ts.Map();
var count = 0;
var _loop_26 = function (type) {
var _loop_27 = function (type) {
if (type.flags & (524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */)) {
var discriminant = getTypeOfPropertyOfType(type, name);
if (discriminant) {
@ -72708,9 +72758,9 @@ var ts;
};
for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
var type = types_15[_i];
var state_10 = _loop_26(type);
if (typeof state_10 === "object")
return state_10.value;
var state_11 = _loop_27(type);
if (typeof state_11 === "object")
return state_11.value;
}
return count >= 10 && count * 2 >= types.length ? map : undefined;
}
@ -79257,7 +79307,7 @@ var ts;
if (spreadIndex >= 0) {
// Create synthetic arguments from spreads of tuple types.
var effectiveArgs_1 = args.slice(0, spreadIndex);
var _loop_27 = function (i) {
var _loop_28 = function (i) {
var arg = args[i];
// We can call checkExpressionCached because spread expressions never have a contextual type.
var spreadType = arg.kind === 230 /* SyntaxKind.SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression));
@ -79274,7 +79324,7 @@ var ts;
}
};
for (var i = spreadIndex; i < args.length; i++) {
_loop_27(i);
_loop_28(i);
}
return effectiveArgs_1;
}
@ -79626,7 +79676,7 @@ var ts;
var min_3 = Number.MAX_VALUE;
var minIndex = 0;
var i_1 = 0;
var _loop_28 = function (c) {
var _loop_29 = function (c) {
var chain_2 = function () { return ts.chainDiagnosticMessages(/*details*/ undefined, ts.Diagnostics.Overload_0_of_1_2_gave_the_following_error, i_1 + 1, candidates.length, signatureToString(c)); };
var diags_2 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0 /* CheckMode.Normal */, /*reportErrors*/ true, chain_2);
if (diags_2) {
@ -79644,7 +79694,7 @@ var ts;
};
for (var _a = 0, candidatesForArgumentError_1 = candidatesForArgumentError; _a < candidatesForArgumentError_1.length; _a++) {
var c = candidatesForArgumentError_1[_a];
_loop_28(c);
_loop_29(c);
}
var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics);
ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures");
@ -79802,7 +79852,7 @@ var ts;
}
var _a = ts.minAndMax(candidates, getNumNonRestParameters), minArgumentCount = _a.min, maxNonRestParam = _a.max;
var parameters = [];
var _loop_29 = function (i) {
var _loop_30 = function (i) {
var symbols = ts.mapDefined(candidates, function (s) { return signatureHasRestParameter(s) ?
i < s.parameters.length - 1 ? s.parameters[i] : ts.last(s.parameters) :
i < s.parameters.length ? s.parameters[i] : undefined; });
@ -79810,7 +79860,7 @@ var ts;
parameters.push(createCombinedSymbolFromTypes(symbols, ts.mapDefined(candidates, function (candidate) { return tryGetTypeAtPosition(candidate, i); })));
};
for (var i = 0; i < maxNonRestParam; i++) {
_loop_29(i);
_loop_30(i);
}
var restParameterSymbols = ts.mapDefined(candidates, function (c) { return signatureHasRestParameter(c) ? ts.last(c.parameters) : undefined; });
var flags = 0 /* SignatureFlags.None */;
@ -80757,7 +80807,7 @@ var ts;
}
function expressionCheckByJsDoc(declaration, node, sourceFile, checkConfig) {
var jsDocTags = ts.getJSDocTags(declaration);
var _loop_30 = function (i) {
var _loop_31 = function (i) {
var config = checkConfig[i];
var tagNameCheckNecessity = true;
if (config.checkJsDocSpecialValidCallback) {
@ -80790,7 +80840,7 @@ var ts;
}
};
for (var i = 0; i < checkConfig.length; i++) {
_loop_30(i);
_loop_31(i);
}
}
function collectDiagnostics(config, node, diagnostic) {
@ -84221,7 +84271,7 @@ var ts;
var indexSymbol = getIndexSymbol(getSymbolOfNode(node));
if (indexSymbol === null || indexSymbol === void 0 ? void 0 : indexSymbol.declarations) {
var indexSignatureMap_1 = new ts.Map();
var _loop_31 = function (declaration) {
var _loop_32 = function (declaration) {
if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
forEachType(getTypeFromTypeNode(declaration.parameters[0].type), function (type) {
var entry = indexSignatureMap_1.get(getTypeId(type));
@ -84236,7 +84286,7 @@ var ts;
};
for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
_loop_31(declaration);
_loop_32(declaration);
}
indexSignatureMap_1.forEach(function (entry) {
if (entry.declarations.length > 1) {
@ -87881,7 +87931,7 @@ var ts;
var propDeclaration = declaration && declaration.kind === 226 /* SyntaxKind.BinaryExpression */ ||
name && name.kind === 166 /* SyntaxKind.ComputedPropertyName */ ? declaration : undefined;
var localPropDeclaration = getParentOfSymbol(prop) === type.symbol ? declaration : undefined;
var _loop_32 = function (info) {
var _loop_33 = function (info) {
var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
// We check only when (a) the property is declared in the containing type, or (b) the applicable index signature is declared
// in the containing type, or (c) the containing type is an interface and no base interface contains both the property and
@ -87898,7 +87948,7 @@ var ts;
};
for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) {
var info = indexInfos_9[_i];
_loop_32(info);
_loop_33(info);
}
}
function checkIndexConstraintForIndexSignature(type, checkInfo) {
@ -87906,7 +87956,7 @@ var ts;
var indexInfos = getApplicableIndexInfos(type, checkInfo.keyType);
var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 265 /* SyntaxKind.InterfaceDeclaration */) : undefined;
var localCheckDeclaration = declaration && getParentOfSymbol(getSymbolOfNode(declaration)) === type.symbol ? declaration : undefined;
var _loop_33 = function (info) {
var _loop_34 = function (info) {
if (info === checkInfo)
return "continue";
var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
@ -87921,7 +87971,7 @@ var ts;
};
for (var _i = 0, indexInfos_10 = indexInfos; _i < indexInfos_10.length; _i++) {
var info = indexInfos_10[_i];
_loop_33(info);
_loop_34(info);
}
}
function checkTypeNameIsReserved(name, message) {
@ -88261,7 +88311,7 @@ var ts;
var baseTypes = baseTypeNode && getBaseTypes(type);
var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined;
var baseStaticType = getBaseConstructorTypeOfClass(type);
var _loop_34 = function (member) {
var _loop_35 = function (member) {
if (ts.hasAmbientModifier(member)) {
return "continue";
}
@ -88278,7 +88328,7 @@ var ts;
};
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
var member = _a[_i];
_loop_34(member);
_loop_35(member);
}
}
/**
@ -88366,7 +88416,7 @@ var ts;
function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) {
// iterate over all implemented properties and issue errors on each one which isn't compatible, rather than the class as a whole, if possible
var issuedMemberError = false;
var _loop_35 = function (member) {
var _loop_36 = function (member) {
if (ts.isStatic(member)) {
return "continue";
}
@ -88385,7 +88435,7 @@ var ts;
};
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
var member = _a[_i];
_loop_35(member);
_loop_36(member);
}
if (!issuedMemberError) {
// check again with diagnostics to generate a less-specific error
@ -88456,7 +88506,7 @@ var ts;
var _a, _b, _c, _d;
// NOTE: assignability is checked in checkClassDeclaration
var baseProperties = getPropertiesOfType(baseType);
var _loop_36 = function (baseProperty) {
var _loop_37 = function (baseProperty) {
var base = getTargetSymbol(baseProperty);
if (base.flags & 4194304 /* SymbolFlags.Prototype */) {
return "continue";
@ -88566,8 +88616,8 @@ var ts;
};
basePropertyCheck: for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {
var baseProperty = baseProperties_1[_i];
var state_11 = _loop_36(baseProperty);
switch (state_11) {
var state_12 = _loop_37(baseProperty);
switch (state_12) {
case "continue-basePropertyCheck": continue basePropertyCheck;
}
}
@ -127925,7 +127975,7 @@ var ts;
});
// Sort by paths closest to importing file Name directory
var sortedPaths = [];
var _loop_37 = function (directory) {
var _loop_38 = function (directory) {
var directoryStart = ts.ensureTrailingDirectorySeparator(directory);
var pathsInDirectory;
allFileNames.forEach(function (_a, fileName) {
@ -127949,9 +127999,9 @@ var ts;
};
var out_directory_1;
for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
var state_12 = _loop_37(directory);
var state_13 = _loop_38(directory);
directory = out_directory_1;
if (state_12 === "break")
if (state_13 === "break")
break;
}
if (allFileNames.size) {
@ -128020,7 +128070,7 @@ var ts;
}
function tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions) {
for (var key in paths) {
var _loop_38 = function (patternText_1) {
var _loop_39 = function (patternText_1) {
var pattern = ts.normalizePath(patternText_1);
var indexOfStar = pattern.indexOf("*");
// In module resolution, if `pattern` itself has an extension, a file with that extension is looked up directly,
@ -128087,9 +128137,9 @@ var ts;
};
for (var _i = 0, _a = paths[key]; _i < _a.length; _i++) {
var patternText_1 = _a[_i];
var state_13 = _loop_38(patternText_1);
if (typeof state_13 === "object")
return state_13.value;
var state_14 = _loop_39(patternText_1);
if (typeof state_14 === "object")
return state_14.value;
}
}
function validateEnding(_a) {

View File

@ -1652,6 +1652,14 @@ namespace ts {
setEtsFlag(val, EtsFlags.EtsStateStylesContext);
}
function setUICallbackContext(val: boolean) {
setEtsFlag(val, EtsFlags.UICallbackContext);
}
function setSyntaxComponentContext(val: boolean) {
setEtsFlag(val, EtsFlags.SyntaxComponentContext);
}
function doOutsideOfContext<T>(context: NodeFlags, func: () => T): T {
// contextFlagsToClear will contain only the context flags that are
// currently set that we need to temporarily clear
@ -1812,6 +1820,14 @@ namespace ts {
return inEtsContext() && (inBuildContext() || inBuilderContext() || inEtsExtendComponentsContext() || inEtsStylesComponentsContext()) && inEtsFlagsContext(EtsFlags.EtsStateStylesContext);
}
function inUICallbackContext() {
return inEtsContext() && (inBuildContext() || inBuilderContext()) && inEtsFlagsContext(EtsFlags.UICallbackContext);
}
function inSyntaxComponentContext() {
return inEtsContext() && (inBuildContext() || inBuilderContext()) && inEtsFlagsContext(EtsFlags.SyntaxComponentContext);
}
function parseErrorAtPosition(start: number, length: number, message: DiagnosticMessage, arg0?: any): DiagnosticWithDetachedLocation | undefined {
// Don't report another error if it would just be at the same position as the last error.
const lastError = lastOrUndefined(parseDiagnostics);
@ -4805,7 +4821,7 @@ namespace ts {
}
// It's a CallExpression with open brace followed, therefore, we think it's an EtsComponentExpression
if ((inStructContext() || inBuildContext() || inBuilderContext()) && isCallExpression(expr) && token() === SyntaxKind.OpenBraceToken) {
if ((inBuildContext() || inBuilderContext()) && inUICallbackContext() && ts.isCallExpression(expr) && token() === SyntaxKind.OpenBraceToken) {
return makeEtsComponentExpression(expr, pos);
}
@ -5177,10 +5193,13 @@ namespace ts {
// have an opening brace, just in case we're in an error state.
const lastToken = token();
const equalsGreaterThanToken = parseExpectedToken(SyntaxKind.EqualsGreaterThanToken);
let originUIContextFlag = inUICallbackContext()
setUICallbackContext(inSyntaxComponentContext() ? true : false);
setSyntaxComponentContext(false);
const body = (lastToken === SyntaxKind.EqualsGreaterThanToken || lastToken === SyntaxKind.OpenBraceToken)
? parseArrowFunctionExpressionBody(some(modifiers, isAsyncModifier), allowReturnTypeInArrowFunction)
: parseIdentifier();
setUICallbackContext(originUIContextFlag);
// Given:
// x ? y => ({ y }) : z => ({ z })
// We try to parse the body of the first arrow function by looking at:
@ -6180,7 +6199,7 @@ namespace ts {
}
if (isValidVirtualTypeArgumentsContext() && isPropertyAccessExpression(expression)) {
const rootNode = getRootEtsComponent(expression);
const rootNode = getRootComponent(expression, sourceFileCompilerOptions);
if (rootNode) {
const rootNodeName = (<Identifier>(rootNode.expression)).escapedText.toString();
currentNodeName = getTextOfPropertyName(expression.name).toString();
@ -6192,7 +6211,14 @@ namespace ts {
setEtsStateStylesContext(false);
stateStylesRootNode = undefined;
}
typeArguments = parseEtsTypeArguments(pos, `${rootNodeName}Attribute`);
if (sourceFileCompilerOptions?.ets?.syntaxComponents?.attrUICallback?.map((item: any)=>item.name).includes(rootNodeName)) {
const syntaxComponents = sourceFileCompilerOptions?.ets?.syntaxComponents?.attrUICallback?.filter((item: any)=> item.name === rootNodeName);
if (syntaxComponents.length && syntaxComponents[0]?.attributes?.includes(currentNodeName)) {
setSyntaxComponentContext(true);
}
} else {
typeArguments = parseEtsTypeArguments(pos, `${rootNodeName}Attribute`);
}
}
else if (inEtsStateStylesContext() && stateStylesRootNode) {
typeArguments = parseEtsTypeArguments(pos, `${stateStylesRootNode}Attribute`);
@ -6210,6 +6236,10 @@ namespace ts {
}
}
}
if (isValidVirtualTypeArgumentsContext() && ts.isIdentifier(expression) &&
sourceFileCompilerOptions?.ets?.syntaxComponents?.paramsUICallback?.includes(expression.escapedText.toString())) {
setSyntaxComponentContext(true);
}
const argumentList = parseArgumentList();
const callExpr = questionDotToken || tryReparseOptionalChain(expression) ?
factory.createCallChain(expression, questionDotToken, typeArguments, argumentList) :
@ -7499,8 +7529,10 @@ namespace ts {
const methodName = getPropertyNameForPropertyNameNode(name)?.toString();
const orignalEtsBuildContext = inBuildContext();
const orignalEtsBuilderContext = inBuilderContext();
const orignalUICallbackContext = inUICallbackContext();
setEtsBuildContext(methodName === sourceFileCompilerOptions?.ets?.render?.method?.find(render => render === "build"));
setEtsBuilderContext(hasEtsBuilderDecoratorNames(decorators, sourceFileCompilerOptions));
setUICallbackContext(inBuildContext() || inBuilderContext());
if (inStructContext() && hasEtsStylesDecoratorNames(decorators, sourceFileCompilerOptions)) {
if (methodName && currentStructName) {
structStylesComponents.set(methodName, { structName: currentStructName, kind: SyntaxKind.MethodDeclaration });
@ -7536,6 +7568,7 @@ namespace ts {
(node as Mutable<MethodDeclaration>).exclamationToken = exclamationToken;
setEtsBuildContext(orignalEtsBuildContext);
setEtsBuilderContext(orignalEtsBuilderContext);
setUICallbackContext(orignalUICallbackContext);
setEtsStylesComponentsContext(false);
stylesEtsComponentDeclaration = undefined;
setEtsComponentsContext(orignalEtsComponentsContext);

View File

@ -828,7 +828,9 @@ namespace ts {
EtsBuilderContext = 1 << 5, // If context was parsed as Ets builder methods or functions
EtsStateStylesContext = 1 << 6, // If context was parsed as Ets stateStyles Components
EtsComponentsContext = 1 << 7, // If context was parsed as a Ets Components
EtsNewExpressionContext = 1 << 8, // If context was parsed ad a new expression
EtsNewExpressionContext = 1 << 8, // If context was parsed as a new expression
UICallbackContext = 1 << 9, // If context was parsed in build/builder/Syntax ui ArrowFunction
SyntaxComponentContext = 1 << 10, // If context was parsed in ForEach/LazyForEach/Repeat.each/Repeat.template
}
export const enum ModifierFlags {
@ -6785,6 +6787,13 @@ namespace ts {
name: string,
emitParameters: boolean
}[];
syntaxComponents: {
paramsUICallback: string[];
attrUICallback: {
name: string;
attributes: string[];
}[];
};
}
export interface WatchOptions {

View File

@ -3375,6 +3375,17 @@ namespace ts {
return undefined;
}
export function getRootComponent(node: Node | undefined, compilerOptions: CompilerOptions): EtsComponentExpression | CallExpression | undefined {
while (node) {
if (isEtsComponentExpression(node) || isCallExpression(node) && isIdentifier(node.expression) &&
compilerOptions.ets?.syntaxComponents?.attrUICallback?.map((item: any)=>item.name).includes(node.expression.escapedText.toString())) {
return node;
}
node = (node as PropertyAccessExpression | CallExpression).expression;
}
return undefined;
}
export function getVirtualEtsComponent(node: Node | undefined): PropertyAccessExpression | undefined {
while (node) {
if (isPropertyAccessExpression(node) && node.expression && node.expression.virtual) {

View File

@ -2224,6 +2224,13 @@ namespace ts.server.protocol {
name: string,
emitParameters: boolean
}[];
syntaxComponents: {
paramsUICallback: string[];
attrUICallback: {
name: string;
attributes: string[];
}[];
};
}
/**

View File

@ -764,6 +764,18 @@
"decorator": "Concurrent"
},
"customComponent": "CustomComponent",
"syntaxComponents": {
"paramsUICallback": [
"ForEach",
"LazyForEach"
],
"attrUICallback": [
{
"name": "Repeat",
"attributes": ["each", "template"]
}
]
}
},
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,

View File

@ -553,7 +553,9 @@ declare namespace ts {
EtsBuilderContext = 32,
EtsStateStylesContext = 64,
EtsComponentsContext = 128,
EtsNewExpressionContext = 256
EtsNewExpressionContext = 256,
UICallbackContext = 512,
SyntaxComponentContext = 1024
}
export enum ModifierFlags {
None = 0,
@ -3210,6 +3212,13 @@ declare namespace ts {
name: string;
emitParameters: boolean;
}[];
syntaxComponents: {
paramsUICallback: string[];
attrUICallback: {
name: string;
attributes: string[];
}[];
};
}
export interface WatchOptions {
watchFile?: WatchFileKind;
@ -9201,6 +9210,13 @@ declare namespace ts.server.protocol {
name: string;
emitParameters: boolean;
}[];
syntaxComponents: {
paramsUICallback: string[];
attrUICallback: {
name: string;
attributes: string[];
}[];
};
}
/**
* Completions request; value of command field is "completions".

View File

@ -553,7 +553,9 @@ declare namespace ts {
EtsBuilderContext = 32,
EtsStateStylesContext = 64,
EtsComponentsContext = 128,
EtsNewExpressionContext = 256
EtsNewExpressionContext = 256,
UICallbackContext = 512,
SyntaxComponentContext = 1024
}
export enum ModifierFlags {
None = 0,
@ -3210,6 +3212,13 @@ declare namespace ts {
name: string;
emitParameters: boolean;
}[];
syntaxComponents: {
paramsUICallback: string[];
attrUICallback: {
name: string;
attributes: string[];
}[];
};
}
export interface WatchOptions {
watchFile?: WatchFileKind;

View File

@ -37,5 +37,17 @@
"tests/cases/fourslash/etslib/flex.d.ts",
"tests/cases/fourslash/etslib/text.d.ts"
],
"customComponent": "CustomComponent"
"customComponent": "CustomComponent",
"syntaxComponents": {
"paramsUICallback": [
"ForEach",
"LazyForEach"
],
"attrUICallback": [
{
"name": "Repeat",
"attributes": ["each", "template"]
}
]
}
}

View File

@ -700,6 +700,18 @@
"property": "stateStyles"
},
"customComponent": "CustomComponent",
"syntaxComponents": {
"paramsUICallback": [
"ForEach",
"LazyForEach"
],
"attrUICallback": [
{
"name": "Repeat",
"attributes": ["each", "template"]
}
]
}
},
"emitDeclarationOnly": true,
"allowJs": true,