public Engine Execute(Program program) { ResetStatementsCount(); ResetTimeoutTicks(); ResetLastStatement(); ResetCallStack(); using (new StrictModeScope(Options.IsStrict() || program.Strict)) { DeclarationBindingInstantiation(DeclarationBindingType.GlobalCode, program.FunctionDeclarations, program.VariableDeclarations, null, null); var result = _statements.ExecuteProgram(program); if (result.Type == Completion.Throw) { throw new JavaScriptException(result.GetValueOrDefault()) { Location = result.Location }; } _completionValue = result.GetValueOrDefault(); } return(this); }
/// <summary> /// Gets a named value from the specified scope. /// </summary> /// <param name="scope">The scope to get the property from.</param> /// <param name="propertyName">The name of the property to return.</param> public JsValue GetValue(JsValue scope, string propertyName) { if (System.String.IsNullOrEmpty(propertyName)) { throw new ArgumentException("propertyName"); } var reference = new Reference(scope, propertyName, Options.IsStrict()); return(GetValue(reference)); }