Temporary monomorphic Node projection

This commit is contained in:
Ron Buckton 2024-10-02 10:45:49 -04:00
Родитель 58e7fa6f9d
Коммит 6418f9c991
Не найден ключ, соответствующий данной подписи
2 изменённых файлов: 6 добавлений и 6 удалений

Просмотреть файл

@ -940,19 +940,19 @@ export class AstNode<N extends Node<SyntaxKind, AstData> = Node<SyntaxKind, AstD
return new AstNode(SyntaxKind.PropertyAccessExpression, new AstPropertyAccessExpressionData(), AnyNode /* PropertyAccessExpression */);
}
static PropertyAccessChain(): AstPropertyAccessChain {
return new AstNode(SyntaxKind.PropertyAccessExpression, new AstPropertyAccessExpressionData(), PropertyAccessExpression, NodeFlags.OptionalChain) as AstPropertyAccessChain;
return new AstNode(SyntaxKind.PropertyAccessExpression, new AstPropertyAccessExpressionData(), AnyNode as any /* PropertyAccessExpression */, NodeFlags.OptionalChain) as AstPropertyAccessChain;
}
static ElementAccessExpression(): AstElementAccessExpression {
return new AstNode(SyntaxKind.ElementAccessExpression, new AstElementAccessExpressionData(), AnyNode /* ElementAccessExpression */);
}
static ElementAccessChain(): AstElementAccessChain {
return new AstNode(SyntaxKind.ElementAccessExpression, new AstElementAccessExpressionData(), ElementAccessExpression, NodeFlags.OptionalChain) as AstElementAccessChain;
return new AstNode(SyntaxKind.ElementAccessExpression, new AstElementAccessExpressionData(), AnyNode as any /* ElementAccessExpression */, NodeFlags.OptionalChain) as AstElementAccessChain;
}
static CallExpression(): AstCallExpression {
return new AstNode(SyntaxKind.CallExpression, new AstCallExpressionData(), AnyNode /* CallExpression */);
}
static CallChain(): AstCallChain {
return new AstNode(SyntaxKind.CallExpression, new AstCallExpressionData(), CallExpression, NodeFlags.OptionalChain) as AstCallChain;
return new AstNode(SyntaxKind.CallExpression, new AstCallExpressionData(), AnyNode as any /*CallExpression*/, NodeFlags.OptionalChain) as AstCallChain;
}
static ExpressionWithTypeArguments(): AstExpressionWithTypeArguments {
return new AstNode(SyntaxKind.ExpressionWithTypeArguments, new AstExpressionWithTypeArgumentsData(), AnyNode /* ExpressionWithTypeArguments */);
@ -976,7 +976,7 @@ export class AstNode<N extends Node<SyntaxKind, AstData> = Node<SyntaxKind, AstD
return new AstNode(SyntaxKind.NonNullExpression, new AstNonNullExpressionData(), AnyNode /* NonNullExpression */);
}
static NonNullChain(): AstNonNullChain {
return new AstNode(SyntaxKind.NonNullExpression, new AstNonNullExpressionData(), NonNullExpression, NodeFlags.OptionalChain) as AstNonNullChain;
return new AstNode(SyntaxKind.NonNullExpression, new AstNonNullExpressionData(), AnyNode as any /* NonNullExpression */, NodeFlags.OptionalChain) as AstNonNullChain;
}
static MetaProperty(): AstMetaProperty {
return new AstNode(SyntaxKind.MetaProperty, new AstMetaPropertyData(), AnyNode /* MetaProperty */);

Просмотреть файл

@ -1245,8 +1245,8 @@ export class Node<
readonly ast: AstNode<this> = undefined!;
constructor(ast: AstNode<Node<K, T>>) {
this.ast = ast as AstNode<this>;
Object.preventExtensions(this);
this.ast = ast as AstNode<this>;
}
get kind(): K { return this.ast.kind; }
@ -5050,7 +5050,7 @@ export class CallExpression extends Node<SyntaxKind.CallExpression, AstCallExpre
get questionDotToken(): QuestionDotToken | undefined { return this.ast.data.questionDotToken?.node; }
get typeArguments(): NodeArray<TypeNode> | undefined { return this.ast.data.typeArguments?.nodes; }
get arguments(): NodeArray<Expression> { return this.ast.data.arguments.nodes; }
/** @internal */ set expression(value) { this.ast.data.expression = value.ast; }
/** @internal */ set questionDotToken(value) { this.ast.data.questionDotToken = value?.ast; }
/** @internal */ set typeArguments(value) { this.ast.data.typeArguments = value?.ast; }