|
1 |
| -using System; |
| 1 | +using System; |
2 | 2 | using System.Collections.Generic;
|
3 | 3 | using System.Text;
|
4 | 4 | using Jint.Expressions;
|
@@ -343,15 +343,15 @@ public void Visit(ExpressionStatement statement) {
|
343 | 343 |
|
344 | 344 | public void Visit(ForEachInStatement statement) {
|
345 | 345 | // todo: may be declare own property in the current scope if not a globalDeclaration?
|
346 |
| - bool globalDeclaration = true; |
347 |
| - string identifier = String.Empty; |
| 346 | + //bool globalDeclaration = true; |
| 347 | + var identifier = string.Empty; |
348 | 348 |
|
349 | 349 | if (statement.InitialisationStatement is VariableDeclarationStatement) {
|
350 |
| - globalDeclaration = ((VariableDeclarationStatement)statement.InitialisationStatement).Global; |
| 350 | + //globalDeclaration = ((VariableDeclarationStatement)statement.InitialisationStatement).Global; |
351 | 351 | identifier = ((VariableDeclarationStatement)statement.InitialisationStatement).Identifier;
|
352 | 352 | }
|
353 | 353 | else if (statement.InitialisationStatement is Identifier) {
|
354 |
| - globalDeclaration = true; |
| 354 | + //globalDeclaration = true; |
355 | 355 | identifier = ((Identifier)statement.InitialisationStatement).Text;
|
356 | 356 | }
|
357 | 357 | else {
|
@@ -542,6 +542,7 @@ public void Visit(ThrowStatement statement) {
|
542 | 542 | statement.Expression.Accept(this);
|
543 | 543 | }
|
544 | 544 |
|
| 545 | + UnityEngine.Debug.LogError(Result.Value.ToString()); |
545 | 546 | throw new JsException(Result);
|
546 | 547 | }
|
547 | 548 |
|
@@ -1131,7 +1132,7 @@ public void Visit(UnaryExpression expression) {
|
1131 | 1132 |
|
1132 | 1133 | case UnaryExpressionType.Void:
|
1133 | 1134 |
|
1134 |
| - expression.Accept(this); |
| 1135 | + expression.Expression.Accept(this); |
1135 | 1136 | Result = JsUndefined.Instance;
|
1136 | 1137 | break;
|
1137 | 1138 |
|
@@ -1449,25 +1450,23 @@ public void Visit(Identifier expression) {
|
1449 | 1450 |
|
1450 | 1451 | string propertyName = lastIdentifier = expression.Text;
|
1451 | 1452 |
|
1452 |
| - JsInstance result = null; |
1453 |
| - if (CurrentScope.TryGetProperty(propertyName, out result)) { |
1454 |
| - Result = result; |
1455 |
| - if (Result != null) |
1456 |
| - return; |
1457 |
| - } |
1458 |
| - |
1459 |
| - if (propertyName == "null") { |
| 1453 | + if (propertyName == "null") |
| 1454 | + { |
1460 | 1455 | Result = JsNull.Instance;
|
| 1456 | + return; |
1461 | 1457 | }
|
1462 | 1458 |
|
1463 |
| - if (propertyName == "undefined") { |
| 1459 | + if (propertyName == "undefined") |
| 1460 | + { |
1464 | 1461 | Result = JsUndefined.Instance;
|
| 1462 | + return; |
1465 | 1463 | }
|
1466 | 1464 |
|
1467 |
| - // Try to record full path in case it's a type |
1468 |
| - if (Result == null) { |
1469 |
| - typeFullname.Append(propertyName); |
1470 |
| - } |
| 1465 | + JsInstance result = null; |
| 1466 | + CurrentScope.TryGetProperty(propertyName, out result); |
| 1467 | + Result = result; |
| 1468 | + |
| 1469 | + return; |
1471 | 1470 | }
|
1472 | 1471 |
|
1473 | 1472 | private void EnsureClrAllowed() {
|
@@ -1507,7 +1506,7 @@ public void Visit(ArrayDeclaration expression) {
|
1507 | 1506 | var array = Global.ArrayClass.New();
|
1508 | 1507 |
|
1509 | 1508 | // Process parameters
|
1510 |
| - JsInstance[] parameters = new JsInstance[expression.Parameters.Count]; |
| 1509 | + //JsInstance[] parameters = new JsInstance[expression.Parameters.Count]; |
1511 | 1510 |
|
1512 | 1511 | for (int i = 0; i < expression.Parameters.Count; i++) {
|
1513 | 1512 | expression.Parameters[i].Accept(this);
|
|
0 commit comments