Declaring local variables inside a static function gives compile errors
Declaring local variables inside a static function gives compile errors. The following example does not compile.
application test entity Ent { intVal :: Int static function someInt() : Int { var i : Int := 1; var ent : Ent := Ent{ intVal := 2 }; return i + ent.intVal; } } define page root() { }
The following errors are given by WebDSL during compilation:
Submitted by Christoffer Gersen on 16 May 2012 at 17:23
- test.app:6/6: error: Global variable i has illegal type. Global variables can only be of a defined entity type, not a list, set or builtin type.
- test.app:8/13: error: Variable ‘i’ not defined
- test.app:8/17: error: Variable ‘ent’ not defined
Log in to post comments