1
0
mirror of https://github.com/MontFerret/ferret.git synced 2025-06-23 00:28:10 +02:00

New type system (#232)

* New type system

* Fixed dot notation for HTML elements
This commit is contained in:
Tim Voronov
2019-02-13 12:31:18 -05:00
committed by GitHub
parent b3bcbda3b9
commit 1af8b37a0f
185 changed files with 1379 additions and 820 deletions

View File

@ -5,6 +5,7 @@ import (
"github.com/MontFerret/ferret/pkg/runtime/core"
"github.com/MontFerret/ferret/pkg/runtime/values"
"github.com/MontFerret/ferret/pkg/runtime/values/types"
)
// Input types a value to an underlying input element.
@ -21,7 +22,7 @@ func Input(_ context.Context, args ...core.Value) (core.Value, error) {
}
arg1 := args[0]
err = core.ValidateType(arg1, core.HTMLDocumentType, core.HTMLElementType)
err = core.ValidateType(arg1, types.HTMLDocument, types.HTMLElement)
if err != nil {
return values.False, err
@ -37,7 +38,7 @@ func Input(_ context.Context, args ...core.Value) (core.Value, error) {
// selector
arg2 := args[1]
err = core.ValidateType(arg2, core.StringType)
err = core.ValidateType(arg2, types.String)
if err != nil {
return values.False, err
@ -48,7 +49,7 @@ func Input(_ context.Context, args ...core.Value) (core.Value, error) {
if len(args) == 4 {
arg4 := args[3]
err = core.ValidateType(arg4, core.IntType)
err = core.ValidateType(arg4, types.Int)
if err != nil {
return values.False, err
@ -70,7 +71,7 @@ func Input(_ context.Context, args ...core.Value) (core.Value, error) {
if len(args) == 3 {
arg3 := args[2]
err = core.ValidateType(arg3, core.IntType)
err = core.ValidateType(arg3, types.Int)
if err != nil {
return values.False, err