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

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

Issue 1636113002: Serialize static constant field references. (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/prelink.dart
diff --git a/pkg/analyzer/lib/src/summary/prelink.dart b/pkg/analyzer/lib/src/summary/prelink.dart
index f814c271ccccd943a5bb887d4d5c960443411fcf..c1dd640b8787c8e2dcd1a76982ace615a26e7fb3 100644
--- a/pkg/analyzer/lib/src/summary/prelink.dart
+++ b/pkg/analyzer/lib/src/summary/prelink.dart
@@ -258,14 +258,26 @@ class _Prelinker {
for (UnlinkedClass cls in unit.classes) {
privateNamespace.putIfAbsent(cls.name, () {
Map<String, _Meaning> namespace = <String, _Meaning>{};
+ cls.fields.forEach((field) {
+ if (field.isStatic && field.isConst) {
+ namespace[field.name] =
+ new _Meaning(unitNum, ReferenceKind.constField, 0, 0);
+ }
+ });
cls.executables.forEach((executable) {
- namespace[executable.name] = new _Meaning(
- unitNum,
- executable.kind == UnlinkedExecutableKind.constructor
- ? ReferenceKind.constructor
- : ReferenceKind.staticMethod,
- 0,
- executable.typeParameters.length);
+ ReferenceKind kind = null;
+ if (executable.kind == UnlinkedExecutableKind.constructor &&
+ executable.isConst) {
+ kind = ReferenceKind.constructor;
+ } else if (executable.kind ==
+ UnlinkedExecutableKind.functionOrMethod &&
+ executable.isStatic) {
+ kind = ReferenceKind.staticMethod;
+ }
+ if (kind != null) {
+ namespace[executable.name] = new _Meaning(
+ unitNum, kind, 0, executable.typeParameters.length);
+ }
});
return new _ClassMeaning(
unitNum, 0, cls.typeParameters.length, namespace);
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/summary/resynthesize.dart » ('j') | pkg/analyzer/lib/src/summary/summarize_ast.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698