about summary refs log tree commit diff
path: root/pkg/lang/vm/value
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/lang/vm/value')
-rw-r--r--pkg/lang/vm/value/data.go12
-rw-r--r--pkg/lang/vm/value/value.go5
2 files changed, 14 insertions, 3 deletions
diff --git a/pkg/lang/vm/value/data.go b/pkg/lang/vm/value/data.go
index 6365f45..5d1398d 100644
--- a/pkg/lang/vm/value/data.go
+++ b/pkg/lang/vm/value/data.go
@@ -83,6 +83,16 @@ func (a ArrayData) Push(v Value) {
 
 type NullData struct{}
 
-type FunctionData struct{} // TODO
+type FunctionData struct {
+	pc int
+}
+
+func (f FunctionData) Pc() int {
+	return f.pc
+}
+
+func (f FunctionData) String() string {
+	return fmt.Sprintf("<fn %d>", f.pc)
+}
 
 type ObjectData struct{} // TODO
diff --git a/pkg/lang/vm/value/value.go b/pkg/lang/vm/value/value.go
index daa17dd..93989cf 100644
--- a/pkg/lang/vm/value/value.go
+++ b/pkg/lang/vm/value/value.go
@@ -35,8 +35,9 @@ func NewNull() Value {
 	return Value{t: t}
 }
 
-func NewFunction() Value {
-	panic("not implemented")
+func NewFunction(pc int) Value {
+	t := Type{Kind: FunctionType}
+	return Value{t: t, d: FunctionData{pc: pc}}
 }
 
 func NewObject() Value {