Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(370)

Side by Side Diff: compiler/java/com/google/dart/compiler/resolver/Elements.java

Issue 10983089: Issue 3968. Report error if cycle in redirecting factory constructors (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 package com.google.dart.compiler.resolver; 5 package com.google.dart.compiler.resolver;
6 6
7 import com.google.common.annotations.VisibleForTesting; 7 import com.google.common.annotations.VisibleForTesting;
8 import com.google.common.base.Objects; 8 import com.google.common.base.Objects;
9 import com.google.common.collect.Lists; 9 import com.google.common.collect.Lists;
10 import com.google.dart.compiler.DartSource; 10 import com.google.dart.compiler.DartSource;
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 } 673 }
674 674
675 /** 675 /**
676 * @return <code>true</code> if the given {@link ConstructorElement} is a defa ult constructor. 676 * @return <code>true</code> if the given {@link ConstructorElement} is a defa ult constructor.
677 */ 677 */
678 public static boolean isDefaultConstructor(ConstructorElement element) { 678 public static boolean isDefaultConstructor(ConstructorElement element) {
679 return element != null 679 return element != null
680 && element.getParameters().isEmpty() 680 && element.getParameters().isEmpty()
681 && getRawMethodName(element).equals(element.getEnclosingElement().getNam e()); 681 && getRawMethodName(element).equals(element.getEnclosingElement().getNam e());
682 } 682 }
683
684 public static void setRedirectingFactoryConstructor(ConstructorElement source,
685 ConstructorElement target) {
686 ((ConstructorElementImplementation) source).setRedirectingFactoryConstructor (target);
687 }
683 688
684 /** 689 /**
685 * @return the name of given {@link DartNode} if it is {@link DartIdentifier}, or 690 * @return the name of given {@link DartNode} if it is {@link DartIdentifier}, or
686 * <code>null</code> otherwise. 691 * <code>null</code> otherwise.
687 */ 692 */
688 private static String getIdentifierName(DartNode identifier) { 693 private static String getIdentifierName(DartNode identifier) {
689 if (identifier != null && identifier instanceof DartIdentifier) { 694 if (identifier != null && identifier instanceof DartIdentifier) {
690 return ((DartIdentifier) identifier).getName(); 695 return ((DartIdentifier) identifier).getName();
691 } 696 }
692 return null; 697 return null;
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 return false; 816 return false;
812 } 817 }
813 Source source = member.getElement().getSourceInfo().getSource(); 818 Source source = member.getElement().getSourceInfo().getSource();
814 return !isCoreLibrarySource(source); 819 return !isCoreLibrarySource(source);
815 } 820 }
816 821
817 public static DuplicateElement createDuplicateElement(Element oldElement, Elem ent newElement) { 822 public static DuplicateElement createDuplicateElement(Element oldElement, Elem ent newElement) {
818 return new DuplicateElementImplementation(oldElement, newElement); 823 return new DuplicateElementImplementation(oldElement, newElement);
819 } 824 }
820 } 825 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698