mirror of
https://github.com/robertkrimen/otto
synced 2025-10-12 20:27:30 +08:00

Remove the dependencies on perl and make. inline.pl is replaced by tools/gen-jscore and token/tokenfmt is replaced by tools/gen-tokens which are both golang text/template utilities. gen-jscore uses property ordering that matches chromes output ordering adding missing properties to the Error types. Local generated documentation have been removed as https://pkg.go.dev/ is more feature rich. The use of make has been removed as the functionality is now replicated by standard golang tools go test ./... and go generate ./... as well as integrated into github actions.
36 lines
854 B
Cheetah
36 lines
854 B
Cheetah
package otto
|
|
|
|
import (
|
|
"math"
|
|
)
|
|
|
|
func (rt *runtime) newContext() {
|
|
// Order here is import as definitions depend on each other.
|
|
{{- $object := .Type "Object"}}
|
|
{{- $function := .Type "Function"}}
|
|
{{template "prototype.tmpl" $object}}
|
|
{{template "prototype.tmpl" $function}}
|
|
|
|
{{- template "core-prototype-property.tmpl" $object}}
|
|
{{- template "core-prototype-property.tmpl" $function}}
|
|
|
|
{{- template "type.tmpl" $object}}
|
|
{{- template "type.tmpl" $function}}
|
|
|
|
{{- range .Types}}
|
|
{{- if eq .Name "Global"}}
|
|
{{template "global.tmpl" . }}
|
|
{{- else if not .Core}}
|
|
{{template "type.tmpl" .}}
|
|
{{- end}}
|
|
{{- end}}
|
|
}
|
|
|
|
func (rt *runtime) newConsole() *object {
|
|
return {{template "definition.tmpl" .Log}}
|
|
}
|
|
|
|
{{range .Values}}
|
|
{{template "value.tmpl" .}}
|
|
{{- end}}
|