From 9b88dee9ef0144dde7bd1c81a005ab8db93a343a Mon Sep 17 00:00:00 2001 From: mappu Date: Thu, 16 Apr 2020 18:56:11 +1200 Subject: [PATCH] node: implement func_get_contents --- node.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/node.go b/node.go index 6e007f3..e20eb26 100644 --- a/node.go +++ b/node.go @@ -1194,6 +1194,14 @@ func (this *conversionState) convertNoFreeFloating(n_ node.Node) (string, error) this.importPackages["strings"] = struct{}{} funcName = `strings.ToUpper` + } else if funcName == `file_get_contents` { + if len(callParams) != 2 { + return "", parseErr{n, arityErr{funcName, len(callParams), 1, 1}} + } + + this.importPackages["io/ioutil"] = struct{}{} + funcName = `ioutil.ReadFile` // (string filename) + } else if funcName == `file_put_contents` { if len(callParams) != 2 { return "", parseErr{n, arityErr{funcName, len(callParams), 2, 2}}