node: implement func_get_contents

This commit is contained in:
mappu 2020-04-16 18:56:11 +12:00
parent ac093a05a3
commit 9b88dee9ef

View File

@ -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}}