OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 /// Utility functions to test the code generation tools with the resolver. | 5 /// Utility functions to test the code generation tools with the resolver. |
6 // Note, this is just for simple tests, so we restricted the logic to only | 6 // Note, this is just for simple tests, so we restricted the logic to only |
7 // support root-relative imports. For more sophisticated stuff, you should be | 7 // support root-relative imports. For more sophisticated stuff, you should be |
8 // using the test helpers in `package:transformer_test/utils.dart`. | 8 // using the test helpers in `package:transformer_test/utils.dart`. |
9 library smoke.test.codegen.testing_resolver_utils; | 9 library smoke.test.codegen.testing_resolver_utils; |
10 | 10 |
11 import 'package:analyzer/src/generated/element.dart'; | 11 import 'package:analyzer/dart/element/element.dart'; |
12 import 'package:analyzer/src/generated/engine.dart'; | 12 import 'package:analyzer/src/generated/engine.dart'; |
13 import 'package:analyzer/src/generated/java_io.dart'; | 13 import 'package:analyzer/src/generated/java_io.dart'; |
14 import 'package:analyzer/src/generated/source.dart'; | 14 import 'package:analyzer/src/generated/source.dart'; |
15 import 'package:analyzer/src/generated/sdk_io.dart' show DirectoryBasedDartSdk; | 15 import 'package:analyzer/src/generated/sdk_io.dart' show DirectoryBasedDartSdk; |
16 import 'package:transformer_test/utils.dart' show testingDartSdkDirectory; | 16 import 'package:transformer_test/utils.dart' show testingDartSdkDirectory; |
17 | 17 |
18 class LibraryProvider { | 18 class LibraryProvider { |
19 final AnalysisContext _analyzer; | 19 final AnalysisContext _analyzer; |
20 final Map<String, Source> _allSources; | 20 final Map<String, Source> _allSources; |
21 LibraryProvider(this._analyzer, this._allSources); | 21 LibraryProvider(this._analyzer, this._allSources); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 if (!uri.path.startsWith('/')) { | 100 if (!uri.path.startsWith('/')) { |
101 throw new UnimplementedError('relative URIs not supported: $uri'); | 101 throw new UnimplementedError('relative URIs not supported: $uri'); |
102 } | 102 } |
103 return uri; | 103 return uri; |
104 } | 104 } |
105 | 105 |
106 void getContentsToReceiver(Source_ContentReceiver receiver) { | 106 void getContentsToReceiver(Source_ContentReceiver receiver) { |
107 receiver.accept(rawContents, modificationStamp); | 107 receiver.accept(rawContents, modificationStamp); |
108 } | 108 } |
109 } | 109 } |
OLD | NEW |