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

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

Issue 247863005: Revert "Insert checks before deferred calls and accesses." (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
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/deferred_load.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 33576a4d100bff838babb9da78c5d39b3c6924e9..2dfbb57f492623e0aeaf3515e3a700386c895c8f 100644
--- a/sdk/lib/_internal/compiler/implementation/compile_time_constants.dart
+++ b/sdk/lib/_internal/compiler/implementation/compile_time_constants.dart
@@ -417,9 +417,31 @@ 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;
- return compiler.deferredLoadTask
- .deferredPrefixElement(send, elements) != null;
+ 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;
}
Constant visitIdentifier(Identifier node) {
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/deferred_load.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698