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 9, 2019
2 parents 7c3e773 + 691af70 commit 5d34992
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions unity/Assets/Duktape/Source/DuktapeAux.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ namespace Duktape
// 基础环境
public static partial class DuktapeAux
{
// 用于提取 error.stack 中的 stacktrace 信息
private static Regex _stRegex;
public static bool printStacktrace = false;
public static duk_source_position_cb duk_source_position = default_duk_source_position;

Expand Down Expand Up @@ -45,11 +47,14 @@ public static void PrintError(IntPtr ctx, int idx, string filename)
{
var errlines = err.Split('\n');
err = "";
var reg = new Regex(@"^\s+at\s(.+)\s\((.+\.js):(\d+)\)(.*)$", RegexOptions.Compiled);
if (_stRegex == null)
{
_stRegex = new Regex(@"^\s+at\s(.+)\s\((.+\.js):(\d+)\)(.*)$", RegexOptions.Compiled);
}
for (var i = 0; i < errlines.Length; i++)
{
var line = errlines[i];
var matches = reg.Matches(line);
var matches = _stRegex.Matches(line);
if (matches.Count == 1)
{
var match = matches[0];
Expand Down

0 comments on commit 5d34992

Please sign in to comment.