@@ -228,11 +228,11 @@ impl exprCoder {
228
228
self.oc.write(")(")
229
229
self.oc.write(xVar)
230
230
match op.Id {
231
- | token::Id. Solidus
232
- | token::Id. SolidusEq:
231
+ | token::Solidus
232
+ | token::SolidusEq:
233
233
self.oc.write(" / ")
234
- | token::Id. Percent
235
- | token::Id. PercentEq:
234
+ | token::Percent
235
+ | token::PercentEq:
236
236
self.oc.write(" % ")
237
237
}
238
238
self.oc.write(yVar)
@@ -242,7 +242,7 @@ impl exprCoder {
242
242
// Tries to handle binary expressions with dynamic types and reports whether
243
243
// it successful. Should support all dynamic types.
244
244
fn unsafeDynamicBinary(mut &self, mut &buf: strings::Builder,
245
- mut l: sema::OperandExpr, mut r: sema::OperandExpr, op: token::Id ): bool {
245
+ mut l: sema::OperandExpr, mut r: sema::OperandExpr, op: int ): bool {
246
246
// Return immediately if binary expression is not contain dynamic type.
247
247
// Handle traits separately, see documentation of obj::IsAny.
248
248
// They handled as <any> type, but not have pure any type implementation,
@@ -281,7 +281,7 @@ impl exprCoder {
281
281
})
282
282
283
283
buf.WriteByte('(')!
284
- if op == token::Id. NotEq {
284
+ if op == token::NotEq {
285
285
buf.WriteByte('!')!
286
286
}
287
287
i := self.oc.pushAnyType(t)
@@ -307,14 +307,14 @@ impl exprCoder {
307
307
}
308
308
309
309
fn _unsafeBinaryNoDynamic(mut &self, mut &buf: strings::Builder, &l: str,
310
- &r: str, mut &lk: &sema::Type, mut &rk: &sema::Type, op: token::Id , kind: str) {
310
+ &r: str, mut &lk: &sema::Type, mut &rk: &sema::Type, op: int , kind: str) {
311
311
match {
312
312
| lk.Array() != nil:
313
313
// If this binary operator comparing array type.
314
314
// The left operand is will be array one always.
315
315
arr := lk.Array()
316
316
mut ins := obj::FindFuncGenericInstance(meta::Program.Runtime.ArrayCmp, arr.Elem)
317
- if op == token::Id. NotEq {
317
+ if op == token::NotEq {
318
318
buf.WriteByte('!')!
319
319
}
320
320
identCoder.funcIns(buf, ins)
@@ -336,9 +336,9 @@ impl exprCoder {
336
336
337
337
// guarantee integer wrap around if expressions is not a condition
338
338
match op {
339
- | token::Id. Gt | token::Id. GtEq
340
- | token::Id. Lt | token::Id. LtEq
341
- | token::Id.Eqs | token::Id. NotEq:
339
+ | token::Gt | token::GtEq
340
+ | token::Lt | token::LtEq
341
+ | token::DblEq | token::NotEq:
342
342
// No op.
343
343
|:
344
344
lp := lk.Prim()
@@ -363,9 +363,9 @@ impl exprCoder {
363
363
}
364
364
365
365
fn _unsafeBinary(mut &self, mut &buf: strings::Builder, mut l: sema::OperandExpr,
366
- mut r: sema::OperandExpr, op: token::Id , kind: str) {
366
+ mut r: sema::OperandExpr, op: int , kind: str) {
367
367
// Special cases for comparable types.
368
- if (op == token::Id.Eqs || op == token::Id. NotEq) && self.unsafeDynamicBinary(buf, l, r, op) {
368
+ if (op == token::DblEq || op == token::NotEq) && self.unsafeDynamicBinary(buf, l, r, op) {
369
369
ret
370
370
}
371
371
ls := writeAndReadFromBuf(self.oc.Buf, fn() { self.possibleRefExpr(l.Model) })
@@ -439,15 +439,15 @@ impl exprCoder {
439
439
440
440
fn binary(mut &self, mut m: &sema::BinaryExpr) {
441
441
match m.Op.Id {
442
- | token::Id. Solidus | token::Id. Percent:
442
+ | token::Solidus | token::Percent:
443
443
if env::Safety {
444
444
self.divByZeroBinary(m.Op, m.Left, m.Right)
445
445
ret
446
446
}
447
- | token::Id. Shl:
447
+ | token::Shl:
448
448
self.shl(m.Left, m.Right)
449
449
ret
450
- | token::Id. Shr:
450
+ | token::Shr:
451
451
self.shr(m.Left, m.Right)
452
452
ret
453
453
}
@@ -477,7 +477,7 @@ impl exprCoder {
477
477
fn unary(mut &self, mut m: &sema::UnaryExpr) {
478
478
// guarantee integer wrap around
479
479
match m.Op.Id {
480
- | token::Id. Plus | token::Id. Minus | token::Id. Caret:
480
+ | token::Plus | token::Minus | token::Caret:
481
481
lp := m.Expr.Type.Prim()
482
482
if lp != nil && types::IsInt(lp.Kind) {
483
483
self.oc.write("(")
@@ -490,12 +490,12 @@ impl exprCoder {
490
490
}
491
491
492
492
match m.Op.Id {
493
- | token::Id. Caret:
493
+ | token::Caret:
494
494
self.oc.write("(~(")
495
495
self.possibleRefExpr(m.Expr.Model)
496
496
self.oc.write("))")
497
497
ret
498
- | token::Id. Star:
498
+ | token::Star:
499
499
if env::Production || m.Expr.Type.Sptr() == nil {
500
500
break
501
501
}
@@ -1569,7 +1569,7 @@ impl exprCoder {
1569
1569
match type m.Err.Model {
1570
1570
| &sema::Var:
1571
1571
v := m.Err.Model.(&sema::Var)
1572
- if v.Ident == token::Kind.Error {
1572
+ if v.Ident == "error" {
1573
1573
if hasDefer {
1574
1574
self.oc.write(deferStackName + ".call();\n")
1575
1575
self.oc.indent()
@@ -1585,7 +1585,7 @@ impl exprCoder {
1585
1585
match type m.Err.Model {
1586
1586
| &sema::Var:
1587
1587
v := m.Err.Model.(&sema::Var)
1588
- if v.Ident == token::Kind.Error {
1588
+ if v.Ident == "error" {
1589
1589
self.oc.write(">{.error=except.error}")
1590
1590
ret
1591
1591
}
@@ -2378,11 +2378,11 @@ fn utoa(mut &s: strings::Builder, x: u64) {
2378
2378
}
2379
2379
2380
2380
fn structBinary(mut &buf: strings::Builder, mut &s: &sema::StructIns, &l: str,
2381
- &r: str, op: token::Id , kind: str) {
2382
- if op != token::Id.Eqs && op != token::Id. NotEq {
2381
+ &r: str, op: int , kind: str) {
2382
+ if op != token::DblEq && op != token::NotEq {
2383
2383
panic("cxx: unsupported token occurred for structure binary, this is an implementation mistake")
2384
2384
}
2385
- if op == token::Id. NotEq {
2385
+ if op == token::NotEq {
2386
2386
buf.WriteByte('!')!
2387
2387
}
2388
2388
identCoder.structureIns(buf, s)
@@ -2457,7 +2457,7 @@ struct useExprMemory {
2457
2457
DestType: &sema::Type
2458
2458
Model: sema::Expr
2459
2459
Type: int
2460
- OpId: token::Id
2460
+ OpId: int
2461
2461
OpKind: str
2462
2462
}
2463
2463
0 commit comments