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

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

Issue 2696073003: Check for no constructors before iterating (issue 28703) (Closed)
Patch Set: revert to original Created 3 years, 10 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 | « pkg/analyzer/lib/src/dart/constant/evaluation.dart ('k') | no next file » | 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 1988 matching lines...) Expand 10 before | Expand all | Expand 10 after
1999 */ 1999 */
2000 ConstructorElementImpl.forNode(Identifier name) : super.forNode(name); 2000 ConstructorElementImpl.forNode(Identifier name) : super.forNode(name);
2001 2001
2002 /** 2002 /**
2003 * Initialize using the given serialized information. 2003 * Initialize using the given serialized information.
2004 */ 2004 */
2005 ConstructorElementImpl.forSerialized( 2005 ConstructorElementImpl.forSerialized(
2006 UnlinkedExecutable serializedExecutable, ClassElementImpl enclosingClass) 2006 UnlinkedExecutable serializedExecutable, ClassElementImpl enclosingClass)
2007 : super.forSerialized(serializedExecutable, enclosingClass); 2007 : super.forSerialized(serializedExecutable, enclosingClass);
2008 2008
2009 /**
2010 * Return the constant initializers for this element, which will be empty if
2011 * there are no initializers, or `null` if there was an error in the source.
2012 */
2009 List<ConstructorInitializer> get constantInitializers { 2013 List<ConstructorInitializer> get constantInitializers {
2010 if (serializedExecutable != null && _constantInitializers == null) { 2014 if (serializedExecutable != null && _constantInitializers == null) {
2011 _constantInitializers ??= serializedExecutable.constantInitializers 2015 _constantInitializers ??= serializedExecutable.constantInitializers
2012 .map((i) => _buildConstructorInitializer(i)) 2016 .map((i) => _buildConstructorInitializer(i))
2013 .toList(growable: false); 2017 .toList(growable: false);
2014 } 2018 }
2015 return _constantInitializers; 2019 return _constantInitializers;
2016 } 2020 }
2017 2021
2018 void set constantInitializers( 2022 void set constantInitializers(
(...skipping 6620 matching lines...) Expand 10 before | Expand all | Expand 10 after
8639 8643
8640 @override 8644 @override
8641 void visitElement(Element element) { 8645 void visitElement(Element element) {
8642 int offset = element.nameOffset; 8646 int offset = element.nameOffset;
8643 if (offset != -1) { 8647 if (offset != -1) {
8644 map[offset] = element; 8648 map[offset] = element;
8645 } 8649 }
8646 super.visitElement(element); 8650 super.visitElement(element);
8647 } 8651 }
8648 } 8652 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/dart/constant/evaluation.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698