| 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 library analyzer.src.generated.sdk_io; | 5 library analyzer.src.generated.sdk_io; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 import 'dart:io'; | 8 import 'dart:io'; |
| 9 | 9 |
| 10 import 'package:analyzer/dart/ast/ast.dart'; | 10 import 'package:analyzer/dart/ast/ast.dart'; |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 * Specify whether SDK summary should be used. | 101 * Specify whether SDK summary should be used. |
| 102 */ | 102 */ |
| 103 void set useSummary(bool use) { | 103 void set useSummary(bool use) { |
| 104 if (_analysisContext != null) { | 104 if (_analysisContext != null) { |
| 105 throw new StateError( | 105 throw new StateError( |
| 106 'The "useSummary" flag cannot be changed after context creation.'); | 106 'The "useSummary" flag cannot be changed after context creation.'); |
| 107 } | 107 } |
| 108 _useSummary = use; | 108 _useSummary = use; |
| 109 } | 109 } |
| 110 | 110 |
| 111 /** |
| 112 * Add the extensions from one or more sdk extension files to this sdk. The |
| 113 * [extensions] should be a table mapping the names of extensions to the paths |
| 114 * where those extensions can be found. |
| 115 */ |
| 116 void addExtensions(Map<String, String> extensions) { |
| 117 extensions.forEach((String uri, String path) { |
| 118 String shortName = uri.substring(uri.indexOf(':') + 1); |
| 119 SdkLibraryImpl library = new SdkLibraryImpl(shortName); |
| 120 library.path = path; |
| 121 libraryMap.setLibrary(uri, library); |
| 122 }); |
| 123 } |
| 124 |
| 111 @override | 125 @override |
| 112 Source fromFileUri(Uri uri) { | 126 Source fromFileUri(Uri uri) { |
| 113 JavaFile file = new JavaFile.fromUri(uri); | 127 JavaFile file = new JavaFile.fromUri(uri); |
| 114 | 128 |
| 115 String path = _getPath(file); | 129 String path = _getPath(file); |
| 116 if (path == null) { | 130 if (path == null) { |
| 117 return null; | 131 return null; |
| 118 } | 132 } |
| 119 try { | 133 try { |
| 120 return new FileBasedSource(file, parseUriWithException(path)); | 134 return new FileBasedSource(file, parseUriWithException(path)); |
| (...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 769 SdkLibrariesReader_LibraryBuilder libraryBuilder = | 783 SdkLibrariesReader_LibraryBuilder libraryBuilder = |
| 770 new SdkLibrariesReader_LibraryBuilder(_useDart2jsPaths); | 784 new SdkLibrariesReader_LibraryBuilder(_useDart2jsPaths); |
| 771 // If any syntactic errors were found then don't try to visit the AST | 785 // If any syntactic errors were found then don't try to visit the AST |
| 772 // structure. | 786 // structure. |
| 773 if (!errorListener.errorReported) { | 787 if (!errorListener.errorReported) { |
| 774 unit.accept(libraryBuilder); | 788 unit.accept(libraryBuilder); |
| 775 } | 789 } |
| 776 return libraryBuilder.librariesMap; | 790 return libraryBuilder.librariesMap; |
| 777 } | 791 } |
| 778 } | 792 } |
| OLD | NEW |