mirror of
https://github.com/denoland/deno.git
synced 2025-01-21 13:00:36 -05:00
more nodes
This commit is contained in:
parent
7c7a888fa6
commit
8f104313ff
3 changed files with 264 additions and 82 deletions
|
@ -95,7 +95,9 @@ const Flags = {
|
|||
FnAsync: 0b00000001,
|
||||
FnGenerator: 0b00000010,
|
||||
FnDeclare: 0b00000100,
|
||||
FnOptional: 0b00001000,
|
||||
MemberComputed: 0b00000001,
|
||||
MemberOptional: 0b00000010,
|
||||
PropShorthand: 0b00000001,
|
||||
PropComputed: 0b00000010,
|
||||
PropGetter: 0b00000100,
|
||||
|
@ -243,7 +245,7 @@ const AstType = {
|
|||
TSInstantiation: 68,
|
||||
TSSatisfies: 69,
|
||||
PrivateIdentifier: 70,
|
||||
OptChain: 71,
|
||||
ChainExpression: 71,
|
||||
|
||||
StringLiteral: 72,
|
||||
BooleanLiteral: 73,
|
||||
|
@ -1519,7 +1521,7 @@ class CallExpression extends BaseNode {
|
|||
return createAstNode(this.#ctx, this.#typeArgId);
|
||||
}
|
||||
|
||||
optional = false; // FIXME
|
||||
optional = false;
|
||||
|
||||
#ctx;
|
||||
#calleeId;
|
||||
|
@ -1530,13 +1532,15 @@ class CallExpression extends BaseNode {
|
|||
* @param {AstContext} ctx
|
||||
* @param {number} parentId
|
||||
* @param {Deno.Range} range
|
||||
* @param {number} flags
|
||||
* @param {number} calleeId
|
||||
* @param {number} typeArgId
|
||||
* @param {number[]} argumentIds
|
||||
*/
|
||||
constructor(ctx, parentId, range, calleeId, typeArgId, argumentIds) {
|
||||
constructor(ctx, parentId, range, flags, calleeId, typeArgId, argumentIds) {
|
||||
super(ctx, parentId);
|
||||
|
||||
this.optional = (flags & Flags.FnOptional) !== 0;
|
||||
this.#ctx = ctx;
|
||||
this.#calleeId = calleeId;
|
||||
this.range = range;
|
||||
|
@ -1546,19 +1550,28 @@ class CallExpression extends BaseNode {
|
|||
}
|
||||
|
||||
/** @implements {Deno.ChainExpression} */
|
||||
class ChainExpression {
|
||||
class ChainExpression extends BaseNode {
|
||||
type = /** @type {const} */ ("ChainExpression");
|
||||
range;
|
||||
|
||||
get expression() {
|
||||
return /** @type {*} */ (createAstNode(this.#ctx, this.#exprId));
|
||||
}
|
||||
|
||||
#ctx;
|
||||
#exprId;
|
||||
|
||||
/**
|
||||
* @param {AstContext} ctx
|
||||
* @param {number} parentId
|
||||
* @param {Deno.Range} range
|
||||
* @param {number} exprId
|
||||
*/
|
||||
constructor(ctx, range) {
|
||||
constructor(ctx, parentId, range, exprId) {
|
||||
super(ctx, parentId);
|
||||
this.#ctx = ctx;
|
||||
this.range = range;
|
||||
this.#exprId = exprId;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1774,8 +1787,8 @@ class MemberExpression extends BaseNode {
|
|||
this.#propId,
|
||||
));
|
||||
}
|
||||
optional = false; // FIXME
|
||||
computed = false; // FIXME
|
||||
optional = false;
|
||||
computed = false;
|
||||
|
||||
#ctx;
|
||||
#objId;
|
||||
|
@ -1794,6 +1807,7 @@ class MemberExpression extends BaseNode {
|
|||
|
||||
this.#ctx = ctx;
|
||||
this.computed = (flags & Flags.MemberComputed) !== 0;
|
||||
this.optional = (flags & Flags.MemberOptional) !== 0;
|
||||
this.#objId = objId;
|
||||
this.#propId = propId;
|
||||
this.range = range;
|
||||
|
@ -3192,6 +3206,8 @@ function createAstNode(ctx, id) {
|
|||
return new BinaryExpression(ctx, parentId, range, flags, leftId, rightId);
|
||||
}
|
||||
case AstType.CallExpression: {
|
||||
const flags = buf[offset];
|
||||
offset += 1;
|
||||
const calleeId = readU32(buf, offset);
|
||||
const typeArgId = readU32(buf, offset + 4);
|
||||
const childIds = readChildIds(buf, offset + 8);
|
||||
|
@ -3199,11 +3215,16 @@ function createAstNode(ctx, id) {
|
|||
ctx,
|
||||
parentId,
|
||||
range,
|
||||
flags,
|
||||
calleeId,
|
||||
typeArgId,
|
||||
childIds,
|
||||
);
|
||||
}
|
||||
case AstType.ChainExpression: {
|
||||
const argId = readU32(buf, offset);
|
||||
return new ChainExpression(ctx, parentId, range, argId);
|
||||
}
|
||||
case AstType.ConditionalExpression: {
|
||||
const testId = readU32(buf, offset);
|
||||
const consId = readU32(buf, offset + 4);
|
||||
|
@ -3735,9 +3756,10 @@ function traverseInner(ctx, visitTypes, visitor, id) {
|
|||
|
||||
// Expressions
|
||||
case AstType.CallExpression: {
|
||||
const calleeId = readU32(buf, offset);
|
||||
const typeArgId = readU32(buf, offset + 4);
|
||||
const childIds = readChildIds(buf, offset + 8);
|
||||
offset += 1; // skip flags
|
||||
const calleeId = readU32(buf, offset + 1);
|
||||
const typeArgId = readU32(buf, offset + 5);
|
||||
const childIds = readChildIds(buf, offset + 9);
|
||||
|
||||
traverseInner(ctx, visitTypes, visitor, calleeId);
|
||||
traverseInner(ctx, visitTypes, visitor, typeArgId);
|
||||
|
@ -3945,6 +3967,7 @@ function traverseInner(ctx, visitTypes, visitor, id) {
|
|||
case AstType.AwaitExpression:
|
||||
case AstType.BreakStatement:
|
||||
case AstType.ContinueStatement:
|
||||
case AstType.ChainExpression:
|
||||
case AstType.ExpressionStatement:
|
||||
case AstType.JSXClosingElement:
|
||||
case AstType.JSXExpressionContainer:
|
||||
|
|
|
@ -6,11 +6,13 @@ use deno_ast::{
|
|||
Ident, IdentName, JSXAttrName, JSXAttrOrSpread, JSXAttrValue, JSXElement,
|
||||
JSXElementChild, JSXElementName, JSXEmptyExpr, JSXExpr, JSXExprContainer,
|
||||
JSXFragment, JSXMemberExpr, JSXNamespacedName, JSXObject,
|
||||
JSXOpeningElement, Lit, MemberProp, ModuleDecl, ModuleExportName,
|
||||
ModuleItem, ObjectPatProp, Param, ParamOrTsParamProp, Pat, Program, Prop,
|
||||
PropName, PropOrSpread, SimpleAssignTarget, Stmt, SuperProp, Tpl,
|
||||
TsEntityName, TsEnumMemberId, TsLit, TsType, TsTypeAnn, TsTypeElement,
|
||||
TsTypeParam, TsTypeParamDecl, TsUnionOrIntersectionType, VarDeclOrExpr,
|
||||
JSXOpeningElement, Lit, MemberExpr, MemberProp, ModuleDecl,
|
||||
ModuleExportName, ModuleItem, ObjectPatProp, OptChainBase, Param,
|
||||
ParamOrTsParamProp, Pat, PrivateName, Program, Prop, PropName,
|
||||
PropOrSpread, SimpleAssignTarget, Stmt, SuperProp, Tpl, TsEntityName,
|
||||
TsEnumMemberId, TsFnOrConstructorType, TsFnParam, TsLit, TsType,
|
||||
TsTypeAnn, TsTypeElement, TsTypeParam, TsTypeParamDecl, TsTypeQueryExpr,
|
||||
TsUnionOrIntersectionType, VarDeclOrExpr,
|
||||
},
|
||||
common::{Span, Spanned, SyntaxContext, DUMMY_SP},
|
||||
},
|
||||
|
@ -84,7 +86,7 @@ enum AstNode {
|
|||
MemberExpression,
|
||||
Super,
|
||||
Cond,
|
||||
Call,
|
||||
CallExpression,
|
||||
New,
|
||||
Paren,
|
||||
Seq,
|
||||
|
@ -104,7 +106,7 @@ enum AstNode {
|
|||
TsInstantiation,
|
||||
TsSatisfies,
|
||||
PrivateIdentifier,
|
||||
OptChain,
|
||||
ChainExpression,
|
||||
|
||||
// Literals
|
||||
StringLiteral,
|
||||
|
@ -161,6 +163,10 @@ enum AstNode {
|
|||
TSUnionType,
|
||||
TSIntersectionType,
|
||||
TSMappedType,
|
||||
TSTypeQuery,
|
||||
TSTupleType,
|
||||
TSFunctionType,
|
||||
TsCallSignatureDeclaration,
|
||||
|
||||
TSAnyKeyword,
|
||||
TSBigIntKeyword,
|
||||
|
@ -224,7 +230,9 @@ enum Flag {
|
|||
FnAsync,
|
||||
FnGenerator,
|
||||
FnDeclare,
|
||||
FnOptional,
|
||||
MemberComputed,
|
||||
MemberOptional,
|
||||
PropShorthand,
|
||||
PropComputed,
|
||||
PropGetter,
|
||||
|
@ -324,7 +332,9 @@ impl From<Flag> for u8 {
|
|||
Flag::FnAsync => 0b00000001,
|
||||
Flag::FnGenerator => 0b00000010,
|
||||
Flag::FnDeclare => 0b00000100,
|
||||
Flag::FnOptional => 0b00001000,
|
||||
Flag::MemberComputed => 0b00000001,
|
||||
Flag::MemberOptional => 0b00000010,
|
||||
Flag::PropShorthand => 0b00000001,
|
||||
Flag::PropComputed => 0b00000010,
|
||||
Flag::PropGetter => 0b00000100,
|
||||
|
@ -1312,21 +1322,23 @@ fn serialize_expr(
|
|||
let left_id = match &node.left {
|
||||
AssignTarget::Simple(simple_assign_target) => {
|
||||
match simple_assign_target {
|
||||
SimpleAssignTarget::Ident(binding_ident) => {
|
||||
serialize_ident(ctx, &binding_ident.id, id)
|
||||
SimpleAssignTarget::Ident(target) => {
|
||||
serialize_ident(ctx, &target.id, id)
|
||||
}
|
||||
SimpleAssignTarget::Member(member_expr) => {
|
||||
serialize_expr(ctx, &Expr::Member(member_expr.clone()), id)
|
||||
SimpleAssignTarget::Member(target) => {
|
||||
serialize_expr(ctx, &Expr::Member(target.clone()), id)
|
||||
}
|
||||
SimpleAssignTarget::SuperProp(super_prop_expr) => todo!(),
|
||||
SimpleAssignTarget::SuperProp(target) => todo!(),
|
||||
SimpleAssignTarget::Paren(paren_expr) => todo!(),
|
||||
SimpleAssignTarget::OptChain(opt_chain_expr) => todo!(),
|
||||
SimpleAssignTarget::OptChain(target) => {
|
||||
serialize_expr(ctx, &Expr::OptChain(target.clone()), id)
|
||||
}
|
||||
SimpleAssignTarget::TsAs(ts_as_expr) => todo!(),
|
||||
SimpleAssignTarget::TsSatisfies(ts_satisfies_expr) => todo!(),
|
||||
SimpleAssignTarget::TsNonNull(ts_non_null_expr) => todo!(),
|
||||
SimpleAssignTarget::TsTypeAssertion(ts_type_assertion) => todo!(),
|
||||
SimpleAssignTarget::TsInstantiation(ts_instantiation) => todo!(),
|
||||
SimpleAssignTarget::Invalid(invalid) => todo!(),
|
||||
SimpleAssignTarget::Invalid(_) => unreachable!(),
|
||||
}
|
||||
}
|
||||
AssignTarget::Pat(target) => match target {
|
||||
|
@ -1336,7 +1348,7 @@ fn serialize_expr(
|
|||
AssignTargetPat::Object(object_pat) => {
|
||||
serialize_pat(ctx, &Pat::Object(object_pat.clone()), id)
|
||||
}
|
||||
AssignTargetPat::Invalid(invalid) => todo!(),
|
||||
AssignTargetPat::Invalid(_) => unreachable!(),
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -1349,38 +1361,7 @@ fn serialize_expr(
|
|||
|
||||
id
|
||||
}
|
||||
Expr::Member(node) => {
|
||||
let id = ctx.next_id();
|
||||
|
||||
let mut flags = FlagValue::new();
|
||||
let obj_id = serialize_expr(ctx, node.obj.as_ref(), id);
|
||||
|
||||
let prop_id = match &node.prop {
|
||||
MemberProp::Ident(ident_name) => {
|
||||
serialize_ident_name(ctx, ident_name, id)
|
||||
}
|
||||
MemberProp::PrivateName(private_name) => {
|
||||
let child_id =
|
||||
ctx.push_node(AstNode::PrivateIdentifier, id, &private_name.span);
|
||||
|
||||
let str_id = ctx.str_table.insert(private_name.name.as_str());
|
||||
append_usize(&mut ctx.result, str_id);
|
||||
|
||||
child_id
|
||||
}
|
||||
MemberProp::Computed(computed_prop_name) => {
|
||||
flags.set(Flag::MemberComputed);
|
||||
serialize_expr(ctx, computed_prop_name.expr.as_ref(), id)
|
||||
}
|
||||
};
|
||||
|
||||
ctx.write_node(id, AstNode::MemberExpression, parent_id, &node.span);
|
||||
ctx.write_flags(&flags);
|
||||
ctx.write_id(obj_id);
|
||||
ctx.write_id(prop_id);
|
||||
|
||||
id
|
||||
}
|
||||
Expr::Member(node) => serialize_member_expr(ctx, node, parent_id, false),
|
||||
Expr::SuperProp(node) => {
|
||||
let id = ctx.next_id();
|
||||
|
||||
|
@ -1440,7 +1421,8 @@ fn serialize_expr(
|
|||
.map(|arg| serialize_expr_or_spread(ctx, arg, id))
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
ctx.write_node(id, AstNode::Call, parent_id, &node.span);
|
||||
ctx.write_node(id, AstNode::CallExpression, parent_id, &node.span);
|
||||
ctx.write_flags(&FlagValue::new());
|
||||
ctx.write_id(callee_id);
|
||||
ctx.write_id(type_id);
|
||||
ctx.write_ids(arg_ids);
|
||||
|
@ -1692,27 +1674,86 @@ fn serialize_expr(
|
|||
|
||||
id
|
||||
}
|
||||
Expr::PrivateName(node) => {
|
||||
let id = ctx.push_node(AstNode::PrivateIdentifier, parent_id, &node.span);
|
||||
|
||||
// FIXME
|
||||
|
||||
id
|
||||
}
|
||||
Expr::PrivateName(node) => serialize_private_name(ctx, node, parent_id),
|
||||
Expr::OptChain(node) => {
|
||||
let id = ctx.push_node(AstNode::OptChain, parent_id, &node.span);
|
||||
let id = ctx.next_id();
|
||||
|
||||
// FIXME
|
||||
let arg_id = match node.base.as_ref() {
|
||||
OptChainBase::Member(member_expr) => {
|
||||
serialize_member_expr(ctx, member_expr, id, true)
|
||||
}
|
||||
OptChainBase::Call(opt_call) => {
|
||||
let call_id = ctx.next_id();
|
||||
|
||||
let mut flags = FlagValue::new();
|
||||
flags.set(Flag::FnOptional);
|
||||
|
||||
let callee_id = serialize_expr(ctx, &opt_call.callee, id);
|
||||
let type_id = opt_call.type_args.as_ref().map_or(0, |type_arg| {
|
||||
todo!() // FIXME
|
||||
});
|
||||
|
||||
let arg_ids = opt_call
|
||||
.args
|
||||
.iter()
|
||||
.map(|arg| serialize_expr_or_spread(ctx, arg, id))
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
ctx.write_node(call_id, AstNode::CallExpression, id, &opt_call.span);
|
||||
ctx.write_flags(&flags);
|
||||
ctx.write_id(callee_id);
|
||||
ctx.write_id(type_id);
|
||||
ctx.write_ids(arg_ids);
|
||||
|
||||
call_id
|
||||
}
|
||||
};
|
||||
|
||||
ctx.write_node(id, AstNode::ChainExpression, parent_id, &node.span);
|
||||
ctx.write_id(arg_id);
|
||||
|
||||
id
|
||||
}
|
||||
Expr::Invalid(invalid) => {
|
||||
// ctx.push_node(result, AstNode::Invalid.into(), &invalid.span);
|
||||
todo!()
|
||||
Expr::Invalid(_) => {
|
||||
unreachable!()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn serialize_member_expr(
|
||||
ctx: &mut SerializeCtx,
|
||||
node: &MemberExpr,
|
||||
parent_id: usize,
|
||||
optional: bool,
|
||||
) -> usize {
|
||||
let id = ctx.next_id();
|
||||
|
||||
let mut flags = FlagValue::new();
|
||||
if optional {
|
||||
flags.set(Flag::MemberOptional)
|
||||
}
|
||||
|
||||
let obj_id = serialize_expr(ctx, node.obj.as_ref(), id);
|
||||
|
||||
let prop_id = match &node.prop {
|
||||
MemberProp::Ident(ident_name) => serialize_ident_name(ctx, ident_name, id),
|
||||
MemberProp::PrivateName(private_name) => {
|
||||
serialize_private_name(ctx, private_name, id)
|
||||
}
|
||||
MemberProp::Computed(computed_prop_name) => {
|
||||
flags.set(Flag::MemberComputed);
|
||||
serialize_expr(ctx, computed_prop_name.expr.as_ref(), id)
|
||||
}
|
||||
};
|
||||
|
||||
ctx.write_node(id, AstNode::MemberExpression, parent_id, &node.span);
|
||||
ctx.write_flags(&flags);
|
||||
ctx.write_id(obj_id);
|
||||
ctx.write_id(prop_id);
|
||||
|
||||
id
|
||||
}
|
||||
|
||||
fn serialize_expr_or_spread(
|
||||
ctx: &mut SerializeCtx,
|
||||
arg: &ExprOrSpread,
|
||||
|
@ -2033,7 +2074,31 @@ fn serialize_decl(
|
|||
.body
|
||||
.iter()
|
||||
.map(|item| match item {
|
||||
TsTypeElement::TsCallSignatureDecl(ts_call_signature_decl) => todo!(),
|
||||
TsTypeElement::TsCallSignatureDecl(ts_call) => {
|
||||
let item_id = ctx.next_id();
|
||||
|
||||
let type_param_id =
|
||||
maybe_serialize_ts_type_param(ctx, &ts_call.type_params, id);
|
||||
let return_type_id =
|
||||
maybe_serialize_ts_type_ann(ctx, &ts_call.type_ann, id);
|
||||
let param_ids = ts_call
|
||||
.params
|
||||
.iter()
|
||||
.map(|param| serialize_ts_fn_param(ctx, param, id))
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
ctx.write_node(
|
||||
item_id,
|
||||
AstNode::TsCallSignatureDeclaration,
|
||||
id,
|
||||
&ts_call.span,
|
||||
);
|
||||
ctx.write_id(type_param_id);
|
||||
ctx.write_ids(param_ids);
|
||||
ctx.write_id(return_type_id);
|
||||
|
||||
item_id
|
||||
}
|
||||
TsTypeElement::TsConstructSignatureDecl(
|
||||
ts_construct_signature_decl,
|
||||
) => todo!(),
|
||||
|
@ -2147,6 +2212,19 @@ fn accessibility_to_flag(
|
|||
}
|
||||
}
|
||||
|
||||
fn serialize_private_name(
|
||||
ctx: &mut SerializeCtx,
|
||||
node: &PrivateName,
|
||||
parent_id: usize,
|
||||
) -> usize {
|
||||
let id = ctx.push_node(AstNode::PrivateIdentifier, parent_id, &node.span);
|
||||
|
||||
let str_id = ctx.str_table.insert(node.name.as_str());
|
||||
append_usize(&mut ctx.result, str_id);
|
||||
|
||||
id
|
||||
}
|
||||
|
||||
fn serialize_jsx_element(
|
||||
ctx: &mut SerializeCtx,
|
||||
node: &JSXElement,
|
||||
|
@ -2539,7 +2617,7 @@ fn serialize_pat(ctx: &mut SerializeCtx, pat: &Pat, parent_id: usize) -> usize {
|
|||
|
||||
id
|
||||
}
|
||||
Pat::Invalid(node) => todo!(),
|
||||
Pat::Invalid(_) => unreachable!(),
|
||||
Pat::Expr(node) => serialize_expr(ctx, node, parent_id),
|
||||
}
|
||||
}
|
||||
|
@ -2553,7 +2631,9 @@ fn serialize_for_head(
|
|||
ForHead::VarDecl(var_decl) => {
|
||||
serialize_decl(ctx, &Decl::Var(var_decl.clone()), parent_id)
|
||||
}
|
||||
ForHead::UsingDecl(using_decl) => todo!(),
|
||||
ForHead::UsingDecl(using_decl) => {
|
||||
serialize_decl(ctx, &Decl::Using(using_decl.clone()), parent_id)
|
||||
}
|
||||
ForHead::Pat(pat) => serialize_pat(ctx, pat, parent_id),
|
||||
}
|
||||
}
|
||||
|
@ -2694,13 +2774,30 @@ fn serialize_ts_type(
|
|||
TsType::TsThisType(node) => {
|
||||
ctx.push_node(AstNode::TSThisType, parent_id, &node.span)
|
||||
}
|
||||
TsType::TsFnOrConstructorType(ts_fn_or_constructor_type) => todo!(),
|
||||
TsType::TsFnOrConstructorType(node) => {
|
||||
match node {
|
||||
TsFnOrConstructorType::TsFnType(node) => {
|
||||
let id = ctx.next_id();
|
||||
|
||||
let param_ids = node
|
||||
.params
|
||||
.iter()
|
||||
.map(|param| serialize_ts_fn_param(ctx, param, id))
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
ctx.write_node(id, AstNode::TSFunctionType, parent_id, &node.span);
|
||||
ctx.write_ids(param_ids);
|
||||
//
|
||||
id
|
||||
}
|
||||
TsFnOrConstructorType::TsConstructorType(ts_constructor_type) => {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
}
|
||||
TsType::TsTypeRef(node) => {
|
||||
let id = ctx.next_id();
|
||||
let name_id = match &node.type_name {
|
||||
TsEntityName::TsQualifiedName(ts_qualified_name) => todo!(),
|
||||
TsEntityName::Ident(ident) => serialize_ident(ctx, ident, id),
|
||||
};
|
||||
let name_id = serialize_ts_entity_name(ctx, &node.type_name, id);
|
||||
|
||||
// FIXME params
|
||||
|
||||
|
@ -2709,10 +2806,38 @@ fn serialize_ts_type(
|
|||
|
||||
id
|
||||
}
|
||||
TsType::TsTypeQuery(ts_type_query) => todo!(),
|
||||
TsType::TsTypeQuery(node) => {
|
||||
let id = ctx.next_id();
|
||||
|
||||
let name_id = match &node.expr_name {
|
||||
TsTypeQueryExpr::TsEntityName(entity) => {
|
||||
serialize_ts_entity_name(ctx, entity, id)
|
||||
}
|
||||
TsTypeQueryExpr::Import(ts_import_type) => todo!(),
|
||||
};
|
||||
|
||||
// FIXME: params
|
||||
|
||||
ctx.write_node(id, AstNode::TSTypeQuery, parent_id, &node.span);
|
||||
ctx.write_id(name_id);
|
||||
|
||||
id
|
||||
}
|
||||
TsType::TsTypeLit(ts_type_lit) => todo!(),
|
||||
TsType::TsArrayType(ts_array_type) => todo!(),
|
||||
TsType::TsTupleType(ts_tuple_type) => todo!(),
|
||||
TsType::TsTupleType(node) => {
|
||||
let id = ctx.next_id();
|
||||
let children = node
|
||||
.elem_types
|
||||
.iter()
|
||||
.map(|elem| todo!())
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
ctx.write_node(id, AstNode::TSTupleType, parent_id, &node.span);
|
||||
ctx.write_ids(children);
|
||||
|
||||
id
|
||||
}
|
||||
TsType::TsOptionalType(ts_optional_type) => todo!(),
|
||||
TsType::TsRestType(ts_rest_type) => todo!(),
|
||||
TsType::TsUnionOrIntersectionType(node) => match node {
|
||||
|
@ -2834,6 +2959,17 @@ fn serialize_ts_type(
|
|||
}
|
||||
}
|
||||
|
||||
fn serialize_ts_entity_name(
|
||||
ctx: &mut SerializeCtx,
|
||||
node: &TsEntityName,
|
||||
parent_id: usize,
|
||||
) -> usize {
|
||||
match &node {
|
||||
TsEntityName::TsQualifiedName(ts_qualified_name) => todo!(),
|
||||
TsEntityName::Ident(ident) => serialize_ident(ctx, ident, parent_id),
|
||||
}
|
||||
}
|
||||
|
||||
fn maybe_serialize_ts_type_ann(
|
||||
ctx: &mut SerializeCtx,
|
||||
node: &Option<Box<TsTypeAnn>>,
|
||||
|
@ -2918,3 +3054,22 @@ fn maybe_serialize_ts_type_param(
|
|||
id
|
||||
})
|
||||
}
|
||||
|
||||
fn serialize_ts_fn_param(
|
||||
ctx: &mut SerializeCtx,
|
||||
node: &TsFnParam,
|
||||
parent_id: usize,
|
||||
) -> usize {
|
||||
match node {
|
||||
TsFnParam::Ident(ident) => serialize_ident(ctx, ident, parent_id),
|
||||
TsFnParam::Array(pat) => {
|
||||
serialize_pat(ctx, &Pat::Array(pat.clone()), parent_id)
|
||||
}
|
||||
TsFnParam::Rest(pat) => {
|
||||
serialize_pat(ctx, &Pat::Rest(pat.clone()), parent_id)
|
||||
}
|
||||
TsFnParam::Object(pat) => {
|
||||
serialize_pat(ctx, &Pat::Object(pat.clone()), parent_id)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
8
cli/tsc/dts/lib.deno.ns.d.ts
vendored
8
cli/tsc/dts/lib.deno.ns.d.ts
vendored
|
@ -6305,8 +6305,7 @@ declare namespace Deno {
|
|||
|
||||
export interface ChainExpression extends BaseNode {
|
||||
type: "ChainExpression";
|
||||
// FIXME
|
||||
// expression: CallExpression | MemberExpression | TsNonNullExpression;
|
||||
expression: CallExpression | MemberExpression | TSNonNullExpression;
|
||||
}
|
||||
|
||||
// FIXME
|
||||
|
@ -6977,6 +6976,11 @@ declare namespace Deno {
|
|||
// FIXME
|
||||
}
|
||||
|
||||
export interface TSNonNullExpression extends BaseNode {
|
||||
type: "TSNonNullExpression";
|
||||
// FIXME
|
||||
}
|
||||
|
||||
export interface TSAnyKeyword extends BaseNode {
|
||||
type: "TSAnyKeyword";
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue