lang: funcs: core: Make module names public

This is needed for when we have nested modules.
This commit is contained in:
James Shubin
2019-05-20 08:45:43 -04:00
parent d5074871c7
commit 12582e963d
35 changed files with 49 additions and 49 deletions

View File

@@ -26,7 +26,7 @@ import (
const Answer = 42
func init() {
simple.ModuleRegister(moduleName, "answer", &types.FuncValue{
simple.ModuleRegister(ModuleName, "answer", &types.FuncValue{
T: types.NewType("func() int"),
V: func([]types.Value) (types.Value, error) {
return &types.IntValue{V: Answer}, nil

View File

@@ -25,7 +25,7 @@ import (
)
func init() {
simple.ModuleRegister(moduleName, "errorbool", &types.FuncValue{
simple.ModuleRegister(ModuleName, "errorbool", &types.FuncValue{
T: types.NewType("func(a bool) str"),
V: func(input []types.Value) (types.Value, error) {
if input[0].Bool() {

View File

@@ -18,6 +18,6 @@
package coreexample
const (
// moduleName is the prefix given to all the functions in this module.
moduleName = "example"
// ModuleName is the prefix given to all the functions in this module.
ModuleName = "example"
)

View File

@@ -25,7 +25,7 @@ import (
)
func init() {
facts.ModuleRegister(moduleName, "flipflop", func() facts.Fact { return &FlipFlopFact{} }) // must register the fact and name
facts.ModuleRegister(ModuleName, "flipflop", func() facts.Fact { return &FlipFlopFact{} }) // must register the fact and name
}
// FlipFlopFact is a fact which flips a bool repeatedly. This is an example fact

View File

@@ -25,7 +25,7 @@ import (
)
func init() {
simple.ModuleRegister(moduleName, "int2str", &types.FuncValue{
simple.ModuleRegister(ModuleName, "int2str", &types.FuncValue{
T: types.NewType("func(a int) str"),
V: func(input []types.Value) (types.Value, error) {
return &types.StrValue{

View File

@@ -25,7 +25,7 @@ import (
)
func init() {
simple.ModuleRegister(moduleName, "str2int", &types.FuncValue{
simple.ModuleRegister(ModuleName, "str2int", &types.FuncValue{
T: types.NewType("func(a str) int"),
V: func(input []types.Value) (types.Value, error) {
var i int64

View File

@@ -33,7 +33,7 @@ import (
)
func init() {
funcs.ModuleRegister(moduleName, "vumeter", func() interfaces.Func { return &VUMeterFunc{} }) // must register the func and name
funcs.ModuleRegister(ModuleName, "vumeter", func() interfaces.Func { return &VUMeterFunc{} }) // must register the func and name
}
// VUMeterFunc is a gimmic function to display a vu meter from the microphone.