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:collection'; | 8 import 'dart:collection'; |
9 | 9 |
10 import '../../../sdk/lib/_internal/compiler/compiler.dart' as api; | 10 import '../../../sdk/lib/_internal/compiler/compiler.dart' as api; |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 class JSFixedArray extends JSMutableArray {} | 116 class JSFixedArray extends JSMutableArray {} |
117 class JSExtendableArray extends JSMutableArray {} | 117 class JSExtendableArray extends JSMutableArray {} |
118 class JSString extends Interceptor implements String, JSIndexable { | 118 class JSString extends Interceptor implements String, JSIndexable { |
119 var length; | 119 var length; |
120 operator[](index) {} | 120 operator[](index) {} |
121 toString() {} | 121 toString() {} |
122 operator+(other) => this; | 122 operator+(other) => this; |
123 } | 123 } |
124 class JSNumber extends Interceptor implements num { | 124 class JSNumber extends Interceptor implements num { |
125 // All these methods return a number to please type inferencing. | 125 // All these methods return a number to please type inferencing. |
126 operator-() => (this is JSInt) ? 42 : 42.0; | 126 operator-() => (this is JSInt) ? 42 : 42.2; |
127 operator +(other) => (this is JSInt) ? 42 : 42.0; | 127 operator +(other) => (this is JSInt) ? 42 : 42.2; |
128 operator -(other) => (this is JSInt) ? 42 : 42.0; | 128 operator -(other) => (this is JSInt) ? 42 : 42.2; |
129 operator ~/(other) => 42; | 129 operator ~/(other) => 42; |
130 operator /(other) => (this is JSInt) ? 42 : 42.0; | 130 operator /(other) => (this is JSInt) ? 42 : 42.2; |
131 operator *(other) => (this is JSInt) ? 42 : 42.0; | 131 operator *(other) => (this is JSInt) ? 42 : 42.2; |
132 operator %(other) => (this is JSInt) ? 42 : 42.0; | 132 operator %(other) => (this is JSInt) ? 42 : 42.2; |
133 operator <<(other) => 42; | 133 operator <<(other) => 42; |
134 operator >>(other) => 42; | 134 operator >>(other) => 42; |
135 operator |(other) => 42; | 135 operator |(other) => 42; |
136 operator &(other) => 42; | 136 operator &(other) => 42; |
137 operator ^(other) => 42; | 137 operator ^(other) => 42; |
138 | 138 |
139 operator >(other) => true; | 139 operator >(other) => true; |
140 operator >=(other) => true; | 140 operator >=(other) => true; |
141 operator <(other) => true; | 141 operator <(other) => true; |
142 operator <=(other) => true; | 142 operator <=(other) => true; |
143 operator ==(other) => true; | 143 operator ==(other) => true; |
144 get hashCode => throw "JSNumber.hashCode not implemented."; | 144 get hashCode => throw "JSNumber.hashCode not implemented."; |
145 | 145 |
146 abs() => (this is JSInt) ? 42 : 42.0; | 146 abs() => (this is JSInt) ? 42 : 42.2; |
147 remainder(other) => (this is JSInt) ? 42 : 42.0; | 147 remainder(other) => (this is JSInt) ? 42 : 42.2; |
148 truncate() => 42; | 148 truncate() => 42; |
149 } | 149 } |
150 class JSInt extends JSNumber implements int { | 150 class JSInt extends JSNumber implements int { |
151 } | 151 } |
152 class JSDouble extends JSNumber implements double { | 152 class JSDouble extends JSNumber implements double { |
153 } | 153 } |
154 class JSNull extends Interceptor { | 154 class JSNull extends Interceptor { |
155 bool operator==(other) => identical(null, other); | 155 bool operator==(other) => identical(null, other); |
156 get hashCode => throw "JSNull.hashCode not implemented."; | 156 get hashCode => throw "JSNull.hashCode not implemented."; |
157 String toString() => 'Null'; | 157 String toString() => 'Null'; |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 } | 460 } |
461 } | 461 } |
462 | 462 |
463 class MockDeferredLoadTask extends DeferredLoadTask { | 463 class MockDeferredLoadTask extends DeferredLoadTask { |
464 MockDeferredLoadTask(Compiler compiler) : super(compiler); | 464 MockDeferredLoadTask(Compiler compiler) : super(compiler); |
465 | 465 |
466 void registerMainApp(LibraryElement mainApp) { | 466 void registerMainApp(LibraryElement mainApp) { |
467 // Do nothing. | 467 // Do nothing. |
468 } | 468 } |
469 } | 469 } |
OLD | NEW |