]> ocean-lang.org Git - ocean/commit
oceani: allow global constants to be used before declared.
authorNeilBrown <neil@brown.name>
Sat, 4 Dec 2021 22:37:00 +0000 (09:37 +1100)
committerNeilBrown <neil@brown.name>
Sat, 4 Dec 2021 23:02:32 +0000 (10:02 +1100)
commite4967da39aff091cd9dfa187cf77c84ba8643293
tree2335984370a5f074185e627a595b914f2916adc2
parent272629ad8689864feba7ae632e838c37c81b6f9f
oceani: allow global constants to be used before declared.

When an undeclared name is used, it gets allocated a Tnone variable.
If one of these is found in a 'use' statement, it is assumed to be
a label (that will change later).
If it gets declared as a constant, its type gets set appropriately.

When evaluating global constants, if a value cannot be determined, we
continue with other constants, then, retry.  If the failure was because
some constant was not yet declared, this will eventually resolved.
If resolution is not possible, an error is produced.

Currently, non-global variables and functions cannot resolve.
This is tracking in the new Enoconst prop_err flag.

Signed-off-by: NeilBrown <neil@brown.name>
csrc/oceani-tests.mdc
csrc/oceani.mdc