Skip to content

Commit 9cf0687

Browse files
committed
add support for new jint version
1 parent 47bd0e8 commit 9cf0687

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

Runtime/ReactUnity.asmdef

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
"ExCSS.dll",
2424
"Jint.dll",
2525
"websocket-sharp.dll",
26-
"Newtonsoft.Json.dll"
26+
"Newtonsoft.Json.dll",
27+
"Acornima.dll"
2728
],
2829
"autoReferenced": true,
2930
"defineConstraints": [],
@@ -102,6 +103,11 @@
102103
"name": "Unity",
103104
"expression": "2023.2",
104105
"define": "REACT_TMP_X2"
106+
},
107+
{
108+
"name": "com.reactunity.jint",
109+
"expression": "0.20.0",
110+
"define": "REACT_JINT_ACORNIMA"
105111
}
106112
],
107113
"noEngineReferences": false

Runtime/Scripting/Jint/JintEngine.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
using System.Collections.Generic;
99
using System.Globalization;
1010
using System.Reflection;
11-
using Esprima;
1211
using Jint;
1312
using Jint.Native;
1413
using Jint.Native.Object;
@@ -69,12 +68,21 @@ public Exception TryExecute(string code, string fileName = null, JavascriptDocum
6968
{
7069
Execute(code, fileName, documentType);
7170
}
72-
catch (ParserException ex)
71+
#if REACT_JINT_ACORNIMA
72+
catch (Acornima.ParseErrorException ex)
7373
{
7474
Debug.LogError($"Parser exception in line {ex.LineNumber} column {ex.Column}");
7575
Debug.LogException(ex);
7676
return ex;
7777
}
78+
#else
79+
catch (Esprima.ParserException ex)
80+
{
81+
Debug.LogError($"Parser exception in line {ex.LineNumber} column {ex.Column}");
82+
Debug.LogException(ex);
83+
return ex;
84+
}
85+
#endif
7886
catch (JavaScriptException ex)
7987
{
8088
Debug.LogError($"JS exception in {ex.Location}");

0 commit comments

Comments
 (0)