Skip to content

Local variables in objects are set to null #264

@MarkoBL

Description

@MarkoBL

Hi,

there seems to be a problem with local variables and objects in Scriban 3 (worked in 2.x as expected). When I return an object with a value set to a local variable, the value is null afterwards. Here's an example of the bug:

{{
func hello1
 $hello = "hello1"
 ret $hello
end

func hello2
 $hello = "hello2"
 ret [ $hello ]
end

func hello3
 $hello = "hello3"
 ret { hello: $hello }
end

func hello4
 ret { hello: "hello4" }
end
}}

hello1: {{ hello1 }}
hello2: {{ hello2 }}
hello3: {{ hello3 }}
hello4: {{ hello4 }}

Output

hello1: hello1
hello2: ["hello2"]
hello3: {hello: null}
hello4: {hello: "hello4"}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions