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 import 'package:analyzer/dart/ast/ast.dart' hide ConstantEvaluator; | 5 import 'package:analyzer/dart/ast/ast.dart' hide ConstantEvaluator; |
6 import 'package:analyzer/dart/element/element.dart'; | 6 import 'package:analyzer/dart/element/element.dart'; |
7 import 'package:analyzer/dart/element/type.dart'; | 7 import 'package:analyzer/dart/element/type.dart'; |
8 import 'package:analyzer/src/generated/resolver.dart' show TypeProvider; | 8 import 'package:analyzer/src/generated/resolver.dart' show TypeProvider; |
9 | 9 |
10 import '../js/js_ast.dart' as JS show Node, Expression, TypeRef; | 10 import '../js_ast/js_ast.dart' as JS show Node, TypeRef; |
11 | 11 |
12 import 'closure_annotation.dart'; | 12 import 'closure_annotation.dart'; |
13 | 13 |
14 /// Mixin that can generate [ClosureAnnotation]s for Dart elements and types. | 14 /// Mixin that can generate [ClosureAnnotation]s for Dart elements and types. |
15 abstract class ClosureAnnotator { | 15 abstract class ClosureAnnotator { |
16 TypeProvider get types; | 16 TypeProvider get types; |
17 | 17 |
18 JS.TypeRef emitTypeRef(DartType type); | 18 JS.TypeRef emitTypeRef(DartType type); |
19 | 19 |
20 // TODO(ochafik): Handle destructured params when Closure supports it. | 20 // TODO(ochafik): Handle destructured params when Closure supports it. |
(...skipping 12 matching lines...) Expand all Loading... |
33 type: e is VariableElement | 33 type: e is VariableElement |
34 ? emitTypeRef(e.type /*, forceTypeDefExpansion: true*/) | 34 ? emitTypeRef(e.type /*, forceTypeDefExpansion: true*/) |
35 : null, | 35 : null, |
36 superType: e is ClassElement ? emitTypeRef(e.supertype) : null, | 36 superType: e is ClassElement ? emitTypeRef(e.supertype) : null, |
37 interfaces: | 37 interfaces: |
38 e is ClassElement ? e.interfaces.map(emitTypeRef).toList() : null, | 38 e is ClassElement ? e.interfaces.map(emitTypeRef).toList() : null, |
39 isOverride: e.isOverride, | 39 isOverride: e.isOverride, |
40 isTypedef: e is FunctionTypeAliasElement); | 40 isTypedef: e is FunctionTypeAliasElement); |
41 } | 41 } |
42 } | 42 } |
OLD | NEW |