pub fn validate_datatypes(
chain: &CodeChain,
data: &Everything,
sc: &mut ScopeContext,
expect_type: Datatype,
lang: Option<Language>,
format: Option<&Token>,
expect_promote: bool,
)
Expand description
Validate a datafunction chain, which is the stuff between [ ] in localization.
chain
is the parsed datafunction structure.sc
is aScopeContext
used to evaluate scope references in the datafunctions. If nothing is known about the scope, just pass an emptyScopeContext
withset_strict_types(false)
.expect_type
is the datatype that should be returned by this chain, can beDatatype::Unknown
in many cases.lang
is set to a specific language ifCustom
references in this chain only need to be defined for one language. It can just beNone
otherwise.format
is the formatting code given after|
in the datatype expression. It’s used for checking that game concepts in ck3 have|E
formats.expect_promote
is true iff the chain is expected to end on a promote rather than on a function. Promotes and functions are very similar but they are defined separately in the datafunction tables and usually only a function can end a chain.