mirror of
https://github.com/MontFerret/ferret.git
synced 2024-12-14 11:23:02 +02:00
1af8b37a0f
* New type system * Fixed dot notation for HTML elements
43 lines
613 B
Go
43 lines
613 B
Go
package values
|
|
|
|
import (
|
|
"github.com/MontFerret/ferret/pkg/runtime/core"
|
|
"github.com/MontFerret/ferret/pkg/runtime/values/types"
|
|
)
|
|
|
|
type none struct{}
|
|
|
|
var None = &none{}
|
|
|
|
func (t *none) MarshalJSON() ([]byte, error) {
|
|
return []byte("null"), nil
|
|
}
|
|
|
|
func (t *none) Type() core.Type {
|
|
return types.None
|
|
}
|
|
|
|
func (t *none) String() string {
|
|
return ""
|
|
}
|
|
|
|
func (t *none) Compare(other core.Value) int64 {
|
|
if other.Type() == types.None {
|
|
return 0
|
|
}
|
|
|
|
return -1
|
|
}
|
|
|
|
func (t *none) Unwrap() interface{} {
|
|
return nil
|
|
}
|
|
|
|
func (t *none) Hash() uint64 {
|
|
return 0
|
|
}
|
|
|
|
func (t *none) Copy() core.Value {
|
|
return None
|
|
}
|