Add return type to function declarations

This commit is contained in:
Bruno BELANYI 2022-06-01 22:07:05 +02:00
parent 1e5f7cd5d5
commit 76b558a982
5 changed files with 1738 additions and 1628 deletions

View file

@ -130,6 +130,25 @@ function func(a: int, b: int) = "string"
type: (identifier))
body: (string_literal)))
================================================================================
Function declaration return type
================================================================================
function func(a: int, b: int) : string = "string"
--------------------------------------------------------------------------------
(source_file
(function_declaration
name: (identifier)
parameters: (parameters
name: (identifier)
type: (identifier)
name: (identifier)
type: (identifier))
return_type: (identifier)
body: (string_literal)))
================================================================================
Function declaration single parameter
================================================================================
@ -173,6 +192,20 @@ primitive prim()
name: (identifier)
parameters: (parameters)))
================================================================================
Primitive declaration with return type
================================================================================
primitive prim() : int
--------------------------------------------------------------------------------
(source_file
(primitive_declaration
name: (identifier)
parameters: (parameters)
return_type: (identifier)))
================================================================================
Variable declaration
================================================================================