Skip to main content

validate_wesl

Function validate_wesl 

Source
pub fn validate_wesl(module: &TranslationUnit) -> Result<(), Diagnostic<Error>>
Expand description

Validate an intermediate WESL module.

This function only checks that a WESL module is valid on its own, without looking at external modules (imports).

It currently does not validate a lot. It checks for:

  • Defined declarations: all identifiers refer to a user declaration, import or built-in name.
  • Duplicate declarations: declarations in the same scope cannot have the same name. (except for unresolved conditional compilation)
  • Cyclic declarations: no cycles are allowed in declarations.