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

Unified Diff: sdk/lib/_internal/js_runtime/lib/js_helper.dart

Issue 1510763006: Fix #19137: handle when regexp doesn't match in constructorNameFallback (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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 | tests/html/websocket_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/js_runtime/lib/js_helper.dart
diff --git a/sdk/lib/_internal/js_runtime/lib/js_helper.dart b/sdk/lib/_internal/js_runtime/lib/js_helper.dart
index ab3f79c999471470f3a972deb09b10cda8f3d79b..d6dd538c03993dd5d2a5ab8a739371179bf222af 100644
--- a/sdk/lib/_internal/js_runtime/lib/js_helper.dart
+++ b/sdk/lib/_internal/js_runtime/lib/js_helper.dart
@@ -891,9 +891,9 @@ class Primitives {
// an identifier, we use that instead of the very generic 'Object'.
var objectConstructor = JS('', '#.constructor', object);
if (JS('bool', 'typeof # == "function"', objectConstructor)) {
- var decompiledName =
- JS('var', r'#.match(/^\s*function\s*([\w$]*)\s*\(/)[1]',
- JS('var', r'String(#)', objectConstructor));
+ var match = JS('var', r'#.match(/^\s*function\s*([\w$]*)\s*\(/)',
+ JS('var', r'String(#)', objectConstructor));
+ var decompiledName = match == null ? null : JS('var', r'#[1]', match);
if (decompiledName is String &&
JS('bool', r'/^\w+$/.test(#)', decompiledName)) {
name = decompiledName;
« no previous file with comments | « no previous file | tests/html/websocket_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698