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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/mirrors_used.dart

Issue 24282005: Move compile-time constant registrations to the backend. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update status Created 7 years, 2 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library dart2js.mirrors_used; 5 library dart2js.mirrors_used;
6 6
7 import 'dart2jslib.dart' show 7 import 'dart2jslib.dart' show
8 Compiler, 8 Compiler,
9 CompilerTask, 9 CompilerTask,
10 Constant, 10 Constant,
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 && librariesWithUsage.contains(library)); 127 && librariesWithUsage.contains(library));
128 } 128 }
129 129
130 /// Call-back from the resolver to analyze MirorsUsed annotations. The result 130 /// Call-back from the resolver to analyze MirorsUsed annotations. The result
131 /// is stored in [analyzer] and later used to compute 131 /// is stored in [analyzer] and later used to compute
132 /// [:analyzer.mergedMirrorUsage:]. 132 /// [:analyzer.mergedMirrorUsage:].
133 void validate(NewExpression node, TreeElements mapping) { 133 void validate(NewExpression node, TreeElements mapping) {
134 for (Node argument in node.send.arguments) { 134 for (Node argument in node.send.arguments) {
135 NamedArgument named = argument.asNamedArgument(); 135 NamedArgument named = argument.asNamedArgument();
136 if (named == null) continue; 136 if (named == null) continue;
137 Constant value = compiler.metadataHandler.compileNodeWithDefinitions( 137 Constant value = compiler.constantHandler.compileNodeWithDefinitions(
138 named.expression, mapping, isConst: true); 138 named.expression, mapping, isConst: true);
139 139
140 ConstantMapper mapper = 140 ConstantMapper mapper =
141 new ConstantMapper(compiler.metadataHandler, mapping, compiler); 141 new ConstantMapper(compiler.constantHandler, mapping, compiler);
142 named.expression.accept(mapper); 142 named.expression.accept(mapper);
143 143
144 MirrorUsageBuilder builder = 144 MirrorUsageBuilder builder =
145 new MirrorUsageBuilder( 145 new MirrorUsageBuilder(
146 analyzer, mapping.currentElement.getLibrary(), named.expression, 146 analyzer, mapping.currentElement.getLibrary(), named.expression,
147 value, mapper.constantToNodeMap); 147 value, mapper.constantToNodeMap);
148 148
149 if (named.name.source == const SourceString('symbols')) { 149 if (named.name.source == const SourceString('symbols')) {
150 analyzer.cachedValues[value] = 150 analyzer.cachedValues[value] =
151 builder.convertToListOfStrings( 151 builder.convertToListOfStrings(
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 // @MirrorsUsed(targets: fisk) 590 // @MirrorsUsed(targets: fisk)
591 // ^^^^ 591 // ^^^^
592 // 592 //
593 // Instead of saying 'fisk' should pretty print the problematic constant 593 // Instead of saying 'fisk' should pretty print the problematic constant
594 // value. 594 // value.
595 return spannable; 595 return spannable;
596 } 596 }
597 return node; 597 return node;
598 } 598 }
599 } 599 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698