Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
ialex32x committed Aug 2, 2019
2 parents bd6a850 + 2f19509 commit 2d401fb
Show file tree
Hide file tree
Showing 15 changed files with 9,544 additions and 12 deletions.
Binary file added res/stacktrace_sourcemap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 17 additions & 12 deletions unity/Assets/Duktape/Source/DuktapeAux.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@

namespace Duktape
{
public delegate string duk_source_position_cb(IntPtr ctx, string funcName, string fileName, int lineNumber);

// 基础环境
public static partial class DuktapeAux
{
public static bool printStacktrace = false;
public static duk_source_position_cb duk_source_position = default_duk_source_position;

public static Type GetType(string name)
{
Expand Down Expand Up @@ -112,18 +115,7 @@ public static int duk_print(IntPtr ctx)
DuktapeDLL.duk_get_prop_string(ctx, -2, "fileName");
var fileName = DuktapeDLL.duk_safe_to_string(ctx, -1);
DuktapeDLL.duk_pop_n(ctx, 4);
if (lineNumber != 0)
{
if (string.IsNullOrEmpty(funcName))
{
funcName = "[anonymous]";
}
stacktrace += $"{funcName} ({fileName}:{lineNumber})\n";
}
else
{
stacktrace += $"{funcName} (<native code>)\n";
}
stacktrace += (duk_source_position ?? default_duk_source_position)(ctx, funcName, fileName, lineNumber);
}
else
{
Expand All @@ -137,6 +129,19 @@ public static int duk_print(IntPtr ctx)
return 0;
}

public static string default_duk_source_position(IntPtr ctx, string funcName, string fileName, int lineNumber)
{
if (lineNumber != 0)
{
if (string.IsNullOrEmpty(funcName))
{
funcName = "[anonymous]";
}
return $"{funcName} ({fileName}:{lineNumber})\n";
}
return $"{funcName} (<native code>)\n";
}

[AOT.MonoPInvokeCallback(typeof(DuktapeDLL.duk_c_function))]
public static int duk_dofile(IntPtr ctx)
{
Expand Down
8 changes: 8 additions & 0 deletions unity/Assets/DuktapeExtra.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions unity/Assets/DuktapeExtra/Plugins.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
33 changes: 33 additions & 0 deletions unity/Assets/DuktapeExtra/Plugins/Newtonsoft.Json.dll.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 2d401fb

Please sign in to comment.