| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent b636f47 commit 9647805
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -67,25 +67,26 @@ void Parse(const FunctionCallbackInfo<Value>& args) { | |||
| 67 | 67 | ||
| 68 | 68 | const auto& analysis = result.value(); | |
| 69 | 69 | ||
| 70 | - // Convert exports to JS Set | ||
| 70 | + // Convert exports to JS Set, omitting any name that cannot be turned into a | ||
| 71 | + // V8 string (e.g. on string allocation failure) instead of aborting. | ||
| 71 | 72 | Local<Set> exports_set = Set::New(isolate); | |
| 72 | 73 | for (const auto& exp : analysis.exports) { | |
| 73 | 74 | Local<String> exp_str; | |
| 74 | - if (!CreateString(isolate, exp).ToLocal(&exp_str) || | ||
| 75 | + if (CreateString(isolate, exp).ToLocal(&exp_str) && | ||
| 75 | 76 | exports_set->Add(context, exp_str).IsEmpty()) { | |
| 76 | 77 | return; | |
| 77 | 78 | } | |
| 78 | 79 | } | |
| 79 | 80 | ||
| 80 | - // Convert reexports to JS array using batch creation | ||
| 81 | + // Convert reexports to JS array, omitting any name that cannot be turned into | ||
| 82 | + // a V8 string. | ||
| 81 | 83 | LocalVector<Value> reexports_vec(isolate); | |
| 82 | 84 | reexports_vec.reserve(analysis.re_exports.size()); | |
| 83 | 85 | for (const auto& reexp : analysis.re_exports) { | |
| 84 | 86 | Local<String> reexp_str; | |
| 85 | - if (!CreateString(isolate, reexp).ToLocal(&reexp_str)) { | ||
| 86 | - return; | ||
| 87 | + if (CreateString(isolate, reexp).ToLocal(&reexp_str)) { | ||
| 88 | + reexports_vec.push_back(reexp_str); | ||
| 87 | 89 | } | |
| 88 | - reexports_vec.push_back(reexp_str); | ||
| 89 | 90 | } | |
| 90 | 91 | ||
| 91 | 92 | // Create result array [exports (Set), reexports (Array)] | |
| Back | FazBrowse Home | New Git URL |
0 commit comments