pub struct ValueType { /* private fields */ }Expand description
What is statically known of the value of a variable, or of the result of a host function, as Saxon-HE 12.10 infers it in a stylesheet: its item type at each moment of the compilation and, when Saxon replaces the references to the variable by a literal, its value. A reference compiled with it has that type, and is that literal (the same value as the variable’s, which is then context-free).
Implementations§
Source§impl ValueType
impl ValueType
Sourcepub fn declared(as_type: Option<&SequenceType>) -> Self
pub fn declared(as_type: Option<&SequenceType>) -> Self
The type of a parameter (of the stylesheet, of a template, of a function), or of the
result of a function: its declared type (as), whatever its default value, any
value without one.
Sourcepub fn global_variable(
value: BindingValue<'_>,
as_type: Option<&SequenceType>,
) -> Self
pub fn global_variable( value: BindingValue<'_>, as_type: Option<&SequenceType>, ) -> Self
The type of a global xsl:variable (not a parameter). Saxon infers it before type
checking anything (SourceBinding.getInferredType): the type of the parsed
select expression (arithmetic, a host function call and a reference to a global
declared later are then of unknown type), narrowed to the declared one, or the
declared type when the value is not a subtype of it. A literal select that is of
the declared type is a constant: the references are that literal.
Sourcepub fn local_variable(
value: BindingValue<'_>,
as_type: Option<&SequenceType>,
) -> Self
pub fn local_variable( value: BindingValue<'_>, as_type: Option<&SequenceType>, ) -> Self
The type of a local xsl:variable. Saxon gives its references the type inferred
as for a global variable while the instructions are type-checked one by one,
then, when the body is, the type of the type-checked value (narrowed to the
declared type), if it is a subtype of the inferred one (LetExpression.typeCheck,
VariableReference.refineVariableType). The references are a literal when the
select is one when parsed, or once type-checked, or once optimized (the
optimizer then inlines it), if of the declared type.
Sourcepub fn declared_later(&self) -> Self
pub fn declared_later(&self) -> Self
The same value, referred to from a declaration that Saxon processes before this global variable’s (one earlier in the stylesheet): the reference is then of unknown type for the inference of the type of a variable declared there.