@@ -492,6 +492,8 @@ void MetadataNode::SetInstanceMembersFromStaticMetadata(Isolate *isolate, Local<
492492 string lastMethodName;
493493 MethodCallbackData *callbackData = nullptr ;
494494
495+ auto origin = Constants::APP_ROOT_FOLDER_PATH + GetOrCreateInternal (treeNode)->m_name ;
496+
495497 for (auto i = 0 ; i < instanceMethodCout; i++)
496498 {
497499 auto entry = s_metadataReader.ReadInstanceMethodEntry (&curPtr);
@@ -515,7 +517,7 @@ void MetadataNode::SetInstanceMembersFromStaticMetadata(Isolate *isolate, Local<
515517 auto funcTemplate = FunctionTemplate::New (isolate, MethodCallback, funcData);
516518 auto func = funcTemplate->GetFunction ();
517519 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 */ ));
519521 lastMethodName = entry.name ;
520522 }
521523
@@ -640,6 +642,8 @@ void MetadataNode::SetStaticMembers(Isolate *isolate, Local<Function>& ctorFunct
640642 string lastMethodName;
641643 MethodCallbackData *callbackData = nullptr ;
642644
645+ auto origin = Constants::APP_ROOT_FOLDER_PATH + GetOrCreateInternal (treeNode)->m_name ;
646+
643647 // get candidates from static methods metadata
644648 auto staticMethodCout = *reinterpret_cast <uint16_t *>(curPtr);
645649 curPtr += sizeof (uint16_t );
@@ -653,7 +657,7 @@ void MetadataNode::SetStaticMembers(Isolate *isolate, Local<Function>& ctorFunct
653657 auto funcTemplate = FunctionTemplate::New (isolate, MethodCallback, funcData);
654658 auto func = funcTemplate->GetFunction ();
655659 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 */ ));
657661 lastMethodName = entry.name ;
658662 }
659663 callbackData->candidates .push_back (entry);
@@ -848,7 +852,9 @@ Local<FunctionTemplate> MetadataNode::GetConstructorFunctionTemplate(Isolate *is
848852
849853 auto ctorFunc = ctorFuncTemplate->GetFunction ();
850854
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 */ );
852858
853859 node->SetStaticMembers (isolate, wrappedCtorFunc, treeNode);
854860
@@ -1813,7 +1819,7 @@ void MetadataNode::EnableProfiler(bool enableProfiler)
18131819 s_profilerEnabled = enableProfiler;
18141820}
18151821
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)
18171823{
18181824 if (!s_profilerEnabled)
18191825 {
@@ -1868,8 +1874,8 @@ Local<Function> MetadataNode::Wrap(Isolate* isolate, const Local<Function>& f, c
18681874 TryCatch tc;
18691875
18701876 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);
18731879
18741880 if (tc.HasCaught ())
18751881 {
0 commit comments