@@ -492,6 +492,8 @@ void MetadataNode::SetInstanceMembersFromStaticMetadata(Isolate *isolate, Local<
492
492
string lastMethodName;
493
493
MethodCallbackData *callbackData = nullptr ;
494
494
495
+ auto origin = Constants::APP_ROOT_FOLDER_PATH + GetOrCreateInternal (treeNode)->m_name ;
496
+
495
497
for (auto i = 0 ; i < instanceMethodCout; i++)
496
498
{
497
499
auto entry = s_metadataReader.ReadInstanceMethodEntry (&curPtr);
@@ -515,7 +517,7 @@ void MetadataNode::SetInstanceMembersFromStaticMetadata(Isolate *isolate, Local<
515
517
auto funcTemplate = FunctionTemplate::New (isolate, MethodCallback, funcData);
516
518
auto func = funcTemplate->GetFunction ();
517
519
auto funcName = ConvertToV8String (entry.name );
518
- prototypeTemplate->Set (funcName, Wrap (isolate, func, entry.name , false /* isCtorFunc */ ));
520
+ prototypeTemplate->Set (funcName, Wrap (isolate, func, entry.name , origin, false /* isCtorFunc */ ));
519
521
lastMethodName = entry.name ;
520
522
}
521
523
@@ -640,6 +642,8 @@ void MetadataNode::SetStaticMembers(Isolate *isolate, Local<Function>& ctorFunct
640
642
string lastMethodName;
641
643
MethodCallbackData *callbackData = nullptr ;
642
644
645
+ auto origin = Constants::APP_ROOT_FOLDER_PATH + GetOrCreateInternal (treeNode)->m_name ;
646
+
643
647
// get candidates from static methods metadata
644
648
auto staticMethodCout = *reinterpret_cast <uint16_t *>(curPtr);
645
649
curPtr += sizeof (uint16_t );
@@ -653,7 +657,7 @@ void MetadataNode::SetStaticMembers(Isolate *isolate, Local<Function>& ctorFunct
653
657
auto funcTemplate = FunctionTemplate::New (isolate, MethodCallback, funcData);
654
658
auto func = funcTemplate->GetFunction ();
655
659
auto funcName = ConvertToV8String (entry.name );
656
- ctorFunction->Set (funcName, Wrap (isolate, func, entry.name , false /* isCtorFunc */ ));
660
+ ctorFunction->Set (funcName, Wrap (isolate, func, entry.name , origin, false /* isCtorFunc */ ));
657
661
lastMethodName = entry.name ;
658
662
}
659
663
callbackData->candidates .push_back (entry);
@@ -848,7 +852,9 @@ Local<FunctionTemplate> MetadataNode::GetConstructorFunctionTemplate(Isolate *is
848
852
849
853
auto ctorFunc = ctorFuncTemplate->GetFunction ();
850
854
851
- auto wrappedCtorFunc = Wrap (isolate, ctorFunc, node->m_treeNode ->name , true /* isCtorFunc */ );
855
+ auto origin = Constants::APP_ROOT_FOLDER_PATH + node->m_name ;
856
+
857
+ auto wrappedCtorFunc = Wrap (isolate, ctorFunc, node->m_treeNode ->name , origin, true /* isCtorFunc */ );
852
858
853
859
node->SetStaticMembers (isolate, wrappedCtorFunc, treeNode);
854
860
@@ -1813,7 +1819,7 @@ void MetadataNode::EnableProfiler(bool enableProfiler)
1813
1819
s_profilerEnabled = enableProfiler;
1814
1820
}
1815
1821
1816
- Local<Function> MetadataNode::Wrap (Isolate* isolate, const Local<Function>& f, const string& name, bool isCtorFunc)
1822
+ Local<Function> MetadataNode::Wrap (Isolate* isolate, const Local<Function>& f, const string& name, const string& origin, bool isCtorFunc)
1817
1823
{
1818
1824
if (!s_profilerEnabled)
1819
1825
{
@@ -1868,8 +1874,8 @@ Local<Function> MetadataNode::Wrap(Isolate* isolate, const Local<Function>& f, c
1868
1874
TryCatch tc;
1869
1875
1870
1876
Local<Script> script;
1871
- ScriptOrigin origin (ConvertToV8String (Constants::APP_ROOT_FOLDER_PATH + m_name ));
1872
- auto maybeScript = Script::Compile (context, source, &origin ).ToLocal (&script);
1877
+ ScriptOrigin jsOrigin (ConvertToV8String (origin ));
1878
+ auto maybeScript = Script::Compile (context, source, &jsOrigin ).ToLocal (&script);
1873
1879
1874
1880
if (tc.HasCaught ())
1875
1881
{
0 commit comments