| 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 3872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3883 ctor = new JS.PropertyAccess(ctor, _propertyName(name.name)); | 3883 ctor = new JS.PropertyAccess(ctor, _propertyName(name.name)); |
| 3884 } | 3884 } |
| 3885 } else { | 3885 } else { |
| 3886 ctor = _emitConstructorName(element, type, name); | 3886 ctor = _emitConstructorName(element, type, name); |
| 3887 isFactory = element.isFactory; | 3887 isFactory = element.isFactory; |
| 3888 var classElem = element.enclosingElement; | 3888 var classElem = element.enclosingElement; |
| 3889 isNative = _isJSNative(classElem); | 3889 isNative = _isJSNative(classElem); |
| 3890 } | 3890 } |
| 3891 var args = _visit(argumentList) as List<JS.Expression>; | 3891 var args = _visit(argumentList) as List<JS.Expression>; |
| 3892 // Native factory constructors are JS constructors - use new here. | 3892 // Native factory constructors are JS constructors - use new here. |
| 3893 return isFactory && !isNative ? new JS.Call(ctor, args) : new JS.New(ctor,
args); | 3893 return isFactory && !isNative |
| 3894 ? new JS.Call(ctor, args) |
| 3895 : new JS.New(ctor, args); |
| 3894 } | 3896 } |
| 3895 | 3897 |
| 3896 if (element != null && _isObjectLiteral(element.enclosingElement)) { | 3898 if (element != null && _isObjectLiteral(element.enclosingElement)) { |
| 3897 return _emitObjectLiteral(argumentList); | 3899 return _emitObjectLiteral(argumentList); |
| 3898 } | 3900 } |
| 3899 if (isConst) return _emitConst(emitNew); | 3901 if (isConst) return _emitConst(emitNew); |
| 3900 return emitNew(); | 3902 return emitNew(); |
| 3901 } | 3903 } |
| 3902 | 3904 |
| 3903 bool _isObjectLiteral(ClassElement classElem) { | 3905 bool _isObjectLiteral(ClassElement classElem) { |
| (...skipping 1590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5494 } | 5496 } |
| 5495 | 5497 |
| 5496 bool isLibraryPrefix(Expression node) => | 5498 bool isLibraryPrefix(Expression node) => |
| 5497 node is SimpleIdentifier && node.staticElement is PrefixElement; | 5499 node is SimpleIdentifier && node.staticElement is PrefixElement; |
| 5498 | 5500 |
| 5499 LibraryElement _getLibrary(AnalysisContext c, String uri) => | 5501 LibraryElement _getLibrary(AnalysisContext c, String uri) => |
| 5500 c.computeLibraryElement(c.sourceFactory.forUri(uri)); | 5502 c.computeLibraryElement(c.sourceFactory.forUri(uri)); |
| 5501 | 5503 |
| 5502 bool _isDartRuntime(LibraryElement l) => | 5504 bool _isDartRuntime(LibraryElement l) => |
| 5503 l.isInSdk && l.source.uri.toString() == 'dart:_runtime'; | 5505 l.isInSdk && l.source.uri.toString() == 'dart:_runtime'; |
| OLD | NEW |