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

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

Issue 232563006: Insert checks before deferred calls and accesses. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Forgot to stage deferred_load.dart 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/compile_time_constants.dart
diff --git a/sdk/lib/_internal/compiler/implementation/compile_time_constants.dart b/sdk/lib/_internal/compiler/implementation/compile_time_constants.dart
index 2dfbb57f492623e0aeaf3515e3a700386c895c8f..33576a4d100bff838babb9da78c5d39b3c6924e9 100644
--- a/sdk/lib/_internal/compiler/implementation/compile_time_constants.dart
+++ b/sdk/lib/_internal/compiler/implementation/compile_time_constants.dart
@@ -417,31 +417,9 @@ class CompileTimeConstantEvaluator extends Visitor {
/// Returns true if the prefix of the send resolves to a deferred import
/// prefix.
bool isDeferredUse(Send send) {
- // We handle:
- // 1. Send(Send(Send(null, Prefix), className), staticName)
- // 2. Send(Send(Prefix, Classname), staticName)
- // 3. Send(Send(null, Prefix), staticName | className)
- // 4. Send(Send(Prefix), staticName | className)
- // Nodes of the forms 2,4 occur in metadata.
if (send == null) return false;
- while (send.receiver is Send) {
- send = send.receiver;
- }
- Identifier prefixNode;
- if (send.receiver is Identifier) {
- prefixNode = send.receiver;
- } else if (send.receiver == null &&
- send.selector is Identifier) {
- prefixNode = send.selector;
- }
- if (prefixNode != null) {
- Element maybePrefix = elements[prefixNode.asIdentifier()];
- if (maybePrefix != null && maybePrefix.isPrefix() &&
- (maybePrefix as PrefixElement).isDeferred) {
- return true;
- }
- }
- return false;
+ return compiler.deferredLoadTask
+ .deferredPrefixElement(send, elements) != null;
}
Constant visitIdentifier(Identifier node) {

Powered by Google App Engine
This is Rietveld 408576698