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 | 2 |
3 // for details. All rights reserved. Use of this source code is governed by a | 3 // for details. All rights reserved. Use of this source code is governed by a |
4 // BSD-style license that can be found in the LICENSE file. | 4 // BSD-style license that can be found in the LICENSE file. |
5 | 5 |
6 import 'dart:collection' show HashMap, HashSet; | 6 import 'dart:collection' show HashMap, HashSet; |
7 import 'dart:math' show min, max; | 7 import 'dart:math' show min, max; |
8 | 8 |
9 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator; | 9 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator; |
10 import 'package:analyzer/dart/ast/ast.dart'; | 10 import 'package:analyzer/dart/ast/ast.dart'; |
(...skipping 2940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2951 return _emitAnnotatedResult(typeName, metadata); | 2951 return _emitAnnotatedResult(typeName, metadata); |
2952 } | 2952 } |
2953 | 2953 |
2954 JS.Expression _emitFieldSignature(DartType type, | 2954 JS.Expression _emitFieldSignature(DartType type, |
2955 {List<Annotation> metadata, bool isFinal: true}) { | 2955 {List<Annotation> metadata, bool isFinal: true}) { |
2956 var args = [_emitType(type)]; | 2956 var args = [_emitType(type)]; |
2957 if (options.emitMetadata && metadata != null && metadata.isNotEmpty) { | 2957 if (options.emitMetadata && metadata != null && metadata.isNotEmpty) { |
2958 args.add(new JS.ArrayInitializer( | 2958 args.add(new JS.ArrayInitializer( |
2959 metadata.map(_instantiateAnnotation).toList())); | 2959 metadata.map(_instantiateAnnotation).toList())); |
2960 } | 2960 } |
2961 return _callHelper(isFinal ? 'finalFieldType(#)' : 'fieldType(#)', args); | 2961 return _callHelper(isFinal ? 'finalFieldType(#)' : 'fieldType(#)', [args]); |
2962 } | 2962 } |
2963 | 2963 |
2964 JS.ArrayInitializer _emitTypeNames( | 2964 JS.ArrayInitializer _emitTypeNames( |
2965 List<DartType> types, List<FormalParameter> parameters, | 2965 List<DartType> types, List<FormalParameter> parameters, |
2966 {bool nameType: true, bool hoistType: true}) { | 2966 {bool nameType: true, bool hoistType: true}) { |
2967 var result = <JS.Expression>[]; | 2967 var result = <JS.Expression>[]; |
2968 for (int i = 0; i < types.length; ++i) { | 2968 for (int i = 0; i < types.length; ++i) { |
2969 var metadata = parameters != null | 2969 var metadata = parameters != null |
2970 ? _parameterMetadata(parameters[i]) | 2970 ? _parameterMetadata(parameters[i]) |
2971 : <Annotation>[]; | 2971 : <Annotation>[]; |
(...skipping 3165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6137 if (targetIdentifier.staticElement is! PrefixElement) return false; | 6137 if (targetIdentifier.staticElement is! PrefixElement) return false; |
6138 var prefix = targetIdentifier.staticElement as PrefixElement; | 6138 var prefix = targetIdentifier.staticElement as PrefixElement; |
6139 | 6139 |
6140 // The library the prefix is referring to must come from a deferred import. | 6140 // The library the prefix is referring to must come from a deferred import. |
6141 var containingLibrary = resolutionMap | 6141 var containingLibrary = resolutionMap |
6142 .elementDeclaredByCompilationUnit(target.root as CompilationUnit) | 6142 .elementDeclaredByCompilationUnit(target.root as CompilationUnit) |
6143 .library; | 6143 .library; |
6144 var imports = containingLibrary.getImportsWithPrefix(prefix); | 6144 var imports = containingLibrary.getImportsWithPrefix(prefix); |
6145 return imports.length == 1 && imports[0].isDeferred; | 6145 return imports.length == 1 && imports[0].isDeferred; |
6146 } | 6146 } |
OLD | NEW |