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

Side by Side Diff: pkg/analyzer/lib/src/dart/element/element.dart

Issue 2815093002: Correctly recognize non-constant enum children (issue 29306) (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « no previous file | pkg/analyzer/test/src/dart/element/element_test.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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 analyzer.src.dart.element.element; 5 library analyzer.src.dart.element.element;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 import 'dart:math' show min; 8 import 'dart:math' show min;
9 9
10 import 'package:analyzer/dart/ast/ast.dart'; 10 import 'package:analyzer/dart/ast/ast.dart';
(...skipping 4218 matching lines...) Expand 10 before | Expand all | Expand 10 after
4229 4229
4230 /** 4230 /**
4231 * Set whether this field is explicitly marked as being covariant. 4231 * Set whether this field is explicitly marked as being covariant.
4232 */ 4232 */
4233 void set isCovariant(bool isCovariant) { 4233 void set isCovariant(bool isCovariant) {
4234 _assertNotResynthesized(_unlinkedVariable); 4234 _assertNotResynthesized(_unlinkedVariable);
4235 setModifier(Modifier.COVARIANT, isCovariant); 4235 setModifier(Modifier.COVARIANT, isCovariant);
4236 } 4236 }
4237 4237
4238 @override 4238 @override
4239 bool get isEnumConstant => 4239 bool get isEnumConstant => enclosingElement != null
4240 enclosingElement != null ? enclosingElement.isEnum : false; 4240 ? enclosingElement.isEnum && !isSynthetic
4241 : false;
scheglov 2017/04/12 16:00:01 I think this could be "enclosingElement != null &&
Brian Wilkerson 2017/04/12 16:43:01 Done
4241 4242
4242 @override 4243 @override
4243 bool get isStatic { 4244 bool get isStatic {
4244 if (_unlinkedVariable != null) { 4245 if (_unlinkedVariable != null) {
4245 return _unlinkedVariable.isStatic; 4246 return _unlinkedVariable.isStatic;
4246 } 4247 }
4247 return hasModifier(Modifier.STATIC); 4248 return hasModifier(Modifier.STATIC);
4248 } 4249 }
4249 4250
4250 /** 4251 /**
(...skipping 4854 matching lines...) Expand 10 before | Expand all | Expand 10 after
9105 9106
9106 @override 9107 @override
9107 void visitElement(Element element) { 9108 void visitElement(Element element) {
9108 int offset = element.nameOffset; 9109 int offset = element.nameOffset;
9109 if (offset != -1) { 9110 if (offset != -1) {
9110 map[offset] = element; 9111 map[offset] = element;
9111 } 9112 }
9112 super.visitElement(element); 9113 super.visitElement(element);
9113 } 9114 }
9114 } 9115 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/src/dart/element/element_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698