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

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

Issue 1679493002: Serialize initializers for final fields. (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 766 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 UnlinkedVariableBuilder b = new UnlinkedVariableBuilder(); 777 UnlinkedVariableBuilder b = new UnlinkedVariableBuilder();
778 b.name = variable.name; 778 b.name = variable.name;
779 b.nameOffset = variable.nameOffset; 779 b.nameOffset = variable.nameOffset;
780 if (!variable.hasImplicitType) { 780 if (!variable.hasImplicitType) {
781 b.type = serializeTypeRef(variable.type, variable); 781 b.type = serializeTypeRef(variable.type, variable);
782 } 782 }
783 b.isStatic = variable.isStatic && variable.enclosingElement is ClassElement; 783 b.isStatic = variable.isStatic && variable.enclosingElement is ClassElement;
784 b.isFinal = variable.isFinal; 784 b.isFinal = variable.isFinal;
785 b.isConst = variable.isConst; 785 b.isConst = variable.isConst;
786 b.documentationComment = serializeDocumentation(variable); 786 b.documentationComment = serializeDocumentation(variable);
787 if (variable.isConst && variable is ConstVariableElement) { 787 if (variable is ConstVariableElement) {
788 ConstVariableElement constVariable = variable as ConstVariableElement; 788 ConstVariableElement constVariable = variable as ConstVariableElement;
789 Expression initializer = constVariable.constantInitializer; 789 Expression initializer = constVariable.constantInitializer;
790 if (initializer != null) { 790 if (initializer != null) {
791 b.constExpr = serializeConstExpr(initializer); 791 b.constExpr = serializeConstExpr(initializer);
792 } 792 }
793 } 793 }
794 if (b.isFinal || b.isConst) { 794 if (b.isFinal || b.isConst) {
795 b.propagatedTypeSlot = storeLinkedType(variable.propagatedType, variable); 795 b.propagatedTypeSlot = storeLinkedType(variable.propagatedType, variable);
796 } else { 796 } else {
797 // Variable is not propagable. 797 // Variable is not propagable.
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
1164 exportNames.add(new LinkedExportNameBuilder( 1164 exportNames.add(new LinkedExportNameBuilder(
1165 name: name, 1165 name: name,
1166 dependency: serializeDependency(dependentLibrary), 1166 dependency: serializeDependency(dependentLibrary),
1167 unit: unit, 1167 unit: unit,
1168 kind: kind)); 1168 kind: kind));
1169 } 1169 }
1170 pb.exportNames = exportNames; 1170 pb.exportNames = exportNames;
1171 return pb; 1171 return pb;
1172 } 1172 }
1173 } 1173 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/summary/summarize_ast.dart ('k') | pkg/analyzer/test/src/summary/summary_common.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698