| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 | 9 |
| 10 import 'package:compiler/compiler.dart' as api; | 10 import 'package:compiler/compiler.dart' as api; |
| 11 import 'package:compiler/src/common/names.dart' show Uris; | 11 import 'package:compiler/src/common/names.dart' show Uris; |
| 12 import 'package:compiler/src/constants/expressions.dart'; | 12 import 'package:compiler/src/constants/expressions.dart'; |
| 13 import 'package:compiler/src/elements/resolution_types.dart' show DartType; | 13 import 'package:compiler/src/elements/resolution_types.dart' |
| 14 show ResolutionDartType; |
| 14 import 'package:compiler/src/diagnostics/diagnostic_listener.dart'; | 15 import 'package:compiler/src/diagnostics/diagnostic_listener.dart'; |
| 15 import 'package:compiler/src/diagnostics/source_span.dart'; | 16 import 'package:compiler/src/diagnostics/source_span.dart'; |
| 16 import 'package:compiler/src/diagnostics/spannable.dart'; | 17 import 'package:compiler/src/diagnostics/spannable.dart'; |
| 17 import 'package:compiler/src/elements/elements.dart'; | 18 import 'package:compiler/src/elements/elements.dart'; |
| 18 import 'package:compiler/src/elements/visitor.dart'; | 19 import 'package:compiler/src/elements/visitor.dart'; |
| 19 import 'package:compiler/src/js_backend/backend_helpers.dart' | 20 import 'package:compiler/src/js_backend/backend_helpers.dart' |
| 20 show BackendHelpers; | 21 show BackendHelpers; |
| 21 import 'package:compiler/src/js_backend/lookup_map_analysis.dart' | 22 import 'package:compiler/src/js_backend/lookup_map_analysis.dart' |
| 22 show LookupMapAnalysis; | 23 show LookupMapAnalysis; |
| 23 import 'package:compiler/src/io/source_file.dart'; | 24 import 'package:compiler/src/io/source_file.dart'; |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 | 315 |
| 315 List<ConstantExpression> get constants { | 316 List<ConstantExpression> get constants { |
| 316 List<ConstantExpression> list = <ConstantExpression>[]; | 317 List<ConstantExpression> list = <ConstantExpression>[]; |
| 317 forEachConstantNode((_, c) => list.add(c)); | 318 forEachConstantNode((_, c) => list.add(c)); |
| 318 return list; | 319 return list; |
| 319 } | 320 } |
| 320 } | 321 } |
| 321 | 322 |
| 322 class MockTypeVariablesScope extends TypeVariablesScope { | 323 class MockTypeVariablesScope extends TypeVariablesScope { |
| 323 @override | 324 @override |
| 324 List<DartType> get typeVariables => <DartType>[]; | 325 List<ResolutionDartType> get typeVariables => <ResolutionDartType>[]; |
| 325 MockTypeVariablesScope(Scope parent) : super(parent); | 326 MockTypeVariablesScope(Scope parent) : super(parent); |
| 326 String toString() => 'MockTypeVariablesScope($parent)'; | 327 String toString() => 'MockTypeVariablesScope($parent)'; |
| 327 } | 328 } |
| 328 | 329 |
| 329 // The mock compiler does not split the program in output units. | 330 // The mock compiler does not split the program in output units. |
| 330 class MockDeferredLoadTask extends DeferredLoadTask { | 331 class MockDeferredLoadTask extends DeferredLoadTask { |
| 331 MockDeferredLoadTask(Compiler compiler) : super(compiler); | 332 MockDeferredLoadTask(Compiler compiler) : super(compiler); |
| 332 | 333 |
| 333 OutputUnit getElementOutputUnit(dynamic dependency) { | 334 OutputUnit getElementOutputUnit(dynamic dependency) { |
| 334 return mainOutputUnit; | 335 return mainOutputUnit; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 trustTypeAnnotations: trustTypeAnnotations, | 391 trustTypeAnnotations: trustTypeAnnotations, |
| 391 enableTypeAssertions: enableTypeAssertions, | 392 enableTypeAssertions: enableTypeAssertions, |
| 392 enableUserAssertions: enableUserAssertions, | 393 enableUserAssertions: enableUserAssertions, |
| 393 expectedErrors: expectedErrors, | 394 expectedErrors: expectedErrors, |
| 394 expectedWarnings: expectedWarnings, | 395 expectedWarnings: expectedWarnings, |
| 395 outputProvider: outputProvider); | 396 outputProvider: outputProvider); |
| 396 compiler.registerSource(uri, code); | 397 compiler.registerSource(uri, code); |
| 397 compiler.diagnosticHandler = createHandler(compiler, code); | 398 compiler.diagnosticHandler = createHandler(compiler, code); |
| 398 return compiler; | 399 return compiler; |
| 399 } | 400 } |
| OLD | NEW |