| 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 'dart:uri'; | 7 import 'dart:uri'; |
| 8 | 8 |
| 9 import '../../../sdk/lib/_internal/compiler/compiler.dart' as api; | 9 import '../../../sdk/lib/_internal/compiler/compiler.dart' as api; |
| 10 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart' | 10 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart' |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 abstract class JavaScriptIndexingBehavior {} | 45 abstract class JavaScriptIndexingBehavior {} |
| 46 class JSInvocationMirror {} | 46 class JSInvocationMirror {} |
| 47 S() {} | 47 S() {} |
| 48 assertHelper(a){} | 48 assertHelper(a){} |
| 49 throwNoSuchMethod(obj, name, arguments, expectedArgumentNames) {}'''; | 49 throwNoSuchMethod(obj, name, arguments, expectedArgumentNames) {}'''; |
| 50 | 50 |
| 51 const String DEFAULT_INTERCEPTORSLIB = r''' | 51 const String DEFAULT_INTERCEPTORSLIB = r''' |
| 52 class JSArray { | 52 class JSArray { |
| 53 var length; | 53 var length; |
| 54 operator[](index) {} | 54 operator[](index) {} |
| 55 var add; |
| 55 } | 56 } |
| 56 class JSString { | 57 class JSString { |
| 57 var length; | 58 var length; |
| 59 operator[](index) {} |
| 58 } | 60 } |
| 59 class JSNumber { | 61 class JSNumber { |
| 60 } | 62 } |
| 61 class JSInt { | 63 class JSInt { |
| 62 } | 64 } |
| 63 class JSDouble { | 65 class JSDouble { |
| 64 } | 66 } |
| 65 class JSNull { | 67 class JSNull { |
| 66 } | 68 } |
| 67 class JSBool { | 69 class JSBool { |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 } | 228 } |
| 227 | 229 |
| 228 // The mock library doesn't need any patches. | 230 // The mock library doesn't need any patches. |
| 229 Uri resolvePatchUri(String dartLibraryName) => null; | 231 Uri resolvePatchUri(String dartLibraryName) => null; |
| 230 | 232 |
| 231 Script readScript(Uri uri, [ScriptTag node]) { | 233 Script readScript(Uri uri, [ScriptTag node]) { |
| 232 SourceFile sourceFile = sourceFiles[uri.toString()]; | 234 SourceFile sourceFile = sourceFiles[uri.toString()]; |
| 233 if (sourceFile == null) throw new ArgumentError(uri); | 235 if (sourceFile == null) throw new ArgumentError(uri); |
| 234 return new Script(uri, sourceFile); | 236 return new Script(uri, sourceFile); |
| 235 } | 237 } |
| 238 |
| 239 Element lookupElementIn(ScopeContainerElement container, SourceString name) { |
| 240 Element element = container.localLookup(name); |
| 241 return element != null |
| 242 ? element |
| 243 : new ErroneousElement(null, null, name, container); |
| 244 } |
| 236 } | 245 } |
| 237 | 246 |
| 238 void compareWarningKinds(String text, expectedWarnings, foundWarnings) { | 247 void compareWarningKinds(String text, expectedWarnings, foundWarnings) { |
| 239 var fail = (message) => Expect.fail('$text: $message'); | 248 var fail = (message) => Expect.fail('$text: $message'); |
| 240 HasNextIterator<MessageKind> expected = | 249 HasNextIterator<MessageKind> expected = |
| 241 new HasNextIterator(expectedWarnings.iterator); | 250 new HasNextIterator(expectedWarnings.iterator); |
| 242 HasNextIterator<WarningMessage> found = | 251 HasNextIterator<WarningMessage> found = |
| 243 new HasNextIterator(foundWarnings.iterator); | 252 new HasNextIterator(foundWarnings.iterator); |
| 244 while (expected.hasNext && found.hasNext) { | 253 while (expected.hasNext && found.hasNext) { |
| 245 Expect.equals(expected.next(), found.next().message.kind); | 254 Expect.equals(expected.next(), found.next().message.kind); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 operator []=(Node node, Element element) { | 291 operator []=(Node node, Element element) { |
| 283 map[node] = element; | 292 map[node] = element; |
| 284 } | 293 } |
| 285 | 294 |
| 286 operator [](Node node) => map[node]; | 295 operator [](Node node) => map[node]; |
| 287 | 296 |
| 288 void remove(Node node) { | 297 void remove(Node node) { |
| 289 map.remove(node); | 298 map.remove(node); |
| 290 } | 299 } |
| 291 } | 300 } |
| OLD | NEW |