@@ -4,137 +4,137 @@ class Tester {
4
4
constructor ( public x : i32 , public y : i32 ) {
5
5
}
6
6
7
- @operator ( '+' )
7
+ @operator ( "+" )
8
8
static add ( a : Tester , b : Tester ) : Tester {
9
9
return new Tester ( a . x + b . x , a . y + b . y ) ;
10
10
}
11
11
12
- @operator ( '-' )
12
+ @operator ( "-" )
13
13
static sub ( a : Tester , b : Tester ) : Tester {
14
14
return new Tester ( a . x - b . x , a . y - b . y ) ;
15
15
}
16
16
17
- @operator ( '*' )
17
+ @operator ( "*" )
18
18
static mul ( a : Tester , b : Tester ) : Tester {
19
19
return new Tester ( a . x * b . x , a . y * b . y ) ;
20
20
}
21
21
22
- @operator ( '/' )
22
+ @operator ( "/" )
23
23
static div ( a : Tester , b : Tester ) : Tester {
24
24
return new Tester ( a . x / b . x , a . y / b . y ) ;
25
25
}
26
26
27
- @operator ( '%' )
27
+ @operator ( "%" )
28
28
static mod ( a : Tester , b : Tester ) : Tester {
29
29
return new Tester ( a . x % b . x , a . y % b . y ) ;
30
30
}
31
31
32
- @operator ( '**' )
32
+ @operator ( "**" )
33
33
static pow ( a : Tester , b : Tester ) : Tester {
34
34
return new Tester ( < i32 > ( a . x ** b . x ) , < i32 > ( a . y ** b . y ) ) ;
35
35
}
36
36
37
- @operator ( '|' )
37
+ @operator ( "|" )
38
38
static or ( a : Tester , b : Tester ) : Tester {
39
39
return new Tester ( a . x | b . x , a . y | b . y ) ;
40
40
}
41
41
42
- @operator ( '&' )
42
+ @operator ( "&" )
43
43
static and ( a : Tester , b : Tester ) : Tester {
44
44
return new Tester ( a . x & b . x , a . y & b . y ) ;
45
45
}
46
46
47
- @operator ( '^' )
47
+ @operator ( "^" )
48
48
static xor ( a : Tester , b : Tester ) : Tester {
49
49
return new Tester ( a . x ^ b . x , a . y ^ b . y ) ;
50
50
}
51
51
52
- @operator ( '==' )
52
+ @operator ( "==" )
53
53
static equals ( a : Tester , b : Tester ) : bool {
54
54
return a . x == b . x && a . y == b . y ;
55
55
}
56
56
57
- @operator ( '!=' )
57
+ @operator ( "!=" )
58
58
static notEquals ( a : Tester , b : Tester ) : bool {
59
59
return a . x != b . x && a . y != b . y ;
60
60
}
61
61
62
- @operator ( '>' )
62
+ @operator ( ">" )
63
63
static greater ( a : Tester , b : Tester ) : bool {
64
64
return a . x > b . x && a . y > b . y ;
65
65
}
66
66
67
- @operator ( '>=' )
67
+ @operator ( ">=" )
68
68
static greaterEquals ( a : Tester , b : Tester ) : bool {
69
69
return a . x >= b . x && a . y >= b . y ;
70
70
}
71
71
72
- @operator ( '<' )
72
+ @operator ( "<" )
73
73
static less ( a : Tester , b : Tester ) : bool {
74
74
return a . x < b . x && a . y < b . y ;
75
75
}
76
76
77
- @operator ( '<=' )
77
+ @operator ( "<=" )
78
78
static lessEquals ( a : Tester , b : Tester ) : bool {
79
79
return a . x <= b . x && a . y <= b . y ;
80
80
}
81
81
82
- @operator ( '>>' )
82
+ @operator ( ">>" )
83
83
static shr ( value : Tester , shift : i32 ) : Tester {
84
84
return new Tester ( value . x >> shift , value . y >> shift ) ;
85
85
}
86
86
87
- @operator ( ' >>>' )
87
+ @operator ( " >>>" )
88
88
static shu ( value : Tester , shift : i32 ) : Tester {
89
89
return new Tester ( value . x >>> shift , value . y >>> shift ) ;
90
90
}
91
91
92
- @operator ( '<<' )
92
+ @operator ( "<<" )
93
93
static shl ( value : Tester , shift : i32 ) : Tester {
94
94
return new Tester ( value . x << shift , value . y << shift ) ;
95
95
}
96
96
97
97
// unary opterators
98
- @operator . prefix ( '~' )
98
+ @operator . prefix ( "~" )
99
99
static not ( value : Tester ) : Tester {
100
100
return new Tester ( ~ value . x , ~ value . y ) ;
101
101
}
102
102
103
- @operator . prefix ( '!' )
103
+ @operator . prefix ( "!" )
104
104
static excl ( value : Tester ) : bool {
105
105
return ! value . x && ! value . y ;
106
106
}
107
107
108
- @operator . prefix ( '+' )
108
+ @operator . prefix ( "+" )
109
109
static pos ( value : Tester ) : Tester {
110
110
return new Tester ( + value . x , + value . y ) ;
111
111
}
112
112
113
- @operator . prefix ( '-' )
113
+ @operator . prefix ( "-" )
114
114
static neg ( value : Tester ) : Tester {
115
115
return new Tester ( - value . x , - value . y ) ;
116
116
}
117
117
118
- @operator . prefix ( '++' )
118
+ @operator . prefix ( "++" )
119
119
inc ( ) : this {
120
120
++ this . x ;
121
121
++ this . y ;
122
122
return this ;
123
123
}
124
124
125
- @operator . prefix ( '--' )
125
+ @operator . prefix ( "--" )
126
126
dec ( ) : this {
127
127
-- this . x ;
128
128
-- this . y ;
129
129
return this ;
130
130
}
131
131
132
- @operator . postfix ( '++' )
132
+ @operator . postfix ( "++" )
133
133
postInc ( ) : Tester {
134
134
return new Tester ( this . x + 1 , this . y + 1 ) ;
135
135
}
136
136
137
- @operator . postfix ( '--' )
137
+ @operator . postfix ( "--" )
138
138
postDec ( ) : Tester {
139
139
return new Tester ( this . x - 1 , this . y - 1 ) ;
140
140
}
@@ -297,12 +297,12 @@ assert(incdec.x == 0 && incdec.y == 1);
297
297
class TesterInlineStatic {
298
298
constructor ( public x : i32 , public y : i32 ) {
299
299
}
300
- @inline @operator ( '+' )
300
+ @inline @operator ( "+" )
301
301
static add ( a : TesterInlineStatic , b : TesterInlineStatic ) : TesterInlineStatic {
302
302
return new TesterInlineStatic ( a . x + b . x , a . y + b . y ) ;
303
303
}
304
304
305
- @inline @operator . postfix ( '++' )
305
+ @inline @operator . postfix ( "++" )
306
306
static postInc ( a : TesterInlineStatic ) : TesterInlineStatic {
307
307
return new TesterInlineStatic ( a . x + 1 , a . y + 1 ) ;
308
308
}
@@ -317,12 +317,12 @@ assert(ais.x == 4 && ais.y == 6);
317
317
class TesterInlineInstance {
318
318
constructor ( public x : i32 , public y : i32 ) {
319
319
}
320
- @inline @operator ( '+' )
320
+ @inline @operator ( "+" )
321
321
add ( b : TesterInlineInstance ) : TesterInlineInstance {
322
322
return new TesterInlineInstance ( this . x + b . x , this . y + b . y ) ;
323
323
}
324
324
325
- @inline @operator . postfix ( '++' )
325
+ @inline @operator . postfix ( "++" )
326
326
postInc ( ) : TesterInlineInstance {
327
327
return new TesterInlineInstance ( this . x + 1 , this . y + 1 ) ;
328
328
}
0 commit comments