OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library mock_compiler; | 5 library mock_compiler; |
6 | 6 |
7 import "package:expect/expect.dart"; | 7 import "package:expect/expect.dart"; |
8 import 'dart:async'; | 8 import 'dart:async'; |
9 import 'dart:collection'; | 9 import 'dart:collection'; |
10 | 10 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 operator+(other) => this; | 124 operator+(other) => this; |
125 } | 125 } |
126 class JSPositiveInt extends JSInt {} | 126 class JSPositiveInt extends JSInt {} |
127 class JSUInt32 extends JSPositiveInt {} | 127 class JSUInt32 extends JSPositiveInt {} |
128 class JSUInt31 extends JSUInt32 {} | 128 class JSUInt31 extends JSUInt32 {} |
129 class JSNumber extends Interceptor implements num { | 129 class JSNumber extends Interceptor implements num { |
130 // All these methods return a number to please type inferencing. | 130 // All these methods return a number to please type inferencing. |
131 operator-() => (this is JSInt) ? 42 : 42.2; | 131 operator-() => (this is JSInt) ? 42 : 42.2; |
132 operator +(other) => (this is JSInt) ? 42 : 42.2; | 132 operator +(other) => (this is JSInt) ? 42 : 42.2; |
133 operator -(other) => (this is JSInt) ? 42 : 42.2; | 133 operator -(other) => (this is JSInt) ? 42 : 42.2; |
134 operator ~/(other) => 42; | 134 operator ~/(other) => _tdivFast(other); |
135 operator /(other) => (this is JSInt) ? 42 : 42.2; | 135 operator /(other) => (this is JSInt) ? 42 : 42.2; |
136 operator *(other) => (this is JSInt) ? 42 : 42.2; | 136 operator *(other) => (this is JSInt) ? 42 : 42.2; |
137 operator %(other) => (this is JSInt) ? 42 : 42.2; | 137 operator %(other) => (this is JSInt) ? 42 : 42.2; |
138 operator <<(other) => 42; | 138 operator <<(other) => _shlPositive(other); |
139 operator >>(other) => 42; | 139 operator >>(other) { |
| 140 return _shrBothPositive(other) + _shrReceiverPositive(other) + |
| 141 _shrOtherPositive(other); |
| 142 } |
140 operator |(other) => 42; | 143 operator |(other) => 42; |
141 operator &(other) => 42; | 144 operator &(other) => 42; |
142 operator ^(other) => 42; | 145 operator ^(other) => 42; |
143 | 146 |
144 operator >(other) => true; | 147 operator >(other) => true; |
145 operator >=(other) => true; | 148 operator >=(other) => true; |
146 operator <(other) => true; | 149 operator <(other) => true; |
147 operator <=(other) => true; | 150 operator <=(other) => true; |
148 operator ==(other) => true; | 151 operator ==(other) => true; |
149 get hashCode => throw "JSNumber.hashCode not implemented."; | 152 get hashCode => throw "JSNumber.hashCode not implemented."; |
150 | 153 |
| 154 _tdivFast(other) => 42; |
| 155 _shlPositive(other) => 42; |
| 156 _shrBothPositive(other) => 42; |
| 157 _shrReceiverPositive(other) => 42; |
| 158 _shrOtherPositive(other) => 42; |
| 159 |
151 abs() => (this is JSInt) ? 42 : 42.2; | 160 abs() => (this is JSInt) ? 42 : 42.2; |
152 remainder(other) => (this is JSInt) ? 42 : 42.2; | 161 remainder(other) => (this is JSInt) ? 42 : 42.2; |
153 truncate() => 42; | 162 truncate() => 42; |
154 } | 163 } |
155 class JSInt extends JSNumber implements int { | 164 class JSInt extends JSNumber implements int { |
156 } | 165 } |
157 class JSDouble extends JSNumber implements double { | 166 class JSDouble extends JSNumber implements double { |
158 } | 167 } |
159 class JSNull extends Interceptor { | 168 class JSNull extends Interceptor { |
160 bool operator==(other) => identical(null, other); | 169 bool operator==(other) => identical(null, other); |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
549 } else { | 558 } else { |
550 sourceFile = compiler.sourceFiles[uri.toString()]; | 559 sourceFile = compiler.sourceFiles[uri.toString()]; |
551 } | 560 } |
552 if (sourceFile != null && begin != null && end != null) { | 561 if (sourceFile != null && begin != null && end != null) { |
553 print(sourceFile.getLocationMessage(message, begin, end, true, (x) => x)); | 562 print(sourceFile.getLocationMessage(message, begin, end, true, (x) => x)); |
554 } else { | 563 } else { |
555 print(message); | 564 print(message); |
556 } | 565 } |
557 }; | 566 }; |
558 } | 567 } |
OLD | NEW |