| OLD | NEW |
| 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 /// Holds a couple utility functions used at various places in the system. | 5 /// Holds a couple utility functions used at various places in the system. |
| 6 library dev_compiler.src.utils; | 6 library dev_compiler.src.utils; |
| 7 | 7 |
| 8 import 'dart:io'; | 8 import 'dart:io'; |
| 9 | 9 |
| 10 import 'package:path/path.dart' as path; | 10 import 'package:path/path.dart' as path; |
| 11 import 'package:analyzer/src/generated/ast.dart' | 11 import 'package:analyzer/src/generated/ast.dart' |
| 12 show | 12 show |
| 13 ImportDirective, | 13 ImportDirective, |
| 14 ExportDirective, | 14 ExportDirective, |
| 15 PartDirective, | 15 PartDirective, |
| 16 CompilationUnit, | 16 CompilationUnit, |
| 17 Identifier, | 17 Identifier, |
| 18 AnnotatedNode, | 18 AnnotatedNode, |
| 19 AstNode, | 19 AstNode, |
| 20 Expression, | 20 Expression, |
| 21 SimpleIdentifier; | 21 SimpleIdentifier; |
| 22 import 'package:analyzer/src/generated/element.dart'; |
| 22 import 'package:analyzer/src/generated/engine.dart' | 23 import 'package:analyzer/src/generated/engine.dart' |
| 23 show ParseDartTask, AnalysisContext; | 24 show ParseDartTask, AnalysisContext; |
| 25 import 'package:analyzer/src/generated/resolver.dart' show TypeProvider; |
| 24 import 'package:analyzer/src/generated/source.dart' show Source; | 26 import 'package:analyzer/src/generated/source.dart' show Source; |
| 25 import 'package:analyzer/src/generated/element.dart'; | |
| 26 import 'package:analyzer/analyzer.dart' show parseDirectives; | 27 import 'package:analyzer/analyzer.dart' show parseDirectives; |
| 27 import 'package:crypto/crypto.dart' show CryptoUtils, MD5; | 28 import 'package:crypto/crypto.dart' show CryptoUtils, MD5; |
| 28 import 'package:source_span/source_span.dart'; | 29 import 'package:source_span/source_span.dart'; |
| 29 import 'package:yaml/yaml.dart'; | 30 import 'package:yaml/yaml.dart'; |
| 30 | 31 |
| 31 import 'codegen/js_names.dart' show invalidJSVariableName; | 32 import 'codegen/js_names.dart' show invalidJSVariableName; |
| 32 | 33 |
| 33 bool isDartPrivateLibrary(LibraryElement library) { | 34 bool isDartPrivateLibrary(LibraryElement library) { |
| 34 var uri = library.source.uri; | 35 var uri = library.source.uri; |
| 35 if (uri.scheme != "dart") return false; | 36 if (uri.scheme != "dart") return false; |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 // TODO(jmesserly): can we implement this without repeatedly reading pubspec? | 338 // TODO(jmesserly): can we implement this without repeatedly reading pubspec? |
| 338 // It seems like we should know our package's root directory without needing | 339 // It seems like we should know our package's root directory without needing |
| 339 // to search like this. | 340 // to search like this. |
| 340 var pubspec = | 341 var pubspec = |
| 341 loadYaml(new File(path.join(dir, 'pubspec.yaml')).readAsStringSync()); | 342 loadYaml(new File(path.join(dir, 'pubspec.yaml')).readAsStringSync()); |
| 342 | 343 |
| 343 // Ensure this is loaded from the dev_compiler package. | 344 // Ensure this is loaded from the dev_compiler package. |
| 344 if (pubspec['name'] != 'dev_compiler') return null; | 345 if (pubspec['name'] != 'dev_compiler') return null; |
| 345 return path.join('dev_compiler', 'runtime', filename); | 346 return path.join('dev_compiler', 'runtime', filename); |
| 346 } | 347 } |
| 348 |
| 349 InterfaceType fillDynamicTypeArgs(InterfaceType t, TypeProvider types) => |
| 350 t.substitute4(new List.filled(t.typeArguments.length, types.dynamicType)); |
| OLD | NEW |