forked from saary/node.net
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathHelpers.cpp
More file actions
37 lines (30 loc) · 970 Bytes
/
Helpers.cpp
File metadata and controls
37 lines (30 loc) · 970 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include "Helpers.h"
#include "v8value.h"
#include "MatchType.h"
using namespace System::Text;
using namespace System::Collections::Generic;
using namespace System::Reflection;
System::String^ Helpers::GetError(System::Exception^ e)
{
StringBuilder^ sb = gcnew StringBuilder();
while(e != nullptr)
{
sb->AppendLine(e->Message);
sb->AppendLine("----------");
e = e->InnerException;
}
return sb->ToString();
}
array<System::Object^>^ Helpers::ConvertArguments(const v8::Arguments& args, int startIndex, array<System::Reflection::ParameterInfo^>^ types)
{
List<System::Object^>^ argList = gcnew List<System::Object^>();
if (args.Length() > startIndex)
{
for(int i=startIndex; i < args.Length(); i++)
{
argList->Add(v8sharp::V8Interop::FromV8(args[i]));
}
}
array<System::Object^>^ result = MatchType::AdjustArguments(argList->ToArray(), types);
return result;
}