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

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

Issue 2015963002: Resynthesize ParameterElementImpl.parameterKind lazily. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 6 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/lib/src/summary/resynthesize.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 5760 matching lines...) Expand 10 before | Expand all | Expand 10 after
5771 /** 5771 /**
5772 * A list containing all of the type parameters defined for this parameter 5772 * A list containing all of the type parameters defined for this parameter
5773 * element. There will only be parameters if this parameter is a function 5773 * element. There will only be parameters if this parameter is a function
5774 * typed parameter. 5774 * typed parameter.
5775 */ 5775 */
5776 List<TypeParameterElement> _typeParameters = TypeParameterElement.EMPTY_LIST; 5776 List<TypeParameterElement> _typeParameters = TypeParameterElement.EMPTY_LIST;
5777 5777
5778 /** 5778 /**
5779 * The kind of this parameter. 5779 * The kind of this parameter.
5780 */ 5780 */
5781 ParameterKind parameterKind; 5781 ParameterKind _parameterKind;
5782 5782
5783 /** 5783 /**
5784 * The Dart code of the default value. 5784 * The Dart code of the default value.
5785 */ 5785 */
5786 String _defaultValueCode; 5786 String _defaultValueCode;
5787 5787
5788 /** 5788 /**
5789 * The offset to the beginning of the visible range for this element. 5789 * The offset to the beginning of the visible range for this element.
5790 */ 5790 */
5791 int _visibleRangeOffset = 0; 5791 int _visibleRangeOffset = 0;
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
5941 if (_unlinkedParam != null) { 5941 if (_unlinkedParam != null) {
5942 if (isSynthetic) { 5942 if (isSynthetic) {
5943 return -1; 5943 return -1;
5944 } 5944 }
5945 return _unlinkedParam.nameOffset; 5945 return _unlinkedParam.nameOffset;
5946 } 5946 }
5947 return super.nameOffset; 5947 return super.nameOffset;
5948 } 5948 }
5949 5949
5950 @override 5950 @override
5951 ParameterKind get parameterKind {
5952 if (_unlinkedParam != null && _parameterKind == null) {
5953 switch (_unlinkedParam.kind) {
5954 case UnlinkedParamKind.named:
5955 _parameterKind = ParameterKind.NAMED;
5956 break;
5957 case UnlinkedParamKind.positional:
5958 _parameterKind = ParameterKind.POSITIONAL;
5959 break;
5960 case UnlinkedParamKind.required:
5961 _parameterKind = ParameterKind.REQUIRED;
5962 break;
5963 }
5964 }
5965 return _parameterKind;
5966 }
5967
5968 void set parameterKind(ParameterKind parameterKind) {
5969 assert(_unlinkedParam == null);
5970 _parameterKind = parameterKind;
5971 }
5972
5973 @override
5951 List<ParameterElement> get parameters => _parameters; 5974 List<ParameterElement> get parameters => _parameters;
5952 5975
5953 /** 5976 /**
5954 * Set the parameters defined by this executable element to the given 5977 * Set the parameters defined by this executable element to the given
5955 * [parameters]. 5978 * [parameters].
5956 */ 5979 */
5957 void set parameters(List<ParameterElement> parameters) { 5980 void set parameters(List<ParameterElement> parameters) {
5958 for (ParameterElement parameter in parameters) { 5981 for (ParameterElement parameter in parameters) {
5959 (parameter as ParameterElementImpl).enclosingElement = this; 5982 (parameter as ParameterElementImpl).enclosingElement = this;
5960 } 5983 }
(...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after
7054 7077
7055 @override 7078 @override
7056 void visitElement(Element element) { 7079 void visitElement(Element element) {
7057 int offset = element.nameOffset; 7080 int offset = element.nameOffset;
7058 if (offset != -1) { 7081 if (offset != -1) {
7059 map[offset] = element; 7082 map[offset] = element;
7060 } 7083 }
7061 super.visitElement(element); 7084 super.visitElement(element);
7062 } 7085 }
7063 } 7086 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/summary/resynthesize.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698