|
@@ -443,7 +443,7 @@ func (door * Door) Call(vm *VM, args...Value) []Value {
|
|
return Redispatch(door, vm, args...)
|
|
return Redispatch(door, vm, args...)
|
|
}
|
|
}
|
|
|
|
|
|
-var doorSignature = NewSignature(WordTypeValue)
|
|
|
|
|
|
+var doorSignature = NewSignature(WordType)
|
|
|
|
|
|
func (door * Door) Signature() Signature {
|
|
func (door * Door) Signature() Signature {
|
|
return doorSignature
|
|
return doorSignature
|
|
@@ -506,9 +506,9 @@ func openDoor(vm *VM, val ...Value) [] Value {
|
|
}
|
|
}
|
|
|
|
|
|
func (vm *VM) RegisterBuiltins() {
|
|
func (vm *VM) RegisterBuiltins() {
|
|
- vm.RegisterBuiltinWithHelp("addi", addi, `adds two integers together`).Takes(IntTypeValue, IntTypeValue).Returns(BoolTypeValue)
|
|
|
|
- vm.RegisterBuiltinWithHelp("addf", addf, `adds two floats together`).Takes(IntTypeValue, IntTypeValue).Returns(IntTypeValue)
|
|
|
|
- vm.RegisterBuiltinWithHelp("andb", andb, `returns true if all it's arguments are true`).Takes(BoolTypeValue, BoolTypeValue).Returns(BoolTypeValue)
|
|
|
|
|
|
+ vm.RegisterBuiltinWithHelp("addi", addi, `adds two integers together`).Takes(IntType, IntType).Returns(BoolType)
|
|
|
|
+ vm.RegisterBuiltinWithHelp("addf", addf, `adds two floats together`).Takes(IntType, IntType).Returns(IntType)
|
|
|
|
+ vm.RegisterBuiltinWithHelp("andb", andb, `returns true if all it's arguments are true`).Takes(BoolType, BoolType).Returns(BoolType)
|
|
vm.RegisterBuiltin("cover", cover)
|
|
vm.RegisterBuiltin("cover", cover)
|
|
vm.RegisterBuiltin("fetchl", fetchl)
|
|
vm.RegisterBuiltin("fetchl", fetchl)
|
|
vm.RegisterBuiltin("fetchm", fetchm)
|
|
vm.RegisterBuiltin("fetchm", fetchm)
|
|
@@ -544,28 +544,28 @@ func (vm *VM) RegisterBuiltins() {
|
|
vm.AddOverloads("open", Over("openDoor", 0, DoorType))
|
|
vm.AddOverloads("open", Over("openDoor", 0, DoorType))
|
|
|
|
|
|
vm.AddOverloads("mul",
|
|
vm.AddOverloads("mul",
|
|
- Over("mulf", 0, FloatTypeValue, FloatTypeValue),
|
|
|
|
- Over("muli", 0, IntTypeValue, IntTypeValue),
|
|
|
|
- Over("mulf", 0, FloatTypeValue, IntTypeValue),
|
|
|
|
- Over("mulf", 0, IntTypeValue, FloatTypeValue))
|
|
|
|
|
|
+ Over("mulf", 0, FloatType, FloatType),
|
|
|
|
+ Over("muli", 0, IntType, IntType),
|
|
|
|
+ Over("mulf", 0, FloatType, IntType),
|
|
|
|
+ Over("mulf", 0, IntType, FloatType))
|
|
|
|
|
|
vm.AddOverloads("add",
|
|
vm.AddOverloads("add",
|
|
- Over("addf", 0, FloatTypeValue, FloatTypeValue),
|
|
|
|
- Over("addi", 0, IntTypeValue, IntTypeValue),
|
|
|
|
- Over("addf", 0, FloatTypeValue, IntTypeValue),
|
|
|
|
- Over("addf", 0, IntTypeValue, FloatTypeValue))
|
|
|
|
|
|
+ Over("addf", 0, FloatType, FloatType),
|
|
|
|
+ Over("addi", 0, IntType, IntType),
|
|
|
|
+ Over("addf", 0, FloatType, IntType),
|
|
|
|
+ Over("addf", 0, IntType, FloatType))
|
|
|
|
|
|
|
|
|
|
vm.SetHelp("mul", " Num: Multiplies two numbers. Cover for muli and mulf.")
|
|
vm.SetHelp("mul", " Num: Multiplies two numbers. Cover for muli and mulf.")
|
|
vm.AddOverloads("fetch",
|
|
vm.AddOverloads("fetch",
|
|
- Over("fetchl", 0, ListTypeValue, IntTypeValue),
|
|
|
|
- Over("fetchm", 0, MapTypeValue, AnyTypeValue),
|
|
|
|
|
|
+ Over("fetchl", 0, ListType, IntType),
|
|
|
|
+ Over("fetchm", 0, MapType, AnyType),
|
|
)
|
|
)
|
|
vm.SetHelp("fetch", " storage, index. Fetch value in storage at given index.")
|
|
vm.SetHelp("fetch", " storage, index. Fetch value in storage at given index.")
|
|
/*
|
|
/*
|
|
vm.AddOverloads("store",
|
|
vm.AddOverloads("store",
|
|
- Over("storel", ListTypeValue, IntTypeValue, AnyTypeValue),
|
|
|
|
- Over("storem", MapTypeValue, AnyTypeValue, AnyTypeValue),
|
|
|
|
|
|
+ Over("storel", ListType, IntType, AnyType),
|
|
|
|
+ Over("storem", MapType, AnyType, AnyType),
|
|
)
|
|
)
|
|
vm.SetHelp("store", " storage, index, value. Store value in storage at given index.")
|
|
vm.SetHelp("store", " storage, index, value. Store value in storage at given index.")
|
|
*/
|
|
*/
|