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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 } | 357 } |
358 | 358 |
359 JS.ObjectInitializer _librariesDebuggerObject() { | 359 JS.ObjectInitializer _librariesDebuggerObject() { |
360 var properties = <JS.Property>[]; | 360 var properties = <JS.Property>[]; |
361 _libraries.forEach((library, value) { | 361 _libraries.forEach((library, value) { |
362 // TODO(jacobr): we could specify a short library name instead of the | 362 // TODO(jacobr): we could specify a short library name instead of the |
363 // full library uri if we wanted to save space. | 363 // full library uri if we wanted to save space. |
364 properties.add(new JS.Property( | 364 properties.add(new JS.Property( |
365 js.string(jsLibraryDebuggerName(_libraryRoot, library)), value)); | 365 js.string(jsLibraryDebuggerName(_libraryRoot, library)), value)); |
366 }); | 366 }); |
367 return new JS.ObjectInitializer(properties); | 367 return new JS.ObjectInitializer(properties, multiline: true); |
368 } | 368 } |
369 | 369 |
370 List<String> _getJSName(Element e) { | 370 List<String> _getJSName(Element e) { |
371 if (e.library == null || | 371 if (e.library == null || |
372 findAnnotation(e.library, isPublicJSAnnotation) == null) { | 372 findAnnotation(e.library, isPublicJSAnnotation) == null) { |
373 return null; | 373 return null; |
374 } | 374 } |
375 | 375 |
376 var libraryJSName = getAnnotationName(e.library, isPublicJSAnnotation); | 376 var libraryJSName = getAnnotationName(e.library, isPublicJSAnnotation); |
377 var libraryPrefix = <String>[]; | 377 var libraryPrefix = <String>[]; |
(...skipping 5657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6035 if (targetIdentifier.staticElement is! PrefixElement) return false; | 6035 if (targetIdentifier.staticElement is! PrefixElement) return false; |
6036 var prefix = targetIdentifier.staticElement as PrefixElement; | 6036 var prefix = targetIdentifier.staticElement as PrefixElement; |
6037 | 6037 |
6038 // The library the prefix is referring to must come from a deferred import. | 6038 // The library the prefix is referring to must come from a deferred import. |
6039 var containingLibrary = resolutionMap | 6039 var containingLibrary = resolutionMap |
6040 .elementDeclaredByCompilationUnit(target.root as CompilationUnit) | 6040 .elementDeclaredByCompilationUnit(target.root as CompilationUnit) |
6041 .library; | 6041 .library; |
6042 var imports = containingLibrary.getImportsWithPrefix(prefix); | 6042 var imports = containingLibrary.getImportsWithPrefix(prefix); |
6043 return imports.length == 1 && imports[0].isDeferred; | 6043 return imports.length == 1 && imports[0].isDeferred; |
6044 } | 6044 } |
OLD | NEW |