Chromium Code Reviews| 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 3093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3104 if (name != null) { | 3104 if (name != null) { |
| 3105 ctor = new JS.PropertyAccess(ctor, _propertyName(name.name)); | 3105 ctor = new JS.PropertyAccess(ctor, _propertyName(name.name)); |
| 3106 } | 3106 } |
| 3107 } else { | 3107 } else { |
| 3108 ctor = _emitConstructorName(element, type, name); | 3108 ctor = _emitConstructorName(element, type, name); |
| 3109 isFactory = element.isFactory; | 3109 isFactory = element.isFactory; |
| 3110 } | 3110 } |
| 3111 var args = _visit(argumentList) as List<JS.Expression>; | 3111 var args = _visit(argumentList) as List<JS.Expression>; |
| 3112 return isFactory ? new JS.Call(ctor, args) : new JS.New(ctor, args); | 3112 return isFactory ? new JS.Call(ctor, args) : new JS.New(ctor, args); |
| 3113 } | 3113 } |
| 3114 if (_isObjectLiteral(element.enclosingElement)) { | 3114 if (element != null && _isObjectLiteral(element.enclosingElement)) { |
|
Jacob
2016/05/25 16:38:04
this was crashing on some google3 code.
| |
| 3115 return _emitObjectLiteral(argumentList); | 3115 return _emitObjectLiteral(argumentList); |
| 3116 } | 3116 } |
| 3117 if (isConst) return _emitConst(emitNew); | 3117 if (isConst) return _emitConst(emitNew); |
| 3118 return emitNew(); | 3118 return emitNew(); |
| 3119 } | 3119 } |
| 3120 | 3120 |
| 3121 bool _isObjectLiteral(ClassElement classElem) { | 3121 bool _isObjectLiteral(ClassElement classElem) { |
| 3122 return findAnnotation(classElem, isPublicJSAnnotation) != null && | 3122 return findAnnotation(classElem, isPublicJSAnnotation) != null && |
| 3123 findAnnotation(classElem, isJSAnonymousAnnotation) != null; | 3123 findAnnotation(classElem, isJSAnonymousAnnotation) != null; |
| 3124 } | 3124 } |
| (...skipping 1433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4558 } | 4558 } |
| 4559 | 4559 |
| 4560 bool isLibraryPrefix(Expression node) => | 4560 bool isLibraryPrefix(Expression node) => |
| 4561 node is SimpleIdentifier && node.staticElement is PrefixElement; | 4561 node is SimpleIdentifier && node.staticElement is PrefixElement; |
| 4562 | 4562 |
| 4563 LibraryElement _getLibrary(AnalysisContext c, String uri) => | 4563 LibraryElement _getLibrary(AnalysisContext c, String uri) => |
| 4564 c.computeLibraryElement(c.sourceFactory.forUri(uri)); | 4564 c.computeLibraryElement(c.sourceFactory.forUri(uri)); |
| 4565 | 4565 |
| 4566 bool _isDartRuntime(LibraryElement l) => | 4566 bool _isDartRuntime(LibraryElement l) => |
| 4567 l.isInSdk && l.source.uri.toString() == 'dart:_runtime'; | 4567 l.isInSdk && l.source.uri.toString() == 'dart:_runtime'; |
| OLD | NEW |