Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 1969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1980 */ | 1980 */ |
| 1981 ConstructorElement _redirectedConstructor; | 1981 ConstructorElement _redirectedConstructor; |
| 1982 | 1982 |
| 1983 /** | 1983 /** |
| 1984 * The initializers for this constructor (used for evaluating constant | 1984 * The initializers for this constructor (used for evaluating constant |
| 1985 * instance creation expressions). | 1985 * instance creation expressions). |
| 1986 */ | 1986 */ |
| 1987 List<ConstructorInitializer> _constantInitializers; | 1987 List<ConstructorInitializer> _constantInitializers; |
| 1988 | 1988 |
| 1989 /** | 1989 /** |
| 1990 * The initializers for fields (used for evaluating constant | |
| 1991 * instance creation expressions). | |
| 1992 */ | |
| 1993 List<VariableDeclaration> _fieldInitializers; | |
|
Paul Berry
2016/07/21 20:42:14
This shouldn't be necessary. We already store the
Jennifer Messerly
2016/07/28 22:28:05
Nice!!!! Reverted this file :)
| |
| 1994 | |
| 1995 /** | |
| 1996 * The initializers for default parameters (used for evaluating constant | |
| 1997 * instance creation expressions). | |
| 1998 */ | |
| 1999 List<DefaultFormalParameter> _parameterInitializers; | |
|
Paul Berry
2016/07/21 20:42:14
This shouldn't be necessary either. We already st
Jennifer Messerly
2016/07/28 22:28:05
Reverted :)
| |
| 2000 | |
| 2001 /** | |
| 1990 * The offset of the `.` before this constructor name or `null` if not named. | 2002 * The offset of the `.` before this constructor name or `null` if not named. |
| 1991 */ | 2003 */ |
| 1992 int _periodOffset; | 2004 int _periodOffset; |
| 1993 | 2005 |
| 1994 /** | 2006 /** |
| 1995 * Return the offset of the character immediately following the last character | 2007 * Return the offset of the character immediately following the last character |
| 1996 * of this constructor's name, or `null` if not named. | 2008 * of this constructor's name, or `null` if not named. |
| 1997 */ | 2009 */ |
| 1998 int _nameEnd; | 2010 int _nameEnd; |
| 1999 | 2011 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2037 } | 2049 } |
| 2038 return _constantInitializers; | 2050 return _constantInitializers; |
| 2039 } | 2051 } |
| 2040 | 2052 |
| 2041 void set constantInitializers( | 2053 void set constantInitializers( |
| 2042 List<ConstructorInitializer> constantInitializers) { | 2054 List<ConstructorInitializer> constantInitializers) { |
| 2043 assert(serializedExecutable == null); | 2055 assert(serializedExecutable == null); |
| 2044 _constantInitializers = constantInitializers; | 2056 _constantInitializers = constantInitializers; |
| 2045 } | 2057 } |
| 2046 | 2058 |
| 2059 List<VariableDeclaration> get fieldInitializers { | |
|
Paul Berry
2016/07/21 20:42:14
This hunk should be unnecessary too.
Jennifer Messerly
2016/07/28 22:28:05
yup!
| |
| 2060 if (serializedExecutable != null && _fieldInitializers == null) { | |
| 2061 _fieldInitializers ??= serializedExecutable.fieldInitializers | |
| 2062 .map((i) => _buildConstructorInitializer(i)) | |
| 2063 .toList(growable: false); | |
| 2064 } | |
| 2065 return _fieldInitializers; | |
| 2066 } | |
| 2067 | |
| 2068 void set fieldInitializers( | |
| 2069 List<VariableDeclaration> fieldInitializers) { | |
| 2070 assert(serializedExecutable == null); | |
| 2071 _fieldInitializers = fieldInitializers; | |
| 2072 } | |
| 2073 | |
| 2074 List<DefaultFormalParameter> get parameterInitializers { | |
| 2075 if (serializedExecutable != null && _parameterInitializers == null) { | |
| 2076 _parameterInitializers ??= serializedExecutable.parameterInitializers | |
| 2077 .map((i) => _buildConstructorInitializer(i)) | |
| 2078 .toList(growable: false); | |
| 2079 } | |
| 2080 return _parameterInitializers; | |
| 2081 } | |
| 2082 | |
| 2083 void set parameterInitializers( | |
| 2084 List<DefaultFormalParameter> parameterInitializers) { | |
| 2085 assert(serializedExecutable == null); | |
| 2086 _parameterInitializers = parameterInitializers; | |
| 2087 } | |
| 2088 | |
| 2047 @override | 2089 @override |
| 2048 ClassElementImpl get enclosingElement => | 2090 ClassElementImpl get enclosingElement => |
| 2049 super.enclosingElement as ClassElementImpl; | 2091 super.enclosingElement as ClassElementImpl; |
| 2050 | 2092 |
| 2051 @override | 2093 @override |
| 2052 TypeParameterizedElementMixin get enclosingTypeParameterContext => | 2094 TypeParameterizedElementMixin get enclosingTypeParameterContext => |
| 2053 super.enclosingElement as ClassElementImpl; | 2095 super.enclosingElement as ClassElementImpl; |
| 2054 | 2096 |
| 2055 /** | 2097 /** |
| 2056 * Set whether this constructor represents a factory method. | 2098 * Set whether this constructor represents a factory method. |
| (...skipping 6428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8485 | 8527 |
| 8486 @override | 8528 @override |
| 8487 void visitElement(Element element) { | 8529 void visitElement(Element element) { |
| 8488 int offset = element.nameOffset; | 8530 int offset = element.nameOffset; |
| 8489 if (offset != -1) { | 8531 if (offset != -1) { |
| 8490 map[offset] = element; | 8532 map[offset] = element; |
| 8491 } | 8533 } |
| 8492 super.visitElement(element); | 8534 super.visitElement(element); |
| 8493 } | 8535 } |
| 8494 } | 8536 } |
| OLD | NEW |