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

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

Issue 12039054: Issue 8059. Disallow mixing in classes that use 'super' from any member. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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.collect.Lists; 7 import com.google.common.collect.Lists;
8 import com.google.dart.compiler.ast.ASTNodes;
8 import com.google.dart.compiler.ast.DartClass; 9 import com.google.dart.compiler.ast.DartClass;
9 import com.google.dart.compiler.ast.DartClassTypeAlias; 10 import com.google.dart.compiler.ast.DartClassTypeAlias;
10 import com.google.dart.compiler.ast.DartDeclaration; 11 import com.google.dart.compiler.ast.DartDeclaration;
11 import com.google.dart.compiler.ast.DartIdentifier; 12 import com.google.dart.compiler.ast.DartIdentifier;
12 import com.google.dart.compiler.ast.DartObsoleteMetadata; 13 import com.google.dart.compiler.ast.DartObsoleteMetadata;
13 import com.google.dart.compiler.ast.DartStringLiteral; 14 import com.google.dart.compiler.ast.DartStringLiteral;
14 import com.google.dart.compiler.ast.DartTypeParameter; 15 import com.google.dart.compiler.ast.DartTypeParameter;
15 import com.google.dart.compiler.ast.Modifiers; 16 import com.google.dart.compiler.ast.Modifiers;
16 import com.google.dart.compiler.common.SourceInfo; 17 import com.google.dart.compiler.common.SourceInfo;
17 import com.google.dart.compiler.type.InterfaceType; 18 import com.google.dart.compiler.type.InterfaceType;
(...skipping 18 matching lines...) Expand all
36 private final String nativeName; 37 private final String nativeName;
37 private final DartObsoleteMetadata metadata; 38 private final DartObsoleteMetadata metadata;
38 private final Modifiers modifiers; 39 private final Modifiers modifiers;
39 private final AtomicReference<List<InterfaceType>> allSupertypes = 40 private final AtomicReference<List<InterfaceType>> allSupertypes =
40 new AtomicReference<List<InterfaceType>>(); 41 new AtomicReference<List<InterfaceType>>();
41 private final SourceInfo nameLocation; 42 private final SourceInfo nameLocation;
42 private final String declarationNameWithTypeParameter; 43 private final String declarationNameWithTypeParameter;
43 private List<Element> unimplementedMembers; 44 private List<Element> unimplementedMembers;
44 private final int openBraceOffset; 45 private final int openBraceOffset;
45 private final int closeBraceOffset; 46 private final int closeBraceOffset;
47 private final boolean hasSuperInvocation;
46 48
47 // declared volatile for thread-safety 49 // declared volatile for thread-safety
48 @SuppressWarnings("unused") 50 @SuppressWarnings("unused")
49 private volatile Set<InterfaceType> subtypes; 51 private volatile Set<InterfaceType> subtypes;
50 52
51 private final List<ConstructorNodeElement> constructors = Lists.newArrayList() ; 53 private final List<ConstructorNodeElement> constructors = Lists.newArrayList() ;
52 private final ElementMap members = new ElementMap(); 54 private final ElementMap members = new ElementMap();
53 55
54 private final LibraryElement library; 56 private final LibraryElement library;
55 57
(...skipping 10 matching lines...) Expand all
66 this.nativeName = nativeName; 68 this.nativeName = nativeName;
67 this.library = library; 69 this.library = library;
68 if (node != null) { 70 if (node != null) {
69 isInterface = node.isInterface(); 71 isInterface = node.isInterface();
70 metadata = node.getObsoleteMetadata(); 72 metadata = node.getObsoleteMetadata();
71 modifiers = node.getModifiers(); 73 modifiers = node.getModifiers();
72 nameLocation = node.getName().getSourceInfo(); 74 nameLocation = node.getName().getSourceInfo();
73 declarationNameWithTypeParameter = createDeclarationName(node.getName(), n ode.getTypeParameters()); 75 declarationNameWithTypeParameter = createDeclarationName(node.getName(), n ode.getTypeParameters());
74 openBraceOffset = node.getOpenBraceOffset(); 76 openBraceOffset = node.getOpenBraceOffset();
75 closeBraceOffset = node.getCloseBraceOffset(); 77 closeBraceOffset = node.getCloseBraceOffset();
78 hasSuperInvocation = ASTNodes.hasSuperInvocation(node);
76 } else { 79 } else {
77 isInterface = false; 80 isInterface = false;
78 metadata = DartObsoleteMetadata.EMPTY; 81 metadata = DartObsoleteMetadata.EMPTY;
79 modifiers = Modifiers.NONE; 82 modifiers = Modifiers.NONE;
80 nameLocation = SourceInfo.UNKNOWN; 83 nameLocation = SourceInfo.UNKNOWN;
81 declarationNameWithTypeParameter = ""; 84 declarationNameWithTypeParameter = "";
82 openBraceOffset = -1; 85 openBraceOffset = -1;
83 closeBraceOffset = -1; 86 closeBraceOffset = -1;
87 hasSuperInvocation = false;
84 } 88 }
85 } 89 }
86 90
87 ClassElementImplementation(DartClassTypeAlias node, String name, 91 ClassElementImplementation(DartClassTypeAlias node, String name,
88 LibraryElement library) { 92 LibraryElement library) {
89 super(node, name); 93 super(node, name);
90 this.nativeName = null; 94 this.nativeName = null;
91 this.library = library; 95 this.library = library;
92 if (node != null) { 96 if (node != null) {
93 isInterface = false; 97 isInterface = false;
94 metadata = node.getObsoleteMetadata(); 98 metadata = node.getObsoleteMetadata();
95 modifiers = node.getModifiers(); 99 modifiers = node.getModifiers();
96 nameLocation = node.getName().getSourceInfo(); 100 nameLocation = node.getName().getSourceInfo();
97 declarationNameWithTypeParameter = createDeclarationName(node.getName(), n ode.getTypeParameters()); 101 declarationNameWithTypeParameter = createDeclarationName(node.getName(), n ode.getTypeParameters());
98 openBraceOffset = -1; 102 openBraceOffset = -1;
99 closeBraceOffset = -1; 103 closeBraceOffset = -1;
104 hasSuperInvocation = false;
100 } else { 105 } else {
101 isInterface = false; 106 isInterface = false;
102 metadata = DartObsoleteMetadata.EMPTY; 107 metadata = DartObsoleteMetadata.EMPTY;
103 modifiers = Modifiers.NONE; 108 modifiers = Modifiers.NONE;
104 nameLocation = SourceInfo.UNKNOWN; 109 nameLocation = SourceInfo.UNKNOWN;
105 declarationNameWithTypeParameter = ""; 110 declarationNameWithTypeParameter = "";
106 openBraceOffset = -1; 111 openBraceOffset = -1;
107 closeBraceOffset = -1; 112 closeBraceOffset = -1;
113 hasSuperInvocation = false;
108 } 114 }
109 } 115 }
110 116
111 @Override 117 @Override
112 public DartDeclaration<?> getNode() { 118 public DartDeclaration<?> getNode() {
113 return (DartClass) super.getNode(); 119 return (DartClass) super.getNode();
114 } 120 }
115 121
116 @Override 122 @Override
117 public SourceInfo getNameLocation() { 123 public SourceInfo getNameLocation() {
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 448
443 @Override 449 @Override
444 public int getOpenBraceOffset() { 450 public int getOpenBraceOffset() {
445 return openBraceOffset; 451 return openBraceOffset;
446 } 452 }
447 453
448 @Override 454 @Override
449 public int getCloseBraceOffset() { 455 public int getCloseBraceOffset() {
450 return closeBraceOffset; 456 return closeBraceOffset;
451 } 457 }
458
459 @Override
460 public boolean hasSuperInvocation() {
461 return hasSuperInvocation;
462 }
452 } 463 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698