============================================
Function definitions
============================================

f = function() return false end

a.b.f = function() return true end

local f
f = function() return 'some string' end

a.b.f = function(self, test, ...) return 10 end

---

(program
  (variable_declaration (variable_declarator (identifier))
    (function_definition (parameters)
      (return_statement (false))))

  (variable_declaration (variable_declarator
    (field_expression (field_expression (identifier) (property_identifier)) (property_identifier)))
      (function_definition (parameters)
        (return_statement (true))))

  (local_variable_declaration (variable_declarator (identifier)))

  (variable_declaration (variable_declarator (identifier))
    (function_definition (parameters)
      (return_statement (string))))

  (variable_declaration (variable_declarator
    (field_expression (field_expression (identifier) (property_identifier)) (property_identifier)))
    (function_definition (parameters (self) (identifier) (spread))
      (return_statement (number)))))

============================================
Function statements
============================================

function f()
  return false
end

f = function() return false end

function t.a.b.c.f()
  return true
end

---

(program
  (function (function_name (identifier)) (parameters)
    (return_statement (false)))

  (variable_declaration (variable_declarator (identifier))
    (function_definition (parameters)
      (return_statement (false))))

  (function (function_name (function_name_field (identifier) (property_identifier) (property_identifier) (property_identifier) (property_identifier))) (parameters)
    (return_statement (true))))


============================================
Local function statements
============================================

local function f()
  return 'some string'
end

local f
f = function() return 'some string' end

---

(program
  (local_function (identifier) (parameters)
    (return_statement (string)))

  (local_variable_declaration (variable_declarator (identifier)))
  (variable_declaration (variable_declarator (identifier))
    (function_definition (parameters)
      (return_statement (string)))))

============================================
Function calls
============================================

f(3)

f(r(), 10)

g(5, r())

---

(program
  (function_call (identifier)
    (arguments (number)))

  (function_call (identifier)
    (arguments (function_call (identifier) (arguments)) (number)))

  (function_call (identifier)
    (arguments (number) (function_call (identifier) (arguments)))))
