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 analyzer.src.generated.sdk2; | 5 library analyzer.src.generated.sdk2; |
6 | 6 |
7 import 'dart:collection'; | 7 import 'dart:collection'; |
8 import 'dart:io' as io; | 8 import 'dart:io' as io; |
9 | 9 |
10 import 'package:analyzer/dart/ast/ast.dart'; | 10 import 'package:analyzer/dart/ast/ast.dart'; |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 * Specify whether SDK summary should be used. | 112 * Specify whether SDK summary should be used. |
113 */ | 113 */ |
114 void set useSummary(bool use) { | 114 void set useSummary(bool use) { |
115 if (_analysisContext != null) { | 115 if (_analysisContext != null) { |
116 throw new StateError( | 116 throw new StateError( |
117 'The "useSummary" flag cannot be changed after context creation.'); | 117 'The "useSummary" flag cannot be changed after context creation.'); |
118 } | 118 } |
119 _useSummary = use; | 119 _useSummary = use; |
120 } | 120 } |
121 | 121 |
| 122 /** |
| 123 * Add the extensions from one or more sdk extension files to this sdk. The |
| 124 * [extensions] should be a table mapping the names of extensions to the paths |
| 125 * where those extensions can be found. |
| 126 */ |
| 127 void addExtensions(Map<String, String> extensions) { |
| 128 extensions.forEach((String uri, String path) { |
| 129 String shortName = uri.substring(uri.indexOf(':') + 1); |
| 130 SdkLibraryImpl library = new SdkLibraryImpl(shortName); |
| 131 library.path = path; |
| 132 libraryMap.setLibrary(uri, library); |
| 133 }); |
| 134 } |
| 135 |
122 @override | 136 @override |
123 Source fromFileUri(Uri uri) { | 137 Source fromFileUri(Uri uri) { |
124 File file = | 138 File file = |
125 resourceProvider.getFile(resourceProvider.pathContext.fromUri(uri)); | 139 resourceProvider.getFile(resourceProvider.pathContext.fromUri(uri)); |
126 String path = _getPath(file); | 140 String path = _getPath(file); |
127 if (path == null) { | 141 if (path == null) { |
128 return null; | 142 return null; |
129 } | 143 } |
130 try { | 144 try { |
131 return file.createSource(parseUriWithException(path)); | 145 return file.createSource(parseUriWithException(path)); |
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 SdkLibrariesReader_LibraryBuilder libraryBuilder = | 713 SdkLibrariesReader_LibraryBuilder libraryBuilder = |
700 new SdkLibrariesReader_LibraryBuilder(_useDart2jsPaths); | 714 new SdkLibrariesReader_LibraryBuilder(_useDart2jsPaths); |
701 // If any syntactic errors were found then don't try to visit the AST | 715 // If any syntactic errors were found then don't try to visit the AST |
702 // structure. | 716 // structure. |
703 if (!errorListener.errorReported) { | 717 if (!errorListener.errorReported) { |
704 unit.accept(libraryBuilder); | 718 unit.accept(libraryBuilder); |
705 } | 719 } |
706 return libraryBuilder.librariesMap; | 720 return libraryBuilder.librariesMap; |
707 } | 721 } |
708 } | 722 } |
OLD | NEW |