From 734b0cb6bcf8272e647288a0e3c17086c9f855b4 Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Thu, 30 Aug 2018 22:53:34 +0200 Subject: [PATCH] Implement runtime functions for reflect The reflect package isn't supported yet. But at least the Go parser/typechecker can now deal with it. --- src/runtime/gc.go | 8 ++++++++ src/runtime/runtime_unix.go | 8 ++++++++ src/runtime/stack.go | 16 ++++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 src/runtime/stack.go diff --git a/src/runtime/gc.go b/src/runtime/gc.go index 6bb06a75..f28b3380 100644 --- a/src/runtime/gc.go +++ b/src/runtime/gc.go @@ -28,3 +28,11 @@ func alloc(size uintptr) unsafe.Pointer { func free(ptr unsafe.Pointer) { // TODO: use a GC } + +func GC() { + // Unimplemented. +} + +func KeepAlive(x interface{}) { + // Unimplemented. Only required with SetFinalizer(). +} diff --git a/src/runtime/runtime_unix.go b/src/runtime/runtime_unix.go index ca062df3..d21e80cd 100644 --- a/src/runtime/runtime_unix.go +++ b/src/runtime/runtime_unix.go @@ -56,3 +56,11 @@ func alloc(size uintptr) unsafe.Pointer { func free(ptr unsafe.Pointer) { //C.free(ptr) // TODO } + +func GC() { + // Unimplemented. +} + +func KeepAlive(x interface{}) { + // Unimplemented. Only required with SetFinalizer(). +} diff --git a/src/runtime/stack.go b/src/runtime/stack.go new file mode 100644 index 00000000..c2cff3d0 --- /dev/null +++ b/src/runtime/stack.go @@ -0,0 +1,16 @@ +package runtime + +type Func struct { +} + +func FuncForPC(pc uintptr) *Func { + return nil +} + +func (f *Func) Name() string { + return "" +} + +func Caller(skip int) (pc uintptr, file string, line int, ok bool) { + return 0, "", 0, false +}