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

Side by Side Diff: pkg/analyzer/lib/src/summary/summarize_elements.dart

Issue 1675393002: Fix summarization of unqualified references to class members. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 serialization.elements; 5 library serialization.elements;
6 6
7 import 'package:analyzer/dart/element/element.dart'; 7 import 'package:analyzer/dart/element/element.dart';
8 import 'package:analyzer/dart/element/type.dart'; 8 import 'package:analyzer/dart/element/type.dart';
9 import 'package:analyzer/src/dart/element/element.dart'; 9 import 'package:analyzer/src/dart/element/element.dart';
10 import 'package:analyzer/src/dart/element/type.dart'; 10 import 'package:analyzer/src/dart/element/type.dart';
(...skipping 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after
1023 element is PropertyAccessorElement && 1023 element is PropertyAccessorElement &&
1024 !element.isStatic) { 1024 !element.isStatic) {
1025 if (element.name != 'length') { 1025 if (element.name != 'length') {
1026 throw new StateError('Only "length" property is allowed in constants.'); 1026 throw new StateError('Only "length" property is allowed in constants.');
1027 } 1027 }
1028 Element prefixElement = identifier.prefix.staticElement; 1028 Element prefixElement = identifier.prefix.staticElement;
1029 int prefixRef = serializer._getElementReferenceId(prefixElement); 1029 int prefixRef = serializer._getElementReferenceId(prefixElement);
1030 int lengthRef = serializer._getLengthPropertyReference(prefixRef); 1030 int lengthRef = serializer._getLengthPropertyReference(prefixRef);
1031 return new EntityRefBuilder(reference: lengthRef); 1031 return new EntityRefBuilder(reference: lengthRef);
1032 } 1032 }
1033 if (element is TypeParameterElement) {
1034 throw new StateError('Constants may not refer to type parameters.');
1035 }
1033 return new EntityRefBuilder( 1036 return new EntityRefBuilder(
1034 reference: serializer._getElementReferenceId(element)); 1037 reference: serializer._getElementReferenceId(element));
1035 } 1038 }
1036 1039
1037 @override 1040 @override
1038 EntityRefBuilder serializePropertyAccess(PropertyAccess access) { 1041 EntityRefBuilder serializePropertyAccess(PropertyAccess access) {
1039 Element element = access.propertyName.staticElement; 1042 Element element = access.propertyName.staticElement;
1040 assert(element != null); 1043 assert(element != null);
1041 // The only supported instance property accessor - `length`. 1044 // The only supported instance property accessor - `length`.
1042 Expression target = access.target; 1045 Expression target = access.target;
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
1243 exportNames.add(new LinkedExportNameBuilder( 1246 exportNames.add(new LinkedExportNameBuilder(
1244 name: name, 1247 name: name,
1245 dependency: serializeDependency(dependentLibrary), 1248 dependency: serializeDependency(dependentLibrary),
1246 unit: unit, 1249 unit: unit,
1247 kind: kind)); 1250 kind: kind));
1248 } 1251 }
1249 pb.exportNames = exportNames; 1252 pb.exportNames = exportNames;
1250 return pb; 1253 return pb;
1251 } 1254 }
1252 } 1255 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/summary/summarize_ast.dart ('k') | pkg/analyzer/test/src/summary/resynthesize_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698