Index: pkg/compiler/lib/src/js_backend/backend.dart |
diff --git a/pkg/compiler/lib/src/js_backend/backend.dart b/pkg/compiler/lib/src/js_backend/backend.dart |
index ff9a0c4d174518e47e40e62ebf957ae16d6bee5c..ebda3742700f794a926dadff8542b7fa0f5a0d30 100644 |
--- a/pkg/compiler/lib/src/js_backend/backend.dart |
+++ b/pkg/compiler/lib/src/js_backend/backend.dart |
@@ -302,6 +302,7 @@ class JavaScriptBackend extends Backend { |
Element jsStringToString; |
Element jsStringOperatorAdd; |
Element objectEquals; |
+ Element cachedCheckConcurrentModificationError; |
ClassElement typeLiteralClass; |
ClassElement mapLiteralClass; |
@@ -1662,6 +1663,18 @@ class JavaScriptBackend extends Backend { |
return findHelper('throwAbstractClassInstantiationError'); |
} |
+ Element getCheckConcurrentModificationError() { |
+ if (cachedCheckConcurrentModificationError == null) { |
+ cachedCheckConcurrentModificationError = |
+ findHelper('checkConcurrentModificationError'); |
+ } |
+ return cachedCheckConcurrentModificationError; |
+ } |
+ |
+ Element getThrowConcurrentModificationError() { |
+ return findHelper('throwConcurrentModificationError'); |
+ } |
+ |
Element getStringInterpolationHelper() { |
return findHelper('S'); |
} |
@@ -2750,6 +2763,13 @@ class JavaScriptResolutionCallbacks extends ResolutionCallbacks { |
registerBackendStaticInvocation(backend.getTraceFromException(), registry); |
} |
+ void onSyncForIn(Registry registry) { |
+ assert(registry.isForResolution); |
+ // The SSA builder recognizes certain for-in loops and can generate calls to |
+ // throwConcurrentModificationError. |
+ registerBackendStaticInvocation( |
+ backend.getCheckConcurrentModificationError(), registry); |
+ } |
void onTypeVariableExpression(Registry registry) { |
assert(registry.isForResolution); |