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

Unified Diff: sdk/lib/_internal/compiler/implementation/mirrors_used.dart

Issue 226953003: Revert "Compute frontend/backend specific constants." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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: sdk/lib/_internal/compiler/implementation/mirrors_used.dart
diff --git a/sdk/lib/_internal/compiler/implementation/mirrors_used.dart b/sdk/lib/_internal/compiler/implementation/mirrors_used.dart
index 276cab2e50b5ceb631aa6710a4809fcdb5f732c3..034d2094b6d0fb3089ede39ea14327e6b3ce05f8 100644
--- a/sdk/lib/_internal/compiler/implementation/mirrors_used.dart
+++ b/sdk/lib/_internal/compiler/implementation/mirrors_used.dart
@@ -8,7 +8,6 @@ import 'dart2jslib.dart' show
Compiler,
CompilerTask,
Constant,
- ConstantCompiler,
ConstructedConstant,
ListConstant,
MessageKind,
@@ -134,13 +133,17 @@ class MirrorUsageAnalyzerTask extends CompilerTask {
for (Node argument in node.send.arguments) {
NamedArgument named = argument.asNamedArgument();
if (named == null) continue;
- ConstantCompiler constantCompiler = compiler.resolver.constantCompiler;
- Constant value = constantCompiler.compileNode(named.expression, mapping);
+ Constant value = compiler.constantHandler.compileNodeWithDefinitions(
+ named.expression, mapping, isConst: true);
+
+ ConstantMapper mapper =
+ new ConstantMapper(compiler.constantHandler, mapping, compiler);
+ named.expression.accept(mapper);
MirrorUsageBuilder builder =
new MirrorUsageBuilder(
analyzer, mapping.currentElement.getLibrary(), named.expression,
- value, mapping);
+ value, mapper.constantToNodeMap);
if (named.name.source == 'symbols') {
analyzer.cachedStrings[value] =
@@ -371,14 +374,14 @@ class MirrorUsageBuilder {
final LibraryElement enclosingLibrary;
final Spannable spannable;
final Constant constant;
- final TreeElements elements;
+ final Map<Constant, Node> constantToNodeMap;
MirrorUsageBuilder(
this.analyzer,
this.enclosingLibrary,
this.spannable,
this.constant,
- this.elements);
+ this.constantToNodeMap);
Compiler get compiler => analyzer.compiler;
@@ -563,12 +566,7 @@ class MirrorUsageBuilder {
/// Attempt to find a [Spannable] corresponding to constant.
Spannable positionOf(Constant constant) {
- Node node;
- elements.forEachConstantNode((Node n, Constant c) {
- if (node == null && c == constant) {
- node = n;
- }
- });
+ Node node = constantToNodeMap[constant];
if (node == null) {
// TODO(ahe): Returning [spannable] here leads to confusing error
// messages. For example, consider:

Powered by Google App Engine
This is Rietveld 408576698