| 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 |
| 11 import 'package:compiler/compiler.dart' as api; | 11 import 'package:compiler/compiler.dart' as api; |
| 12 import 'package:compiler/compiler_new.dart' as new_api; | 12 import 'package:compiler/compiler_new.dart' as new_api; |
| 13 import 'package:compiler/src/common/names.dart' show | 13 import 'package:compiler/src/common/names.dart' show |
| 14 Uris; | 14 Uris; |
| 15 import 'package:compiler/src/constants/expressions.dart'; | 15 import 'package:compiler/src/constants/expressions.dart'; |
| 16 import 'package:compiler/src/diagnostics/diagnostic_listener.dart'; | 16 import 'package:compiler/src/diagnostics/diagnostic_listener.dart'; |
| 17 import 'package:compiler/src/diagnostics/source_span.dart'; | 17 import 'package:compiler/src/diagnostics/source_span.dart'; |
| 18 import 'package:compiler/src/diagnostics/spannable.dart'; | 18 import 'package:compiler/src/diagnostics/spannable.dart'; |
| 19 import 'package:compiler/src/elements/elements.dart'; | 19 import 'package:compiler/src/elements/elements.dart'; |
| 20 import 'package:compiler/src/elements/visitor.dart'; |
| 20 import 'package:compiler/src/js_backend/backend_helpers.dart' | 21 import 'package:compiler/src/js_backend/backend_helpers.dart' |
| 21 show BackendHelpers; | 22 show BackendHelpers; |
| 22 import 'package:compiler/src/js_backend/lookup_map_analysis.dart' | 23 import 'package:compiler/src/js_backend/lookup_map_analysis.dart' |
| 23 show LookupMapAnalysis; | 24 show LookupMapAnalysis; |
| 24 import 'package:compiler/src/io/source_file.dart'; | 25 import 'package:compiler/src/io/source_file.dart'; |
| 25 import 'package:compiler/src/resolution/members.dart'; | 26 import 'package:compiler/src/resolution/members.dart'; |
| 26 import 'package:compiler/src/resolution/registry.dart'; | 27 import 'package:compiler/src/resolution/registry.dart'; |
| 27 import 'package:compiler/src/resolution/scope.dart'; | 28 import 'package:compiler/src/resolution/scope.dart'; |
| 28 import 'package:compiler/src/resolution/tree_elements.dart'; | 29 import 'package:compiler/src/resolution/tree_elements.dart'; |
| 29 import 'package:compiler/src/script.dart'; | 30 import 'package:compiler/src/script.dart'; |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 class MockElement extends FunctionElementX { | 341 class MockElement extends FunctionElementX { |
| 341 MockElement(Element enclosingElement) | 342 MockElement(Element enclosingElement) |
| 342 : super('', ElementKind.FUNCTION, Modifiers.EMPTY, | 343 : super('', ElementKind.FUNCTION, Modifiers.EMPTY, |
| 343 enclosingElement); | 344 enclosingElement); |
| 344 | 345 |
| 345 get node => null; | 346 get node => null; |
| 346 | 347 |
| 347 parseNode(_) => null; | 348 parseNode(_) => null; |
| 348 | 349 |
| 349 bool get hasNode => false; | 350 bool get hasNode => false; |
| 351 |
| 352 accept(ElementVisitor visitor, arg) { |
| 353 return visitor.visitMethodElement(this, arg); |
| 354 } |
| 350 } | 355 } |
| 351 | 356 |
| 352 // TODO(herhut): Disallow warnings and errors during compilation by default. | 357 // TODO(herhut): Disallow warnings and errors during compilation by default. |
| 353 MockCompiler compilerFor(String code, Uri uri, | 358 MockCompiler compilerFor(String code, Uri uri, |
| 354 {bool analyzeAll: false, | 359 {bool analyzeAll: false, |
| 355 bool analyzeOnly: false, | 360 bool analyzeOnly: false, |
| 356 Map<String, String> coreSource, | 361 Map<String, String> coreSource, |
| 357 bool disableInlining: true, | 362 bool disableInlining: true, |
| 358 bool minify: false, | 363 bool minify: false, |
| 359 bool trustTypeAnnotations: false, | 364 bool trustTypeAnnotations: false, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 371 trustTypeAnnotations: trustTypeAnnotations, | 376 trustTypeAnnotations: trustTypeAnnotations, |
| 372 enableTypeAssertions: enableTypeAssertions, | 377 enableTypeAssertions: enableTypeAssertions, |
| 373 enableUserAssertions: enableUserAssertions, | 378 enableUserAssertions: enableUserAssertions, |
| 374 expectedErrors: expectedErrors, | 379 expectedErrors: expectedErrors, |
| 375 expectedWarnings: expectedWarnings, | 380 expectedWarnings: expectedWarnings, |
| 376 outputProvider: outputProvider); | 381 outputProvider: outputProvider); |
| 377 compiler.registerSource(uri, code); | 382 compiler.registerSource(uri, code); |
| 378 compiler.diagnosticHandler = createHandler(compiler, code); | 383 compiler.diagnosticHandler = createHandler(compiler, code); |
| 379 return compiler; | 384 return compiler; |
| 380 } | 385 } |
| OLD | NEW |