Browse Source

Merge pull request #220 from keikhosro/master

Add the location of throw statement to the JavaScriptException
Sébastien Ros 10 years ago
parent
commit
b00c0a17e9
2 changed files with 8 additions and 2 deletions
  1. 4 1
      Jint/Engine.cs
  2. 4 1
      Jint/Runtime/StatementInterpreter.cs

+ 4 - 1
Jint/Engine.cs

@@ -295,7 +295,10 @@ namespace Jint
                 var result = _statements.ExecuteProgram(program);
                 var result = _statements.ExecuteProgram(program);
                 if (result.Type == Completion.Throw)
                 if (result.Type == Completion.Throw)
                 {
                 {
-                    throw new JavaScriptException(result.GetValueOrDefault());
+                    throw new JavaScriptException(result.GetValueOrDefault())
+                    {
+                        Location = result.Location
+                    };
                 }
                 }
 
 
                 _completionValue = result.GetValueOrDefault();
                 _completionValue = result.GetValueOrDefault();

+ 4 - 1
Jint/Runtime/StatementInterpreter.cs

@@ -420,7 +420,10 @@ namespace Jint.Runtime
                     c = ExecuteStatement(statement);
                     c = ExecuteStatement(statement);
                     if (c.Type != Completion.Normal)
                     if (c.Type != Completion.Normal)
                     {
                     {
-                        return new Completion(c.Type, c.Value.HasValue ? c.Value : sl.Value, c.Identifier);
+                        return new Completion(c.Type, c.Value.HasValue ? c.Value : sl.Value, c.Identifier)
+                        {
+                            Location = c.Location
+                        };
                     }
                     }
 
 
                     sl = c;
                     sl = c;