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

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

Issue 1621763002: Use the explicit string 'dynamic' to refer to dynamic in 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 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 4880e8e1a8fe5ae7c27ed6d0fb017259d0d77c07..2affb6a7a607e12a31907f9a5a1d9721c9215ca2 100644
--- a/pkg/analyzer/lib/src/summary/summarize_ast.dart
+++ b/pkg/analyzer/lib/src/summary/summarize_ast.dart
@@ -508,7 +508,6 @@ class _SummarizeAstVisitor extends SimpleAstVisitor {
int serializeReference(int prefixIndex, String name) => nameToReference
.putIfAbsent(prefixIndex, () => <String, int>{})
.putIfAbsent(name, () {
- assert(name != 'dynamic');
int index = unlinkedReferences.length;
unlinkedReferences.add(new UnlinkedReferenceBuilder(
prefixReference: prefixIndex, name: name));
@@ -523,7 +522,9 @@ class _SummarizeAstVisitor extends SimpleAstVisitor {
*/
EntityRefBuilder serializeTypeName(TypeName node, {bool allowVoid: false}) {
EntityRefBuilder b = new EntityRefBuilder();
- if (node != null) {
+ if (node == null) {
+ b.reference = serializeReference(null, 'dynamic');
+ } else {
Identifier identifier = node.name;
if (identifier is SimpleIdentifier) {
String name = identifier.name;
@@ -539,6 +540,7 @@ class _SummarizeAstVisitor extends SimpleAstVisitor {
// None of the other things that can be declared in local scopes
// are types, so this is an error and should be treated as a
// reference to `dynamic`.
+ b.reference = serializeReference(null, 'dynamic');
return b;
}
}
@@ -549,9 +551,7 @@ class _SummarizeAstVisitor extends SimpleAstVisitor {
if (allowVoid && name == 'void') {
return null;
}
- if (name != 'dynamic') {
- b.reference = serializeReference(null, name);
- }
+ b.reference = serializeReference(null, name);
} else if (identifier is PrefixedIdentifier) {
int prefixIndex = prefixIndices.putIfAbsent(identifier.prefix.name,
() => serializeReference(null, identifier.prefix.name));
« no previous file with comments | « pkg/analyzer/lib/src/summary/resynthesize.dart ('k') | pkg/analyzer/lib/src/summary/summarize_elements.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698