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

Unified Diff: pkg/analyzer/lib/src/summary/summarize_ast.dart

Issue 1859493002: Replace 'length' with more generic 'extractProperty' operation. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: pkg/analyzer/lib/src/summary/summarize_ast.dart
diff --git a/pkg/analyzer/lib/src/summary/summarize_ast.dart b/pkg/analyzer/lib/src/summary/summarize_ast.dart
index 715267bde9d6f8e81af3d2ab7f2b08175efb27c4..c544336a8ee028e26eaa4eb1f65fe2984104a5a9 100644
--- a/pkg/analyzer/lib/src/summary/summarize_ast.dart
+++ b/pkg/analyzer/lib/src/summary/summarize_ast.dart
@@ -89,15 +89,16 @@ class _ConstExprSerializer extends AbstractConstExprSerializer {
}
@override
- EntityRefBuilder serializePropertyAccess(PropertyAccess access) {
- Expression target = access.target;
- if (target is Identifier) {
- EntityRefBuilder targetRef = serializeIdentifier(target);
- return new EntityRefBuilder(reference: visitor.serializeReference(
- targetRef.reference, access.propertyName.name));
+ EntityRefBuilder serializeIdentifierSequence(Expression expr) {
+ if (expr is Identifier) {
+ return serializeIdentifier(expr);
+ }
+ if (expr is PropertyAccess) {
+ int targetId = serializeIdentifierSequence(expr.target).reference;
+ int nameId = visitor.serializeReference(targetId, expr.propertyName.name);
+ return new EntityRefBuilder(reference: nameId);
} else {
- // TODO(scheglov) should we handle other targets in malformed constants?
- throw new StateError('Unexpected target type: ${target.runtimeType}');
+ throw new StateError('Unexpected node type: ${expr.runtimeType}');
}
}
@@ -824,7 +825,8 @@ class _SummarizeAstVisitor extends RecursiveAstVisitor {
b.annotations = serializeAnnotations(annotations);
b.codeRange = serializeCodeRange(variables.parent);
if (variable.isConst ||
- variable.isFinal && isField && !isDeclaredStatic) {
+ variable.isFinal && isField && !isDeclaredStatic ||
+ variables.type == null) {
Expression initializer = variable.initializer;
if (initializer != null) {
b.constExpr = serializeConstExpr(initializer);

Powered by Google App Engine
This is Rietveld 408576698