Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(911)

Side by Side Diff: pkg/analyzer/lib/source/embedder.dart

Issue 1917203002: Remove more type casts (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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.source.embedder; 5 library analyzer.source.embedder;
6 6
7 import 'dart:collection' show HashMap; 7 import 'dart:collection' show HashMap;
8 import 'dart:core' hide Resource; 8 import 'dart:core' hide Resource;
9 9
10 import 'package:analyzer/file_system/file_system.dart'; 10 import 'package:analyzer/file_system/file_system.dart';
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 SdkLibraryImpl library = new SdkLibraryImpl(shortName); 204 SdkLibraryImpl library = new SdkLibraryImpl(shortName);
205 library.path = libPath; 205 library.path = libPath;
206 (dartSdk as EmbedderSdk)._librariesMap.setLibrary(name, library); 206 (dartSdk as EmbedderSdk)._librariesMap.setLibrary(name, library);
207 } 207 }
208 208
209 void _processEmbedderYaml(Folder libDir, YamlMap map) { 209 void _processEmbedderYaml(Folder libDir, YamlMap map) {
210 YamlNode embedded_libs = map[_EMBEDDED_LIB_MAP_KEY]; 210 YamlNode embedded_libs = map[_EMBEDDED_LIB_MAP_KEY];
211 if (embedded_libs == null) { 211 if (embedded_libs == null) {
212 return; 212 return;
213 } 213 }
214 if (embedded_libs is! YamlMap) { 214 if (embedded_libs is YamlMap) {
215 return; 215 embedded_libs.forEach((k, v) => _processEmbeddedLibs(k, v, libDir));
216 } 216 }
217 (embedded_libs as YamlMap)
218 .forEach((k, v) => _processEmbeddedLibs(k, v, libDir));
219 } 217 }
220 } 218 }
221 219
222 /// Given a packageMap, check in each package's lib directory for the 220 /// Given a packageMap, check in each package's lib directory for the
223 /// existence of an `_embedder.yaml` file. If the file contains a top level 221 /// existence of an `_embedder.yaml` file. If the file contains a top level
224 /// YamlMap, it will be added to the [embedderYamls] map. 222 /// YamlMap, it will be added to the [embedderYamls] map.
225 class EmbedderYamlLocator { 223 class EmbedderYamlLocator {
226 static const String EMBEDDER_FILE_NAME = '_embedder.yaml'; 224 static const String EMBEDDER_FILE_NAME = '_embedder.yaml';
227 225
228 // Map from package's library directory to the parsed 226 // Map from package's library directory to the parsed
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 String _readEmbedderYaml(Folder libDir) { 287 String _readEmbedderYaml(Folder libDir) {
290 File file = libDir.getChild(EMBEDDER_FILE_NAME); 288 File file = libDir.getChild(EMBEDDER_FILE_NAME);
291 try { 289 try {
292 return file.readAsStringSync(); 290 return file.readAsStringSync();
293 } on FileSystemException { 291 } on FileSystemException {
294 // File can't be read. 292 // File can't be read.
295 return null; 293 return null;
296 } 294 }
297 } 295 }
298 } 296 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/context/cache.dart » ('j') | pkg/analyzer/lib/src/dart/element/element.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698