lang: funcs: core: Make module names public
This is needed for when we have nested modules.
This commit is contained in:
@@ -18,6 +18,6 @@
|
||||
package coredatetime
|
||||
|
||||
const (
|
||||
// moduleName is the prefix given to all the functions in this module.
|
||||
moduleName = "datetime"
|
||||
// ModuleName is the prefix given to all the functions in this module.
|
||||
ModuleName = "datetime"
|
||||
)
|
||||
|
||||
@@ -25,7 +25,7 @@ import (
|
||||
)
|
||||
|
||||
func init() {
|
||||
facts.ModuleRegister(moduleName, "now", func() facts.Fact { return &DateTimeFact{} }) // must register the fact and name
|
||||
facts.ModuleRegister(ModuleName, "now", func() facts.Fact { return &DateTimeFact{} }) // must register the fact and name
|
||||
}
|
||||
|
||||
// DateTimeFact is a fact which returns the current date and time.
|
||||
|
||||
@@ -27,7 +27,7 @@ import (
|
||||
|
||||
func init() {
|
||||
// FIXME: consider renaming this to printf, and add in a format string?
|
||||
simple.ModuleRegister(moduleName, "print", &types.FuncValue{
|
||||
simple.ModuleRegister(ModuleName, "print", &types.FuncValue{
|
||||
T: types.NewType("func(a int) str"),
|
||||
V: func(input []types.Value) (types.Value, error) {
|
||||
epochDelta := input[0].Int()
|
||||
|
||||
@@ -27,7 +27,7 @@ import (
|
||||
)
|
||||
|
||||
func init() {
|
||||
simple.ModuleRegister(moduleName, "weekday", &types.FuncValue{
|
||||
simple.ModuleRegister(ModuleName, "weekday", &types.FuncValue{
|
||||
T: types.NewType("func(a int) str"),
|
||||
V: Weekday,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user