fix https://github.com/zeit/pkg/issues/62 again
This commit is contained in:
parent
cc906ac4a2
commit
d465d24eaa
@ -96,6 +96,23 @@
|
||||
// Ok to use Isolate here; this function is only called in the main thread.
|
||||
DCHECK(parsing_on_main_thread_);
|
||||
Isolate* isolate = info->isolate();
|
||||
--- node/deps/v8/src/runtime/runtime-classes.cc
|
||||
+++ node/deps/v8/src/runtime/runtime-classes.cc
|
||||
@@ -236,10 +236,14 @@
|
||||
if (!start_position->IsSmi() || !end_position->IsSmi() ||
|
||||
!Handle<Script>::cast(script)->HasValidSource()) {
|
||||
return isolate->ThrowIllegalOperation();
|
||||
}
|
||||
|
||||
+ if (Handle<Script>::cast(script)->source()->IsUndefined()) {
|
||||
+ return *isolate->factory()->NewStringFromAsciiChecked("class {}");
|
||||
+ }
|
||||
+
|
||||
Handle<String> source(String::cast(Handle<Script>::cast(script)->source()));
|
||||
return *isolate->factory()->NewSubString(
|
||||
source, Handle<Smi>::cast(start_position)->value(),
|
||||
Handle<Smi>::cast(end_position)->value());
|
||||
}
|
||||
--- node/deps/v8/src/snapshot/serialize.cc
|
||||
+++ node/deps/v8/src/snapshot/serialize.cc
|
||||
@@ -2695,24 +2695,36 @@
|
||||
|
||||
@ -84,18 +84,20 @@
|
||||
static void FlushICache(void* start, size_t size);
|
||||
--- node/deps/v8/src/objects.cc
|
||||
+++ node/deps/v8/src/objects.cc
|
||||
@@ -13382,10 +13382,11 @@
|
||||
Isolate* const isolate = function->GetIsolate();
|
||||
Handle<SharedFunctionInfo> shared_info(function->shared(), isolate);
|
||||
|
||||
// Check if {function} should hide its source code.
|
||||
if (!shared_info->script()->IsScript() ||
|
||||
+ Script::cast(shared_info->script())->source()->IsUndefined() ||
|
||||
Script::cast(shared_info->script())->hide_source()) {
|
||||
return NativeCodeFunctionSourceString(shared_info);
|
||||
}
|
||||
@@ -13390,10 +13390,13 @@
|
||||
|
||||
// Check if we should print {function} as a class.
|
||||
Handle<Object> class_start_position = JSReceiver::GetDataProperty(
|
||||
function, isolate->factory()->class_start_position_symbol());
|
||||
if (class_start_position->IsSmi()) {
|
||||
+ if (Script::cast(shared_info->script())->source()->IsUndefined()) {
|
||||
+ return isolate->factory()->NewStringFromAsciiChecked("class {}");
|
||||
+ }
|
||||
Handle<Object> class_end_position = JSReceiver::GetDataProperty(
|
||||
function, isolate->factory()->class_end_position_symbol());
|
||||
Handle<String> script_source(
|
||||
String::cast(Script::cast(shared_info->script())->source()), isolate);
|
||||
return isolate->factory()->NewSubString(
|
||||
--- node/deps/v8/src/parsing/parser.cc
|
||||
+++ node/deps/v8/src/parsing/parser.cc
|
||||
@@ -5057,10 +5057,11 @@
|
||||
|
||||
@ -84,18 +84,20 @@
|
||||
static void FlushICache(void* start, size_t size);
|
||||
--- node/deps/v8/src/objects.cc
|
||||
+++ node/deps/v8/src/objects.cc
|
||||
@@ -13127,10 +13127,11 @@
|
||||
Isolate* const isolate = function->GetIsolate();
|
||||
Handle<SharedFunctionInfo> shared_info(function->shared(), isolate);
|
||||
|
||||
// Check if {function} should hide its source code.
|
||||
if (!shared_info->script()->IsScript() ||
|
||||
+ Script::cast(shared_info->script())->source()->IsUndefined(isolate) ||
|
||||
Script::cast(shared_info->script())->hide_source()) {
|
||||
return NativeCodeFunctionSourceString(shared_info);
|
||||
}
|
||||
@@ -13135,10 +13135,13 @@
|
||||
|
||||
// Check if we should print {function} as a class.
|
||||
Handle<Object> class_start_position = JSReceiver::GetDataProperty(
|
||||
function, isolate->factory()->class_start_position_symbol());
|
||||
if (class_start_position->IsSmi()) {
|
||||
+ if (Script::cast(shared_info->script())->source()->IsUndefined(isolate)) {
|
||||
+ return isolate->factory()->NewStringFromAsciiChecked("class {}");
|
||||
+ }
|
||||
Handle<Object> class_end_position = JSReceiver::GetDataProperty(
|
||||
function, isolate->factory()->class_end_position_symbol());
|
||||
Handle<String> script_source(
|
||||
String::cast(Script::cast(shared_info->script())->source()), isolate);
|
||||
return isolate->factory()->NewSubString(
|
||||
--- node/deps/v8/src/parsing/parser.cc
|
||||
+++ node/deps/v8/src/parsing/parser.cc
|
||||
@@ -3918,10 +3918,11 @@
|
||||
|
||||
@ -84,20 +84,20 @@
|
||||
static void FlushICache(void* start, size_t size);
|
||||
--- node/deps/v8/src/objects.cc
|
||||
+++ node/deps/v8/src/objects.cc
|
||||
@@ -12840,11 +12840,12 @@
|
||||
Handle<String> JSFunction::ToString(Handle<JSFunction> function) {
|
||||
Isolate* const isolate = function->GetIsolate();
|
||||
Handle<SharedFunctionInfo> shared_info(function->shared(), isolate);
|
||||
|
||||
// Check if {function} should hide its source code.
|
||||
- if (!shared_info->IsUserJavaScript()) {
|
||||
+ if (!shared_info->IsUserJavaScript() ||
|
||||
+ Script::cast(shared_info->script())->source()->IsUndefined(isolate)) {
|
||||
return NativeCodeFunctionSourceString(shared_info);
|
||||
}
|
||||
@@ -12848,10 +12848,13 @@
|
||||
|
||||
// Check if we should print {function} as a class.
|
||||
Handle<Object> class_start_position = JSReceiver::GetDataProperty(
|
||||
function, isolate->factory()->class_start_position_symbol());
|
||||
if (class_start_position->IsSmi()) {
|
||||
+ if (Script::cast(shared_info->script())->source()->IsUndefined(isolate)) {
|
||||
+ return isolate->factory()->NewStringFromAsciiChecked("class {}");
|
||||
+ }
|
||||
Handle<Object> class_end_position = JSReceiver::GetDataProperty(
|
||||
function, isolate->factory()->class_end_position_symbol());
|
||||
Handle<String> script_source(
|
||||
String::cast(Script::cast(shared_info->script())->source()), isolate);
|
||||
return isolate->factory()->NewSubString(
|
||||
--- node/deps/v8/src/parsing/parsing.cc
|
||||
+++ node/deps/v8/src/parsing/parsing.cc
|
||||
@@ -23,10 +23,11 @@
|
||||
|
||||
Loading…
Reference in New Issue
Block a user