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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/elements/modelx.dart

Issue 23948006: Emit a compile-time error on members with the name of their enclosing class. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: dart2dart test expectations. Created 7 years, 3 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
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/warnings.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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.modelx; 5 library elements.modelx;
6 6
7 import 'dart:collection' show LinkedHashMap; 7 import 'dart:collection' show LinkedHashMap;
8 8
9 import 'elements.dart'; 9 import 'elements.dart';
10 import '../../compiler.dart' as api; 10 import '../../compiler.dart' as api;
(...skipping 1946 matching lines...) Expand 10 before | Expand all | Expand 10 after
1957 bool get isPatched => patch != null; 1957 bool get isPatched => patch != null;
1958 bool get isPatch => origin != null; 1958 bool get isPatch => origin != null;
1959 bool get hasLocalScopeMembers => !localScope.isEmpty; 1959 bool get hasLocalScopeMembers => !localScope.isEmpty;
1960 1960
1961 void addMember(Element element, DiagnosticListener listener) { 1961 void addMember(Element element, DiagnosticListener listener) {
1962 localMembers = localMembers.prepend(element); 1962 localMembers = localMembers.prepend(element);
1963 addToScope(element, listener); 1963 addToScope(element, listener);
1964 } 1964 }
1965 1965
1966 void addToScope(Element element, DiagnosticListener listener) { 1966 void addToScope(Element element, DiagnosticListener listener) {
1967 if (element.name == name) {
1968 listener.reportError(element, MessageKind.MEMBER_USES_CLASS_NAME);
1969 }
1967 localScope.add(element, listener); 1970 localScope.add(element, listener);
1968 } 1971 }
1969 1972
1970 Element localLookup(SourceString elementName) { 1973 Element localLookup(SourceString elementName) {
1971 Element result = localScope.lookup(elementName); 1974 Element result = localScope.lookup(elementName);
1972 if (result == null && isPatch) { 1975 if (result == null && isPatch) {
1973 result = origin.localLookup(elementName); 1976 result = origin.localLookup(elementName);
1974 } 1977 }
1975 return result; 1978 return result;
1976 } 1979 }
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
2219 2222
2220 MetadataAnnotation ensureResolved(Compiler compiler) { 2223 MetadataAnnotation ensureResolved(Compiler compiler) {
2221 if (resolutionState == STATE_NOT_STARTED) { 2224 if (resolutionState == STATE_NOT_STARTED) {
2222 compiler.resolver.resolveMetadataAnnotation(this); 2225 compiler.resolver.resolveMetadataAnnotation(this);
2223 } 2226 }
2224 return this; 2227 return this;
2225 } 2228 }
2226 2229
2227 String toString() => 'MetadataAnnotation($value, $resolutionState)'; 2230 String toString() => 'MetadataAnnotation($value, $resolutionState)';
2228 } 2231 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/warnings.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698