Skip to content

Commit 09a879f

Browse files
author
Wangdahai
committed
Implement translator feature
1 parent 9762b2f commit 09a879f

File tree

1 file changed

+0
-7
lines changed

1 file changed

+0
-7
lines changed

src/translator.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -612,19 +612,12 @@ export class Translator implements StmtNS.Visitor<BaseNode>, ExprNS.Visitor<Base
612612

613613
visitComplexExpr(expr: ExprNS.Complex): ComplexLiteral {
614614
return {
615-
// 你可以复用 "Literal",也可以用别的 type 标记
616-
// 这里保持和 BigInt 的风格一致
617615
type: 'Literal',
618616

619-
// 和 visitBigIntLiteralExpr 类似,这里用一个字段来保存复数内容
620-
// 比如把它叫做 "complex"
621-
// expr.value 是一个 PyComplexNumber, 你可以用 toString(), 或者直接存 real/imag
622617
complex: {
623618
real: expr.value.real,
624619
imag: expr.value.imag
625620
},
626-
627-
// 和其它 literal 一样,加上位置信息
628621
loc: this.toEstreeLocation(expr),
629622
}
630623
}

0 commit comments

Comments
 (0)