Add return type to function declarations
This commit is contained in:
parent
1e5f7cd5d5
commit
76b558a982
5 changed files with 1738 additions and 1628 deletions
|
|
@ -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
|
||||
================================================================================
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue