| 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 | 6 |
| 7 import 'dart:io'; | 7 import 'dart:io'; |
| 8 import 'package:path/path.dart' as path; | 8 import 'package:path/path.dart' as path; |
| 9 import 'package:analyzer/src/generated/ast.dart' | 9 import 'package:analyzer/dart/ast/ast.dart' |
| 10 show | 10 show |
| 11 ImportDirective, | 11 ImportDirective, |
| 12 ExportDirective, | 12 ExportDirective, |
| 13 PartDirective, | 13 PartDirective, |
| 14 CompilationUnit, | 14 CompilationUnit, |
| 15 Identifier, | 15 Identifier, |
| 16 AnnotatedNode, | 16 AnnotatedNode, |
| 17 AstNode, | 17 AstNode, |
| 18 Expression, | 18 Expression, |
| 19 SimpleIdentifier, | 19 SimpleIdentifier, |
| 20 MethodInvocation; | 20 MethodInvocation; |
| 21 import 'package:analyzer/dart/element/element.dart'; |
| 22 import 'package:analyzer/dart/element/type.dart'; |
| 21 import 'package:analyzer/src/generated/constant.dart' show DartObject; | 23 import 'package:analyzer/src/generated/constant.dart' show DartObject; |
| 22 import 'package:analyzer/src/generated/element.dart'; | 24 //TODO(leafp): Remove deprecated dependency |
| 25 //ignore: DEPRECATED_MEMBER_USE |
| 26 import 'package:analyzer/src/generated/element.dart' show DynamicTypeImpl; |
| 23 import 'package:analyzer/src/generated/engine.dart' show AnalysisContext; | 27 import 'package:analyzer/src/generated/engine.dart' show AnalysisContext; |
| 24 import 'package:analyzer/src/generated/error.dart' show ErrorCode; | 28 import 'package:analyzer/src/generated/error.dart' show ErrorCode; |
| 25 import 'package:analyzer/src/task/dart.dart' show ParseDartTask; | 29 import 'package:analyzer/src/task/dart.dart' show ParseDartTask; |
| 26 import 'package:analyzer/src/generated/resolver.dart' show TypeProvider; | 30 import 'package:analyzer/src/generated/resolver.dart' show TypeProvider; |
| 27 import 'package:analyzer/src/generated/source.dart' show LineInfo, Source; | 31 import 'package:analyzer/src/generated/source.dart' show LineInfo, Source; |
| 28 import 'package:analyzer/analyzer.dart' show parseDirectives; | 32 import 'package:analyzer/analyzer.dart' show parseDirectives; |
| 29 import 'package:crypto/crypto.dart' show CryptoUtils, MD5; | 33 import 'package:crypto/crypto.dart' show CryptoUtils, MD5; |
| 30 import 'package:source_span/source_span.dart'; | 34 import 'package:source_span/source_span.dart'; |
| 31 | 35 |
| 32 import 'codegen/js_names.dart' show invalidVariableName; | 36 import 'codegen/js_names.dart' show invalidVariableName; |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 _ensureParentExists(destination); | 469 _ensureParentExists(destination); |
| 466 new File(source).copySync(destination); | 470 new File(source).copySync(destination); |
| 467 } | 471 } |
| 468 | 472 |
| 469 void writeAsStringSync(String file, String contents) { | 473 void writeAsStringSync(String file, String contents) { |
| 470 _ensureParentExists(file); | 474 _ensureParentExists(file); |
| 471 new File(file).writeAsStringSync(contents); | 475 new File(file).writeAsStringSync(contents); |
| 472 } | 476 } |
| 473 } | 477 } |
| 474 | 478 |
| 479 //TODO(leafp): Is this really necessary? In theory I think |
| 480 // the static type should always be filled in for resolved |
| 481 // ASTs. This may be a vestigial workaround. |
| 475 DartType getStaticType(Expression e) => | 482 DartType getStaticType(Expression e) => |
| 476 e.staticType ?? DynamicTypeImpl.instance; | 483 e.staticType ?? DynamicTypeImpl.instance; |
| 477 | 484 |
| 478 // TODO(leafp) Factor this out or use an existing library | 485 // TODO(leafp) Factor this out or use an existing library |
| 479 class Tuple2<T0, T1> { | 486 class Tuple2<T0, T1> { |
| 480 final T0 e0; | 487 final T0 e0; |
| 481 final T1 e1; | 488 final T1 e1; |
| 482 Tuple2(this.e0, this.e1); | 489 Tuple2(this.e0, this.e1); |
| 483 } | 490 } |
| OLD | NEW |