aboutsummaryrefslogtreecommitdiffstats
path: root/Godeps/_workspace/src/github.com/obscuren/otto/cmpl_evaluate.go
diff options
context:
space:
mode:
authorzsfelfoldi <zsfelfoldi@gmail.com>2015-03-20 20:22:01 +0800
committerzsfelfoldi <zsfelfoldi@gmail.com>2015-03-20 20:22:01 +0800
commit8324b683b4e557e6c5c9d572d01f933b3e074185 (patch)
tree8c6a8c34d87f808c3979875642d4ca38844ad22d /Godeps/_workspace/src/github.com/obscuren/otto/cmpl_evaluate.go
parent91f9f355b2e334214e38e1827c624cdcc23c5130 (diff)
downloadgo-tangerine-8324b683b4e557e6c5c9d572d01f933b3e074185.tar.gz
go-tangerine-8324b683b4e557e6c5c9d572d01f933b3e074185.tar.zst
go-tangerine-8324b683b4e557e6c5c9d572d01f933b3e074185.zip
using robertkrimen/otto, godeps updated
Diffstat (limited to 'Godeps/_workspace/src/github.com/obscuren/otto/cmpl_evaluate.go')
-rw-r--r--Godeps/_workspace/src/github.com/obscuren/otto/cmpl_evaluate.go87
1 files changed, 0 insertions, 87 deletions
diff --git a/Godeps/_workspace/src/github.com/obscuren/otto/cmpl_evaluate.go b/Godeps/_workspace/src/github.com/obscuren/otto/cmpl_evaluate.go
deleted file mode 100644
index a5b30f6c0..000000000
--- a/Godeps/_workspace/src/github.com/obscuren/otto/cmpl_evaluate.go
+++ /dev/null
@@ -1,87 +0,0 @@
-package otto
-
-import (
- "strconv"
-)
-
-func (self *_runtime) cmpl_evaluate_nodeProgram(node *_nodeProgram) Value {
- self.cmpl_functionDeclaration(node.functionList)
- self.cmpl_variableDeclaration(node.varList)
- return self.cmpl_evaluate_nodeStatementList(node.body)
-}
-
-func (self *_runtime) cmpl_call_nodeFunction(function *_object, environment *_functionEnvironment, node *_nodeFunctionLiteral, this Value, argumentList []Value) Value {
-
- indexOfParameterName := make([]string, len(argumentList))
- // function(abc, def, ghi)
- // indexOfParameterName[0] = "abc"
- // indexOfParameterName[1] = "def"
- // indexOfParameterName[2] = "ghi"
- // ...
-
- argumentsFound := false
- for index, name := range node.parameterList {
- if name == "arguments" {
- argumentsFound = true
- }
- value := UndefinedValue()
- if index < len(argumentList) {
- value = argumentList[index]
- indexOfParameterName[index] = name
- }
- self.localSet(name, value)
- }
-
- if !argumentsFound {
- arguments := self.newArgumentsObject(indexOfParameterName, environment, len(argumentList))
- arguments.defineProperty("callee", toValue_object(function), 0101, false)
- environment.arguments = arguments
- self.localSet("arguments", toValue_object(arguments))
- for index, _ := range argumentList {
- if index < len(node.parameterList) {
- continue
- }
- indexAsString := strconv.FormatInt(int64(index), 10)
- arguments.defineProperty(indexAsString, argumentList[index], 0111, false)
- }
- }
-
- self.cmpl_functionDeclaration(node.functionList)
- self.cmpl_variableDeclaration(node.varList)
-
- result := self.cmpl_evaluate_nodeStatement(node.body)
- if result.isResult() {
- return result
- }
-
- return UndefinedValue()
-}
-
-func (self *_runtime) cmpl_functionDeclaration(list []*_nodeFunctionLiteral) {
- executionContext := self._executionContext(0)
- eval := executionContext.eval
- environment := executionContext.VariableEnvironment
-
- for _, function := range list {
- name := function.name
- value := self.cmpl_evaluate_nodeExpression(function)
- if !environment.HasBinding(name) {
- environment.CreateMutableBinding(name, eval == true)
- }
- // TODO 10.5.5.e
- environment.SetMutableBinding(name, value, false) // TODO strict
- }
-}
-
-func (self *_runtime) cmpl_variableDeclaration(list []string) {
- executionContext := self._executionContext(0)
- eval := executionContext.eval
- environment := executionContext.VariableEnvironment
-
- for _, name := range list {
- if !environment.HasBinding(name) {
- environment.CreateMutableBinding(name, eval == true)
- environment.SetMutableBinding(name, UndefinedValue(), false) // TODO strict
- }
- }
-}