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

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

Issue 2265473004: Introduce "CommonElements" (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: cl Created 4 years, 4 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/compiler/lib/src/mirrors_used.dart
diff --git a/pkg/compiler/lib/src/mirrors_used.dart b/pkg/compiler/lib/src/mirrors_used.dart
index c909c8a1f4e3330e0dfd7b1cf86a738a132e84f0..79dac05b8ba0dcf53800bf7d607c3f3aa204e556 100644
--- a/pkg/compiler/lib/src/mirrors_used.dart
+++ b/pkg/compiler/lib/src/mirrors_used.dart
@@ -91,7 +91,9 @@ class MirrorUsageAnalyzerTask extends CompilerTask {
/// Collect @MirrorsUsed annotations in all libraries. Called by the
/// compiler after all libraries are loaded, but before resolution.
void analyzeUsage(LibraryElement mainApp) {
- if (mainApp == null || compiler.mirrorsLibrary == null) return;
+ if (mainApp == null || compiler.commonElements.mirrorsLibrary == null) {
+ return;
+ }
measure(analyzer.run);
List<String> symbols = analyzer.mergedMirrorUsage.symbols;
List<Element> targets = analyzer.mergedMirrorUsage.targets;
@@ -241,7 +243,7 @@ class MirrorUsageAnalyzer {
List<MirrorUsage> mirrorsUsedOnLibraryTag(
LibraryElement library, ImportElement import) {
LibraryElement importedLibrary = import.importedLibrary;
- if (importedLibrary != compiler.mirrorsLibrary) {
+ if (importedLibrary != compiler.commonElements.mirrorsLibrary) {
return null;
}
List<MirrorUsage> result = <MirrorUsage>[];
@@ -250,7 +252,7 @@ class MirrorUsageAnalyzer {
ConstantValue value =
compiler.constants.getConstantValue(metadata.constant);
Element element = value.getType(compiler.coreTypes).element;
- if (element == compiler.mirrorsUsedClass) {
+ if (element == compiler.commonElements.mirrorsUsedClass) {
result.add(buildUsage(value));
}
}
@@ -313,14 +315,11 @@ class MirrorUsageAnalyzer {
/// that was resolved during [MirrorUsageAnalyzerTask.validate].
MirrorUsage buildUsage(ConstructedConstantValue constant) {
Map<Element, ConstantValue> fields = constant.fields;
- VariableElement symbolsField =
- compiler.mirrorsUsedClass.lookupLocalMember('symbols');
- VariableElement targetsField =
- compiler.mirrorsUsedClass.lookupLocalMember('targets');
- VariableElement metaTargetsField =
- compiler.mirrorsUsedClass.lookupLocalMember('metaTargets');
- VariableElement overrideField =
- compiler.mirrorsUsedClass.lookupLocalMember('override');
+ ClassElement cls = compiler.commonElements.mirrorsUsedClass;
+ VariableElement symbolsField = cls.lookupLocalMember('symbols');
+ VariableElement targetsField = cls.lookupLocalMember('targets');
+ VariableElement metaTargetsField = cls.lookupLocalMember('metaTargets');
+ VariableElement overrideField = cls.lookupLocalMember('override');
return new MirrorUsage(
cachedStrings[fields[symbolsField]],
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/full_emitter/setup_program_builder.dart ('k') | pkg/compiler/lib/src/patch_parser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698