Index: dart/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart |
diff --git a/dart/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart b/dart/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart |
index d94adf17cf8403973a7dda970ff3e20fb0e385a2..5dfacf3744ee2014f2e13a5280af820659396cf2 100644 |
--- a/dart/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart |
+++ b/dart/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart |
@@ -390,11 +390,14 @@ $lazyInitializerLogic |
$isolate[fieldName] = sentinelInProgress; |
try { |
result = $isolate[fieldName] = lazyValue(); |
- } catch (e) { |
- if ($isolate[fieldName] === sentinelInProgress) { |
- $isolate[fieldName] = null; |
+ } finally { |
+""" // Use try-finally, not try-catch/throw as it destroys the stack trace. |
+""" |
+ if (result === sentinelUndefined) { |
+ if ($isolate[fieldName] === sentinelInProgress) { |
+ $isolate[fieldName] = null; |
+ } |
} |
- throw e; |
} |
} else if (result === sentinelInProgress) { |
$cyclicThrow(staticName); |