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

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

Issue 1606113002: Enable most of the constant AST serialization for AST-based summaries. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 */ 58 */
59 class _ConstExprSerializer extends AbstractConstExprSerializer { 59 class _ConstExprSerializer extends AbstractConstExprSerializer {
60 final _LibrarySerializer serializer; 60 final _LibrarySerializer serializer;
61 61
62 _ConstExprSerializer(this.serializer); 62 _ConstExprSerializer(this.serializer);
63 63
64 UnlinkedTypeRefBuilder serializeIdentifier(Identifier identifier) { 64 UnlinkedTypeRefBuilder serializeIdentifier(Identifier identifier) {
65 Element element = identifier.staticElement; 65 Element element = identifier.staticElement;
66 assert(element != null); 66 assert(element != null);
67 // TODO(scheglov) how to serialize element references? 67 // TODO(scheglov) how to serialize element references?
68 operations.add(UnlinkedConstOperation.pushReference);
69 return new UnlinkedTypeRefBuilder( 68 return new UnlinkedTypeRefBuilder(
70 reference: serializer._getElementReferenceId(element)); 69 reference: serializer._getElementReferenceId(element));
71 } 70 }
72 71
73 @override 72 @override
74 UnlinkedTypeRefBuilder serializeType(TypeName typeName) { 73 UnlinkedTypeRefBuilder serializeType(TypeName typeName) {
75 DartType type = typeName != null ? typeName.type : DynamicTypeImpl.instance; 74 DartType type = typeName != null ? typeName.type : DynamicTypeImpl.instance;
76 return serializer.serializeTypeRef(type, null); 75 return serializer.serializeTypeRef(type, null);
77 } 76 }
78 } 77 }
(...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after
837 } else if (element is ClassElement) { 836 } else if (element is ClassElement) {
838 kind = ReferenceKind.classOrEnum; 837 kind = ReferenceKind.classOrEnum;
839 } else if (element is FunctionElement) { 838 } else if (element is FunctionElement) {
840 kind = ReferenceKind.topLevelFunction; 839 kind = ReferenceKind.topLevelFunction;
841 } else { 840 } else {
842 throw new Exception('Unexpected element kind: ${element.runtimeType}'); 841 throw new Exception('Unexpected element kind: ${element.runtimeType}');
843 } 842 }
844 return kind; 843 return kind;
845 } 844 }
846 } 845 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/summary/summarize_const_expr.dart ('k') | pkg/analyzer/test/src/summary/summary_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698