Fix linter problems in function.go and types.go

This commit is contained in:
Sameer Rahmani 2021-01-22 21:27:51 +00:00
parent 4216547dd3
commit ea666bfa6a
2 changed files with 7 additions and 6 deletions

View File

@ -156,7 +156,8 @@ func MakeFunction(n Node, scope IScope, params IColl, body *Block) *Function {
// MakeFnScope a new scope for the body of a function. It binds the `bindings`
// to the given `values`.
func MakeFnScope(rt *Runtime, parent IScope, bindings IColl, values IColl) (*Scope, IError) {
func MakeFnScope(rt *Runtime, parent IScope, bindings, values IColl) (*Scope, IError) { //nolint:gocyclo
// TODO: Break this function into smaller functions
scope := MakeScope(rt, parent.(*Scope), nil)
// TODO: Implement destructuring
binds := bindings.ToSlice()
@ -193,7 +194,7 @@ func MakeFnScope(rt *Runtime, parent IScope, bindings IColl, values IColl) (*Sco
)
}
for i := 0; i < len(binds); i += 1 {
for i := 0; i < len(binds); i++ {
// If an argument started with char `&` use it to represent
// rest of values.
//

View File

@ -115,11 +115,11 @@ func changeExecutionScope(es []IExpr, scope IScope) {
// IRepresentable. Since golangs type system is weird ( if A is an interface
// that embeds interface B you []A should be usable as []B but that's not the
// case in Golang), we need this convertor helper
func toRepresentables(ast IColl) []IRepresentable {
func toRepresentables(forms IColl) []IRepresentable {
var params []IRepresentable
for _, x := range ast.ToSlice() {
params = append(params, x.(IRepresentable))
for _, x := range forms.ToSlice() {
params = append(params, x)
}
return params
@ -162,7 +162,7 @@ func MakeNodeFromExprs(es []IExpr) *Node {
// MakeNode creates a new Node in the the given `input` that points to a
// range of characters starting from the `start` till the `end`.
func MakeNode(input *ast.Source, start int, end int) Node {
func MakeNode(input *ast.Source, start, end int) Node {
return MakeNodeFromLocation(ast.MakeLocation(input, start, end))
}