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

Unified Diff: pkg/compiler/lib/src/serialization/serialization.dart

Issue 2691213005: Use identical in token operators. (Closed)
Patch Set: Ensure operator names are canonicalized by deserializer. Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/front_end/lib/src/fasta/scanner/precedence.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/serialization/serialization.dart
diff --git a/pkg/compiler/lib/src/serialization/serialization.dart b/pkg/compiler/lib/src/serialization/serialization.dart
index 9bbfb8ddd91b217e30a4e35b18c47ebb1360b058..bdbc238a5f618f951deccf1736ec271472f38e30 100644
--- a/pkg/compiler/lib/src/serialization/serialization.dart
+++ b/pkg/compiler/lib/src/serialization/serialization.dart
@@ -4,6 +4,9 @@
library dart2js.serialization;
+import 'package:front_end/src/fasta/scanner/precedence.dart' show
+ PrecedenceInfo;
+
import '../common.dart';
import '../common/resolution.dart';
import '../constants/expressions.dart';
@@ -20,6 +23,16 @@ import 'values.dart';
export 'task.dart' show LibraryDeserializer;
+final Map<String, String> canonicalNames = computeCanonicalNames();
+
+Map<String, String> computeCanonicalNames() {
+ Map<String, String> result = <String, String>{};
+ for (PrecedenceInfo info in PrecedenceInfo.all) {
+ result[info.value] = info.value;
+ }
+ return result;
+}
+
/// An object that supports the encoding an [ObjectValue] for serialization.
///
/// The [ObjectEncoder] ensures that nominality and circularities of
@@ -471,7 +484,7 @@ abstract class AbstractDecoder<K> {
}
throw new StateError("String value '$key' not found in $_map.");
}
- return value;
+ return canonicalNames[value] ?? value;
}
/// Returns the list of [String] values associated with [key] in the decoded
« no previous file with comments | « no previous file | pkg/front_end/lib/src/fasta/scanner/precedence.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698