| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 library elements; | 5 library elements; |
| 6 | 6 |
| 7 | 7 |
| 8 import '../tree/tree.dart'; | 8 import '../tree/tree.dart'; |
| 9 import '../util/util.dart'; | 9 import '../util/util.dart'; |
| 10 import '../resolution/resolution.dart'; | 10 import '../resolution/resolution.dart'; |
| (...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 Compiler compiler) { | 559 Compiler compiler) { |
| 560 return element == compiler.filledListConstructor | 560 return element == compiler.filledListConstructor |
| 561 && node.isCall | 561 && node.isCall |
| 562 && !node.arguments.isEmpty | 562 && !node.arguments.isEmpty |
| 563 && !node.arguments.tail.isEmpty | 563 && !node.arguments.tail.isEmpty |
| 564 && node.arguments.tail.tail.isEmpty; | 564 && node.arguments.tail.tail.isEmpty; |
| 565 } | 565 } |
| 566 | 566 |
| 567 static bool isConstructorOfTypedArraySubclass(Element element, | 567 static bool isConstructorOfTypedArraySubclass(Element element, |
| 568 Compiler compiler) { | 568 Compiler compiler) { |
| 569 if (compiler.typedDataLibrary == null) return false; | 569 if (compiler.typedDataClass == null) return false; |
| 570 if (!element.isConstructor()) return false; | 570 ClassElement cls = element.getEnclosingClass(); |
| 571 FunctionElement constructor = element; | 571 if (cls == null || !element.isConstructor()) return false; |
| 572 constructor = constructor.redirectionTarget; | 572 return compiler.world.isSubclass(compiler.typedDataClass, cls) |
| 573 ClassElement cls = constructor.getEnclosingClass(); | 573 && cls.getLibrary() == compiler.typedDataLibrary |
| 574 return cls.getLibrary() == compiler.typedDataLibrary | 574 && element.name == ''; |
| 575 && cls.isNative() | |
| 576 && compiler.world.isSubtype(compiler.typedDataClass, cls) | |
| 577 && compiler.world.isSubtype(compiler.listClass, cls) | |
| 578 && constructor.name == ''; | |
| 579 } | 575 } |
| 580 | 576 |
| 581 static bool switchStatementHasContinue(SwitchStatement node, | 577 static bool switchStatementHasContinue(SwitchStatement node, |
| 582 TreeElements elements) { | 578 TreeElements elements) { |
| 583 for (SwitchCase switchCase in node.cases) { | 579 for (SwitchCase switchCase in node.cases) { |
| 584 for (Node labelOrCase in switchCase.labelsAndCases) { | 580 for (Node labelOrCase in switchCase.labelsAndCases) { |
| 585 Node label = labelOrCase.asLabel(); | 581 Node label = labelOrCase.asLabel(); |
| 586 if (label != null) { | 582 if (label != null) { |
| 587 LabelElement labelElement = elements[label]; | 583 LabelElement labelElement = elements[label]; |
| 588 if (labelElement != null && labelElement.isContinueTarget) { | 584 if (labelElement != null && labelElement.isContinueTarget) { |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1007 Token get endToken; | 1003 Token get endToken; |
| 1008 | 1004 |
| 1009 // TODO(kasperl): Try to get rid of these. | 1005 // TODO(kasperl): Try to get rid of these. |
| 1010 void set annotatedElement(Element value); | 1006 void set annotatedElement(Element value); |
| 1011 void set resolutionState(int value); | 1007 void set resolutionState(int value); |
| 1012 | 1008 |
| 1013 MetadataAnnotation ensureResolved(Compiler compiler); | 1009 MetadataAnnotation ensureResolved(Compiler compiler); |
| 1014 } | 1010 } |
| 1015 | 1011 |
| 1016 abstract class VoidElement extends Element {} | 1012 abstract class VoidElement extends Element {} |
| OLD | NEW |