mirror of
https://gitee.com/openharmony/third_party_typescript
synced 2024-11-26 16:42:57 +00:00
!346 修复错误建立etscomponentexpression & extend/styles内不识别statestyles
Merge pull request !346 from houhaoyu/master
This commit is contained in:
commit
c5c31ffa75
35
lib/tsc.js
35
lib/tsc.js
@ -13975,6 +13975,16 @@ var ts;
|
||||
return undefined;
|
||||
}
|
||||
ts.getRootEtsComponent = getRootEtsComponent;
|
||||
function getVirtualEtsComponent(node) {
|
||||
while (node) {
|
||||
if (ts.isPropertyAccessExpression(node) && node.expression && node.expression.virtual) {
|
||||
return node;
|
||||
}
|
||||
node = node.expression;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
ts.getVirtualEtsComponent = getVirtualEtsComponent;
|
||||
function isKeyword(token) {
|
||||
return 81 <= token && token <= 163;
|
||||
}
|
||||
@ -26805,7 +26815,7 @@ var ts;
|
||||
return inEtsContext() && inEtsFlagsContext(32);
|
||||
}
|
||||
function inEtsStateStylesContext() {
|
||||
return inEtsContext() && inStructContext() && inEtsFlagsContext(64);
|
||||
return inEtsContext() && (inBuildContext() || inBuilderContext() || inEtsExtendComponentsContext() || inEtsStylesComponentsContext()) && inEtsFlagsContext(64);
|
||||
}
|
||||
function parseErrorAtPosition(start, length, message, arg0) {
|
||||
var lastError = ts.lastOrUndefined(parseDiagnostics);
|
||||
@ -28897,7 +28907,7 @@ var ts;
|
||||
if (ts.isLeftHandSideExpression(expr) && ts.isAssignmentOperator(reScanGreaterToken())) {
|
||||
return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher(allowReturnTypeInArrowFunction), pos);
|
||||
}
|
||||
if (inEtsContext() && ts.isCallExpression(expr) && token() === 18) {
|
||||
if ((inStructContext() || inBuildContext() || inBuilderContext()) && ts.isCallExpression(expr) && token() === 18) {
|
||||
return makeEtsComponentExpression(expr, pos);
|
||||
}
|
||||
return parseConditionalExpressionRest(expr, pos, allowReturnTypeInArrowFunction);
|
||||
@ -29736,7 +29746,7 @@ var ts;
|
||||
return finishNode(tagExpression, pos);
|
||||
}
|
||||
function parseCallExpressionRest(pos, expression) {
|
||||
var _a, _b, _c, _d;
|
||||
var _a, _b, _c, _d, _e, _f;
|
||||
var currentNodeName;
|
||||
while (true) {
|
||||
expression = parseMemberExpressionRest(pos, expression, true);
|
||||
@ -29754,7 +29764,7 @@ var ts;
|
||||
typeArguments = expression.typeArguments;
|
||||
expression = expression.expression;
|
||||
}
|
||||
if ((isValidVirtualTypeArgumentsContext() || inBuilderContext()) && ts.isPropertyAccessExpression(expression)) {
|
||||
if (isValidVirtualTypeArgumentsContext() && ts.isPropertyAccessExpression(expression)) {
|
||||
var rootNode = ts.getRootEtsComponent(expression);
|
||||
if (rootNode) {
|
||||
var rootNodeName = (rootNode.expression).escapedText.toString();
|
||||
@ -29772,6 +29782,19 @@ var ts;
|
||||
else if (inEtsStateStylesContext() && stateStylesRootNode) {
|
||||
typeArguments = parseEtsTypeArguments(pos, "".concat(stateStylesRootNode, "Attribute"));
|
||||
}
|
||||
else if (inEtsStylesComponentsContext() || inEtsExtendComponentsContext()) {
|
||||
var virtualNode = ts.getVirtualEtsComponent(expression);
|
||||
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)) {
|
||||
setEtsStateStylesContext(true);
|
||||
rootNodeName = rootNodeName.replace("Instance", "");
|
||||
stateStylesRootNode = rootNodeName;
|
||||
typeArguments = parseEtsTypeArguments(pos, "".concat(rootNodeName, "Attribute"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var argumentList = parseArgumentList();
|
||||
var callExpr = questionDotToken || tryReparseOptionalChain(expression) ?
|
||||
@ -29786,14 +29809,14 @@ var ts;
|
||||
}
|
||||
break;
|
||||
}
|
||||
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 === ((_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)) {
|
||||
setEtsStateStylesContext(false);
|
||||
stateStylesRootNode = undefined;
|
||||
}
|
||||
return expression;
|
||||
}
|
||||
function isValidVirtualTypeArgumentsContext() {
|
||||
return (inBuildContext() || inBuilderContext()) && inStructContext();
|
||||
return inBuildContext() || inBuilderContext() || inEtsStylesComponentsContext() || inEtsExtendComponentsContext();
|
||||
}
|
||||
function parseArgumentList() {
|
||||
parseExpected(20);
|
||||
|
@ -17779,6 +17779,16 @@ var ts;
|
||||
return undefined;
|
||||
}
|
||||
ts.getRootEtsComponent = getRootEtsComponent;
|
||||
function getVirtualEtsComponent(node) {
|
||||
while (node) {
|
||||
if (ts.isPropertyAccessExpression(node) && node.expression && node.expression.virtual) {
|
||||
return node;
|
||||
}
|
||||
node = node.expression;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
ts.getVirtualEtsComponent = getVirtualEtsComponent;
|
||||
function isKeyword(token) {
|
||||
return 81 /* SyntaxKind.FirstKeyword */ <= token && token <= 163 /* SyntaxKind.LastKeyword */;
|
||||
}
|
||||
@ -33100,7 +33110,7 @@ var ts;
|
||||
return inEtsContext() && inEtsFlagsContext(32 /* EtsFlags.EtsBuilderContext */);
|
||||
}
|
||||
function inEtsStateStylesContext() {
|
||||
return inEtsContext() && inStructContext() && inEtsFlagsContext(64 /* EtsFlags.EtsStateStylesContext */);
|
||||
return inEtsContext() && (inBuildContext() || inBuilderContext() || inEtsExtendComponentsContext() || inEtsStylesComponentsContext()) && inEtsFlagsContext(64 /* EtsFlags.EtsStateStylesContext */);
|
||||
}
|
||||
function parseErrorAtPosition(start, length, message, arg0) {
|
||||
// Don't report another error if it would just be at the same position as the last error.
|
||||
@ -35643,7 +35653,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 (inEtsContext() && ts.isCallExpression(expr) && token() === 18 /* SyntaxKind.OpenBraceToken */) {
|
||||
if ((inStructContext() || inBuildContext() || inBuilderContext()) && ts.isCallExpression(expr) && token() === 18 /* SyntaxKind.OpenBraceToken */) {
|
||||
return makeEtsComponentExpression(expr, pos);
|
||||
}
|
||||
// It wasn't an assignment or a lambda. This is a conditional expression:
|
||||
@ -36844,7 +36854,7 @@ var ts;
|
||||
return finishNode(tagExpression, pos);
|
||||
}
|
||||
function parseCallExpressionRest(pos, expression) {
|
||||
var _a, _b, _c, _d;
|
||||
var _a, _b, _c, _d, _e, _f;
|
||||
var currentNodeName;
|
||||
while (true) {
|
||||
expression = parseMemberExpressionRest(pos, expression, /*allowOptionalChain*/ true);
|
||||
@ -36863,7 +36873,7 @@ var ts;
|
||||
typeArguments = expression.typeArguments;
|
||||
expression = expression.expression;
|
||||
}
|
||||
if ((isValidVirtualTypeArgumentsContext() || inBuilderContext()) && ts.isPropertyAccessExpression(expression)) {
|
||||
if (isValidVirtualTypeArgumentsContext() && ts.isPropertyAccessExpression(expression)) {
|
||||
var rootNode = ts.getRootEtsComponent(expression);
|
||||
if (rootNode) {
|
||||
var rootNodeName = (rootNode.expression).escapedText.toString();
|
||||
@ -36881,6 +36891,19 @@ var ts;
|
||||
else if (inEtsStateStylesContext() && stateStylesRootNode) {
|
||||
typeArguments = parseEtsTypeArguments(pos, "".concat(stateStylesRootNode, "Attribute"));
|
||||
}
|
||||
else if (inEtsStylesComponentsContext() || inEtsExtendComponentsContext()) {
|
||||
var virtualNode = ts.getVirtualEtsComponent(expression);
|
||||
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)) {
|
||||
setEtsStateStylesContext(true);
|
||||
rootNodeName = rootNodeName.replace("Instance", "");
|
||||
stateStylesRootNode = rootNodeName;
|
||||
typeArguments = parseEtsTypeArguments(pos, "".concat(rootNodeName, "Attribute"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var argumentList = parseArgumentList();
|
||||
var callExpr = questionDotToken || tryReparseOptionalChain(expression) ?
|
||||
@ -36896,14 +36919,14 @@ var ts;
|
||||
}
|
||||
break;
|
||||
}
|
||||
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 === ((_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)) {
|
||||
setEtsStateStylesContext(false);
|
||||
stateStylesRootNode = undefined;
|
||||
}
|
||||
return expression;
|
||||
}
|
||||
function isValidVirtualTypeArgumentsContext() {
|
||||
return (inBuildContext() || inBuilderContext()) && inStructContext();
|
||||
return inBuildContext() || inBuilderContext() || inEtsStylesComponentsContext() || inEtsExtendComponentsContext();
|
||||
}
|
||||
function parseArgumentList() {
|
||||
parseExpected(20 /* SyntaxKind.OpenParenToken */);
|
||||
|
@ -17778,6 +17778,16 @@ var ts;
|
||||
return undefined;
|
||||
}
|
||||
ts.getRootEtsComponent = getRootEtsComponent;
|
||||
function getVirtualEtsComponent(node) {
|
||||
while (node) {
|
||||
if (ts.isPropertyAccessExpression(node) && node.expression && node.expression.virtual) {
|
||||
return node;
|
||||
}
|
||||
node = node.expression;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
ts.getVirtualEtsComponent = getVirtualEtsComponent;
|
||||
function isKeyword(token) {
|
||||
return 81 /* SyntaxKind.FirstKeyword */ <= token && token <= 163 /* SyntaxKind.LastKeyword */;
|
||||
}
|
||||
@ -33099,7 +33109,7 @@ var ts;
|
||||
return inEtsContext() && inEtsFlagsContext(32 /* EtsFlags.EtsBuilderContext */);
|
||||
}
|
||||
function inEtsStateStylesContext() {
|
||||
return inEtsContext() && inStructContext() && inEtsFlagsContext(64 /* EtsFlags.EtsStateStylesContext */);
|
||||
return inEtsContext() && (inBuildContext() || inBuilderContext() || inEtsExtendComponentsContext() || inEtsStylesComponentsContext()) && inEtsFlagsContext(64 /* EtsFlags.EtsStateStylesContext */);
|
||||
}
|
||||
function parseErrorAtPosition(start, length, message, arg0) {
|
||||
// Don't report another error if it would just be at the same position as the last error.
|
||||
@ -35642,7 +35652,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 (inEtsContext() && ts.isCallExpression(expr) && token() === 18 /* SyntaxKind.OpenBraceToken */) {
|
||||
if ((inStructContext() || inBuildContext() || inBuilderContext()) && ts.isCallExpression(expr) && token() === 18 /* SyntaxKind.OpenBraceToken */) {
|
||||
return makeEtsComponentExpression(expr, pos);
|
||||
}
|
||||
// It wasn't an assignment or a lambda. This is a conditional expression:
|
||||
@ -36843,7 +36853,7 @@ var ts;
|
||||
return finishNode(tagExpression, pos);
|
||||
}
|
||||
function parseCallExpressionRest(pos, expression) {
|
||||
var _a, _b, _c, _d;
|
||||
var _a, _b, _c, _d, _e, _f;
|
||||
var currentNodeName;
|
||||
while (true) {
|
||||
expression = parseMemberExpressionRest(pos, expression, /*allowOptionalChain*/ true);
|
||||
@ -36862,7 +36872,7 @@ var ts;
|
||||
typeArguments = expression.typeArguments;
|
||||
expression = expression.expression;
|
||||
}
|
||||
if ((isValidVirtualTypeArgumentsContext() || inBuilderContext()) && ts.isPropertyAccessExpression(expression)) {
|
||||
if (isValidVirtualTypeArgumentsContext() && ts.isPropertyAccessExpression(expression)) {
|
||||
var rootNode = ts.getRootEtsComponent(expression);
|
||||
if (rootNode) {
|
||||
var rootNodeName = (rootNode.expression).escapedText.toString();
|
||||
@ -36880,6 +36890,19 @@ var ts;
|
||||
else if (inEtsStateStylesContext() && stateStylesRootNode) {
|
||||
typeArguments = parseEtsTypeArguments(pos, "".concat(stateStylesRootNode, "Attribute"));
|
||||
}
|
||||
else if (inEtsStylesComponentsContext() || inEtsExtendComponentsContext()) {
|
||||
var virtualNode = ts.getVirtualEtsComponent(expression);
|
||||
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)) {
|
||||
setEtsStateStylesContext(true);
|
||||
rootNodeName = rootNodeName.replace("Instance", "");
|
||||
stateStylesRootNode = rootNodeName;
|
||||
typeArguments = parseEtsTypeArguments(pos, "".concat(rootNodeName, "Attribute"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var argumentList = parseArgumentList();
|
||||
var callExpr = questionDotToken || tryReparseOptionalChain(expression) ?
|
||||
@ -36895,14 +36918,14 @@ var ts;
|
||||
}
|
||||
break;
|
||||
}
|
||||
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 === ((_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)) {
|
||||
setEtsStateStylesContext(false);
|
||||
stateStylesRootNode = undefined;
|
||||
}
|
||||
return expression;
|
||||
}
|
||||
function isValidVirtualTypeArgumentsContext() {
|
||||
return (inBuildContext() || inBuilderContext()) && inStructContext();
|
||||
return inBuildContext() || inBuilderContext() || inEtsStylesComponentsContext() || inEtsExtendComponentsContext();
|
||||
}
|
||||
function parseArgumentList() {
|
||||
parseExpected(20 /* SyntaxKind.OpenParenToken */);
|
||||
|
@ -17769,6 +17769,16 @@ var ts;
|
||||
return undefined;
|
||||
}
|
||||
ts.getRootEtsComponent = getRootEtsComponent;
|
||||
function getVirtualEtsComponent(node) {
|
||||
while (node) {
|
||||
if (ts.isPropertyAccessExpression(node) && node.expression && node.expression.virtual) {
|
||||
return node;
|
||||
}
|
||||
node = node.expression;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
ts.getVirtualEtsComponent = getVirtualEtsComponent;
|
||||
function isKeyword(token) {
|
||||
return 81 /* SyntaxKind.FirstKeyword */ <= token && token <= 163 /* SyntaxKind.LastKeyword */;
|
||||
}
|
||||
@ -33090,7 +33100,7 @@ var ts;
|
||||
return inEtsContext() && inEtsFlagsContext(32 /* EtsFlags.EtsBuilderContext */);
|
||||
}
|
||||
function inEtsStateStylesContext() {
|
||||
return inEtsContext() && inStructContext() && inEtsFlagsContext(64 /* EtsFlags.EtsStateStylesContext */);
|
||||
return inEtsContext() && (inBuildContext() || inBuilderContext() || inEtsExtendComponentsContext() || inEtsStylesComponentsContext()) && inEtsFlagsContext(64 /* EtsFlags.EtsStateStylesContext */);
|
||||
}
|
||||
function parseErrorAtPosition(start, length, message, arg0) {
|
||||
// Don't report another error if it would just be at the same position as the last error.
|
||||
@ -35633,7 +35643,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 (inEtsContext() && ts.isCallExpression(expr) && token() === 18 /* SyntaxKind.OpenBraceToken */) {
|
||||
if ((inStructContext() || inBuildContext() || inBuilderContext()) && ts.isCallExpression(expr) && token() === 18 /* SyntaxKind.OpenBraceToken */) {
|
||||
return makeEtsComponentExpression(expr, pos);
|
||||
}
|
||||
// It wasn't an assignment or a lambda. This is a conditional expression:
|
||||
@ -36834,7 +36844,7 @@ var ts;
|
||||
return finishNode(tagExpression, pos);
|
||||
}
|
||||
function parseCallExpressionRest(pos, expression) {
|
||||
var _a, _b, _c, _d;
|
||||
var _a, _b, _c, _d, _e, _f;
|
||||
var currentNodeName;
|
||||
while (true) {
|
||||
expression = parseMemberExpressionRest(pos, expression, /*allowOptionalChain*/ true);
|
||||
@ -36853,7 +36863,7 @@ var ts;
|
||||
typeArguments = expression.typeArguments;
|
||||
expression = expression.expression;
|
||||
}
|
||||
if ((isValidVirtualTypeArgumentsContext() || inBuilderContext()) && ts.isPropertyAccessExpression(expression)) {
|
||||
if (isValidVirtualTypeArgumentsContext() && ts.isPropertyAccessExpression(expression)) {
|
||||
var rootNode = ts.getRootEtsComponent(expression);
|
||||
if (rootNode) {
|
||||
var rootNodeName = (rootNode.expression).escapedText.toString();
|
||||
@ -36871,6 +36881,19 @@ var ts;
|
||||
else if (inEtsStateStylesContext() && stateStylesRootNode) {
|
||||
typeArguments = parseEtsTypeArguments(pos, "".concat(stateStylesRootNode, "Attribute"));
|
||||
}
|
||||
else if (inEtsStylesComponentsContext() || inEtsExtendComponentsContext()) {
|
||||
var virtualNode = ts.getVirtualEtsComponent(expression);
|
||||
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)) {
|
||||
setEtsStateStylesContext(true);
|
||||
rootNodeName = rootNodeName.replace("Instance", "");
|
||||
stateStylesRootNode = rootNodeName;
|
||||
typeArguments = parseEtsTypeArguments(pos, "".concat(rootNodeName, "Attribute"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var argumentList = parseArgumentList();
|
||||
var callExpr = questionDotToken || tryReparseOptionalChain(expression) ?
|
||||
@ -36886,14 +36909,14 @@ var ts;
|
||||
}
|
||||
break;
|
||||
}
|
||||
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 === ((_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)) {
|
||||
setEtsStateStylesContext(false);
|
||||
stateStylesRootNode = undefined;
|
||||
}
|
||||
return expression;
|
||||
}
|
||||
function isValidVirtualTypeArgumentsContext() {
|
||||
return (inBuildContext() || inBuilderContext()) && inStructContext();
|
||||
return inBuildContext() || inBuilderContext() || inEtsStylesComponentsContext() || inEtsExtendComponentsContext();
|
||||
}
|
||||
function parseArgumentList() {
|
||||
parseExpected(20 /* SyntaxKind.OpenParenToken */);
|
||||
|
@ -17769,6 +17769,16 @@ var ts;
|
||||
return undefined;
|
||||
}
|
||||
ts.getRootEtsComponent = getRootEtsComponent;
|
||||
function getVirtualEtsComponent(node) {
|
||||
while (node) {
|
||||
if (ts.isPropertyAccessExpression(node) && node.expression && node.expression.virtual) {
|
||||
return node;
|
||||
}
|
||||
node = node.expression;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
ts.getVirtualEtsComponent = getVirtualEtsComponent;
|
||||
function isKeyword(token) {
|
||||
return 81 /* SyntaxKind.FirstKeyword */ <= token && token <= 163 /* SyntaxKind.LastKeyword */;
|
||||
}
|
||||
@ -33090,7 +33100,7 @@ var ts;
|
||||
return inEtsContext() && inEtsFlagsContext(32 /* EtsFlags.EtsBuilderContext */);
|
||||
}
|
||||
function inEtsStateStylesContext() {
|
||||
return inEtsContext() && inStructContext() && inEtsFlagsContext(64 /* EtsFlags.EtsStateStylesContext */);
|
||||
return inEtsContext() && (inBuildContext() || inBuilderContext() || inEtsExtendComponentsContext() || inEtsStylesComponentsContext()) && inEtsFlagsContext(64 /* EtsFlags.EtsStateStylesContext */);
|
||||
}
|
||||
function parseErrorAtPosition(start, length, message, arg0) {
|
||||
// Don't report another error if it would just be at the same position as the last error.
|
||||
@ -35633,7 +35643,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 (inEtsContext() && ts.isCallExpression(expr) && token() === 18 /* SyntaxKind.OpenBraceToken */) {
|
||||
if ((inStructContext() || inBuildContext() || inBuilderContext()) && ts.isCallExpression(expr) && token() === 18 /* SyntaxKind.OpenBraceToken */) {
|
||||
return makeEtsComponentExpression(expr, pos);
|
||||
}
|
||||
// It wasn't an assignment or a lambda. This is a conditional expression:
|
||||
@ -36834,7 +36844,7 @@ var ts;
|
||||
return finishNode(tagExpression, pos);
|
||||
}
|
||||
function parseCallExpressionRest(pos, expression) {
|
||||
var _a, _b, _c, _d;
|
||||
var _a, _b, _c, _d, _e, _f;
|
||||
var currentNodeName;
|
||||
while (true) {
|
||||
expression = parseMemberExpressionRest(pos, expression, /*allowOptionalChain*/ true);
|
||||
@ -36853,7 +36863,7 @@ var ts;
|
||||
typeArguments = expression.typeArguments;
|
||||
expression = expression.expression;
|
||||
}
|
||||
if ((isValidVirtualTypeArgumentsContext() || inBuilderContext()) && ts.isPropertyAccessExpression(expression)) {
|
||||
if (isValidVirtualTypeArgumentsContext() && ts.isPropertyAccessExpression(expression)) {
|
||||
var rootNode = ts.getRootEtsComponent(expression);
|
||||
if (rootNode) {
|
||||
var rootNodeName = (rootNode.expression).escapedText.toString();
|
||||
@ -36871,6 +36881,19 @@ var ts;
|
||||
else if (inEtsStateStylesContext() && stateStylesRootNode) {
|
||||
typeArguments = parseEtsTypeArguments(pos, "".concat(stateStylesRootNode, "Attribute"));
|
||||
}
|
||||
else if (inEtsStylesComponentsContext() || inEtsExtendComponentsContext()) {
|
||||
var virtualNode = ts.getVirtualEtsComponent(expression);
|
||||
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)) {
|
||||
setEtsStateStylesContext(true);
|
||||
rootNodeName = rootNodeName.replace("Instance", "");
|
||||
stateStylesRootNode = rootNodeName;
|
||||
typeArguments = parseEtsTypeArguments(pos, "".concat(rootNodeName, "Attribute"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var argumentList = parseArgumentList();
|
||||
var callExpr = questionDotToken || tryReparseOptionalChain(expression) ?
|
||||
@ -36886,14 +36909,14 @@ var ts;
|
||||
}
|
||||
break;
|
||||
}
|
||||
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 === ((_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)) {
|
||||
setEtsStateStylesContext(false);
|
||||
stateStylesRootNode = undefined;
|
||||
}
|
||||
return expression;
|
||||
}
|
||||
function isValidVirtualTypeArgumentsContext() {
|
||||
return (inBuildContext() || inBuilderContext()) && inStructContext();
|
||||
return inBuildContext() || inBuilderContext() || inEtsStylesComponentsContext() || inEtsExtendComponentsContext();
|
||||
}
|
||||
function parseArgumentList() {
|
||||
parseExpected(20 /* SyntaxKind.OpenParenToken */);
|
||||
|
@ -17759,6 +17759,16 @@ var ts;
|
||||
return undefined;
|
||||
}
|
||||
ts.getRootEtsComponent = getRootEtsComponent;
|
||||
function getVirtualEtsComponent(node) {
|
||||
while (node) {
|
||||
if (ts.isPropertyAccessExpression(node) && node.expression && node.expression.virtual) {
|
||||
return node;
|
||||
}
|
||||
node = node.expression;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
ts.getVirtualEtsComponent = getVirtualEtsComponent;
|
||||
function isKeyword(token) {
|
||||
return 81 /* SyntaxKind.FirstKeyword */ <= token && token <= 163 /* SyntaxKind.LastKeyword */;
|
||||
}
|
||||
@ -33080,7 +33090,7 @@ var ts;
|
||||
return inEtsContext() && inEtsFlagsContext(32 /* EtsFlags.EtsBuilderContext */);
|
||||
}
|
||||
function inEtsStateStylesContext() {
|
||||
return inEtsContext() && inStructContext() && inEtsFlagsContext(64 /* EtsFlags.EtsStateStylesContext */);
|
||||
return inEtsContext() && (inBuildContext() || inBuilderContext() || inEtsExtendComponentsContext() || inEtsStylesComponentsContext()) && inEtsFlagsContext(64 /* EtsFlags.EtsStateStylesContext */);
|
||||
}
|
||||
function parseErrorAtPosition(start, length, message, arg0) {
|
||||
// Don't report another error if it would just be at the same position as the last error.
|
||||
@ -35623,7 +35633,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 (inEtsContext() && ts.isCallExpression(expr) && token() === 18 /* SyntaxKind.OpenBraceToken */) {
|
||||
if ((inStructContext() || inBuildContext() || inBuilderContext()) && ts.isCallExpression(expr) && token() === 18 /* SyntaxKind.OpenBraceToken */) {
|
||||
return makeEtsComponentExpression(expr, pos);
|
||||
}
|
||||
// It wasn't an assignment or a lambda. This is a conditional expression:
|
||||
@ -36824,7 +36834,7 @@ var ts;
|
||||
return finishNode(tagExpression, pos);
|
||||
}
|
||||
function parseCallExpressionRest(pos, expression) {
|
||||
var _a, _b, _c, _d;
|
||||
var _a, _b, _c, _d, _e, _f;
|
||||
var currentNodeName;
|
||||
while (true) {
|
||||
expression = parseMemberExpressionRest(pos, expression, /*allowOptionalChain*/ true);
|
||||
@ -36843,7 +36853,7 @@ var ts;
|
||||
typeArguments = expression.typeArguments;
|
||||
expression = expression.expression;
|
||||
}
|
||||
if ((isValidVirtualTypeArgumentsContext() || inBuilderContext()) && ts.isPropertyAccessExpression(expression)) {
|
||||
if (isValidVirtualTypeArgumentsContext() && ts.isPropertyAccessExpression(expression)) {
|
||||
var rootNode = ts.getRootEtsComponent(expression);
|
||||
if (rootNode) {
|
||||
var rootNodeName = (rootNode.expression).escapedText.toString();
|
||||
@ -36861,6 +36871,19 @@ var ts;
|
||||
else if (inEtsStateStylesContext() && stateStylesRootNode) {
|
||||
typeArguments = parseEtsTypeArguments(pos, "".concat(stateStylesRootNode, "Attribute"));
|
||||
}
|
||||
else if (inEtsStylesComponentsContext() || inEtsExtendComponentsContext()) {
|
||||
var virtualNode = ts.getVirtualEtsComponent(expression);
|
||||
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)) {
|
||||
setEtsStateStylesContext(true);
|
||||
rootNodeName = rootNodeName.replace("Instance", "");
|
||||
stateStylesRootNode = rootNodeName;
|
||||
typeArguments = parseEtsTypeArguments(pos, "".concat(rootNodeName, "Attribute"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var argumentList = parseArgumentList();
|
||||
var callExpr = questionDotToken || tryReparseOptionalChain(expression) ?
|
||||
@ -36876,14 +36899,14 @@ var ts;
|
||||
}
|
||||
break;
|
||||
}
|
||||
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 === ((_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)) {
|
||||
setEtsStateStylesContext(false);
|
||||
stateStylesRootNode = undefined;
|
||||
}
|
||||
return expression;
|
||||
}
|
||||
function isValidVirtualTypeArgumentsContext() {
|
||||
return (inBuildContext() || inBuilderContext()) && inStructContext();
|
||||
return inBuildContext() || inBuilderContext() || inEtsStylesComponentsContext() || inEtsExtendComponentsContext();
|
||||
}
|
||||
function parseArgumentList() {
|
||||
parseExpected(20 /* SyntaxKind.OpenParenToken */);
|
||||
|
@ -1809,7 +1809,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
function inEtsStateStylesContext() {
|
||||
return inEtsContext() && inStructContext() && inEtsFlagsContext(EtsFlags.EtsStateStylesContext);
|
||||
return inEtsContext() && (inBuildContext() || inBuilderContext() || inEtsExtendComponentsContext() || inEtsStylesComponentsContext()) && inEtsFlagsContext(EtsFlags.EtsStateStylesContext);
|
||||
}
|
||||
|
||||
function parseErrorAtPosition(start: number, length: number, message: DiagnosticMessage, arg0?: any): DiagnosticWithDetachedLocation | undefined {
|
||||
@ -4805,7 +4805,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
// It's a CallExpression with open brace followed, therefore, we think it's an EtsComponentExpression
|
||||
if (inEtsContext() && isCallExpression(expr) && token() === SyntaxKind.OpenBraceToken) {
|
||||
if ((inStructContext() || inBuildContext() || inBuilderContext()) && isCallExpression(expr) && token() === SyntaxKind.OpenBraceToken) {
|
||||
return makeEtsComponentExpression(expr, pos);
|
||||
}
|
||||
|
||||
@ -6179,7 +6179,7 @@ namespace ts {
|
||||
expression = (expression as ExpressionWithTypeArguments).expression;
|
||||
}
|
||||
|
||||
if ((isValidVirtualTypeArgumentsContext() || inBuilderContext()) && isPropertyAccessExpression(expression)) {
|
||||
if (isValidVirtualTypeArgumentsContext() && isPropertyAccessExpression(expression)) {
|
||||
const rootNode = getRootEtsComponent(expression);
|
||||
if (rootNode) {
|
||||
const rootNodeName = (<Identifier>(rootNode.expression)).escapedText.toString();
|
||||
@ -6196,6 +6196,18 @@ namespace ts {
|
||||
}
|
||||
else if (inEtsStateStylesContext() && stateStylesRootNode) {
|
||||
typeArguments = parseEtsTypeArguments(pos, `${stateStylesRootNode}Attribute`);
|
||||
} else if (inEtsStylesComponentsContext() || inEtsExtendComponentsContext()) {
|
||||
const virtualNode = getVirtualEtsComponent(expression);
|
||||
if (virtualNode) {
|
||||
let rootNodeName = (<Identifier>(virtualNode.expression)).escapedText.toString();
|
||||
currentNodeName = getTextOfPropertyName(expression.name).toString();
|
||||
if (currentNodeName === sourceFileCompilerOptions?.ets?.styles?.property) {
|
||||
setEtsStateStylesContext(true);
|
||||
rootNodeName = rootNodeName.replace("Instance", "");
|
||||
stateStylesRootNode = rootNodeName;
|
||||
typeArguments = parseEtsTypeArguments(pos, `${rootNodeName}Attribute`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
const argumentList = parseArgumentList();
|
||||
@ -6220,7 +6232,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
function isValidVirtualTypeArgumentsContext(): boolean {
|
||||
return (inBuildContext() || inBuilderContext()) && inStructContext();
|
||||
return inBuildContext() || inBuilderContext() || inEtsStylesComponentsContext() || inEtsExtendComponentsContext();
|
||||
}
|
||||
|
||||
function parseArgumentList() {
|
||||
|
@ -3375,6 +3375,16 @@ namespace ts {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function getVirtualEtsComponent(node: Node | undefined): PropertyAccessExpression | undefined {
|
||||
while (node) {
|
||||
if (isPropertyAccessExpression(node) && node.expression && node.expression.virtual) {
|
||||
return node;
|
||||
}
|
||||
node = (node as PropertyAccessExpression | CallExpression).expression;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function isKeyword(token: SyntaxKind): token is KeywordSyntaxKind {
|
||||
return SyntaxKind.FirstKeyword <= token && token <= SyntaxKind.LastKeyword;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user