| 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 'dart:collection' show HashMap, HashSet; | 5 import 'dart:collection' show HashMap, HashSet; |
| 6 import 'dart:math' show min, max; | 6 import 'dart:math' show min, max; |
| 7 | 7 |
| 8 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator; | 8 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator; |
| 9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
| 10 import 'package:analyzer/dart/ast/token.dart' show Token, TokenType; | 10 import 'package:analyzer/dart/ast/token.dart' show Token, TokenType; |
| (...skipping 2327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2338 } | 2338 } |
| 2339 | 2339 |
| 2340 return _emitTopLevelName(element); | 2340 return _emitTopLevelName(element); |
| 2341 } | 2341 } |
| 2342 | 2342 |
| 2343 JS.PropertyAccess _emitTopLevelName(Element e, {String suffix: ''}) { | 2343 JS.PropertyAccess _emitTopLevelName(Element e, {String suffix: ''}) { |
| 2344 if (e is TopLevelVariableElement && | 2344 if (e is TopLevelVariableElement && |
| 2345 e.getter != null && | 2345 e.getter != null && |
| 2346 findAnnotation(e.getter, isPublicJSAnnotation) != null) { | 2346 findAnnotation(e.getter, isPublicJSAnnotation) != null) { |
| 2347 var annotationName = getAnnotationName(e.getter, isPublicJSAnnotation); | 2347 var annotationName = getAnnotationName(e.getter, isPublicJSAnnotation); |
| 2348 var name = js.string(annotationName ?? e.name); | 2348 var name = annotationName ?? e.name; |
| 2349 return new JS.PropertyAccess(_self, name); | 2349 JS.PropertyAccess result = null; |
| 2350 for (var segment in name.split('.')) { |
| 2351 result = new JS.PropertyAccess(result ?? _self, js.string(segment)); |
| 2352 } |
| 2353 return result; |
| 2350 } | 2354 } |
| 2351 String name = getJSExportName(e) + suffix; | 2355 String name = getJSExportName(e) + suffix; |
| 2352 return new JS.PropertyAccess( | 2356 return new JS.PropertyAccess( |
| 2353 emitLibraryName(e.library), _propertyName(name)); | 2357 emitLibraryName(e.library), _propertyName(name)); |
| 2354 } | 2358 } |
| 2355 | 2359 |
| 2356 @override | 2360 @override |
| 2357 JS.Expression visitAssignmentExpression(AssignmentExpression node) { | 2361 JS.Expression visitAssignmentExpression(AssignmentExpression node) { |
| 2358 var left = node.leftHandSide; | 2362 var left = node.leftHandSide; |
| 2359 var right = node.rightHandSide; | 2363 var right = node.rightHandSide; |
| (...skipping 2129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4489 } | 4493 } |
| 4490 | 4494 |
| 4491 bool isLibraryPrefix(Expression node) => | 4495 bool isLibraryPrefix(Expression node) => |
| 4492 node is SimpleIdentifier && node.staticElement is PrefixElement; | 4496 node is SimpleIdentifier && node.staticElement is PrefixElement; |
| 4493 | 4497 |
| 4494 LibraryElement _getLibrary(AnalysisContext c, String uri) => | 4498 LibraryElement _getLibrary(AnalysisContext c, String uri) => |
| 4495 c.computeLibraryElement(c.sourceFactory.forUri(uri)); | 4499 c.computeLibraryElement(c.sourceFactory.forUri(uri)); |
| 4496 | 4500 |
| 4497 bool _isDartRuntime(LibraryElement l) => | 4501 bool _isDartRuntime(LibraryElement l) => |
| 4498 l.isInSdk && l.source.uri.toString() == 'dart:_runtime'; | 4502 l.isInSdk && l.source.uri.toString() == 'dart:_runtime'; |
| OLD | NEW |