| 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 operator &(other) => 42; | 144 operator &(other) => 42; |
| 145 operator ^(other) => 42; | 145 operator ^(other) => 42; |
| 146 | 146 |
| 147 operator >(other) => true; | 147 operator >(other) => true; |
| 148 operator >=(other) => true; | 148 operator >=(other) => true; |
| 149 operator <(other) => true; | 149 operator <(other) => true; |
| 150 operator <=(other) => true; | 150 operator <=(other) => true; |
| 151 operator ==(other) => true; | 151 operator ==(other) => true; |
| 152 get hashCode => throw "JSNumber.hashCode not implemented."; | 152 get hashCode => throw "JSNumber.hashCode not implemented."; |
| 153 | 153 |
| 154 _tdivFast(other) => 42; | 154 // We force side effects on _tdivFast to mimic the shortcomings of |
| 155 // the effect analysis: because the `_tdivFast` implementation of |
| 156 // the core library has calls that may not already be analyzed, |
| 157 // the analysis will conclude that `_tdivFast` may have side |
| 158 // effects. |
| 159 _tdivFast(other) => new List()..length = 42; |
| 155 _shlPositive(other) => 42; | 160 _shlPositive(other) => 42; |
| 156 _shrBothPositive(other) => 42; | 161 _shrBothPositive(other) => 42; |
| 157 _shrReceiverPositive(other) => 42; | 162 _shrReceiverPositive(other) => 42; |
| 158 _shrOtherPositive(other) => 42; | 163 _shrOtherPositive(other) => 42; |
| 159 | 164 |
| 160 abs() => (this is JSInt) ? 42 : 42.2; | 165 abs() => (this is JSInt) ? 42 : 42.2; |
| 161 remainder(other) => (this is JSInt) ? 42 : 42.2; | 166 remainder(other) => (this is JSInt) ? 42 : 42.2; |
| 162 truncate() => 42; | 167 truncate() => 42; |
| 163 } | 168 } |
| 164 class JSInt extends JSNumber implements int { | 169 class JSInt extends JSNumber implements int { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 const Object(); | 205 const Object(); |
| 201 operator ==(other) { return true; } | 206 operator ==(other) { return true; } |
| 202 get hashCode => throw "Object.hashCode not implemented."; | 207 get hashCode => throw "Object.hashCode not implemented."; |
| 203 String toString() { return null; } | 208 String toString() { return null; } |
| 204 noSuchMethod(im) { throw im; } | 209 noSuchMethod(im) { throw im; } |
| 205 } | 210 } |
| 206 abstract class StackTrace {} | 211 abstract class StackTrace {} |
| 207 class Type {} | 212 class Type {} |
| 208 class Function {} | 213 class Function {} |
| 209 class List<E> { | 214 class List<E> { |
| 215 var length; |
| 210 List([length]); | 216 List([length]); |
| 211 List.filled(length, element); | 217 List.filled(length, element); |
| 212 } | 218 } |
| 213 abstract class Map<K,V> {} | 219 abstract class Map<K,V> {} |
| 214 class DateTime { | 220 class DateTime { |
| 215 DateTime(year); | 221 DateTime(year); |
| 216 DateTime.utc(year); | 222 DateTime.utc(year); |
| 217 } | 223 } |
| 218 abstract class Pattern {} | 224 abstract class Pattern {} |
| 219 bool identical(Object a, Object b) { return true; } | 225 bool identical(Object a, Object b) { return true; } |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 } else { | 564 } else { |
| 559 sourceFile = compiler.sourceFiles[uri.toString()]; | 565 sourceFile = compiler.sourceFiles[uri.toString()]; |
| 560 } | 566 } |
| 561 if (sourceFile != null && begin != null && end != null) { | 567 if (sourceFile != null && begin != null && end != null) { |
| 562 print(sourceFile.getLocationMessage(message, begin, end, true, (x) => x)); | 568 print(sourceFile.getLocationMessage(message, begin, end, true, (x) => x)); |
| 563 } else { | 569 } else { |
| 564 print(message); | 570 print(message); |
| 565 } | 571 } |
| 566 }; | 572 }; |
| 567 } | 573 } |
| OLD | NEW |