Skip to main content

compile

Function compile 

Source
pub fn compile(opts: &Options, name: &str, fs: &dyn FileSystem) -> Compiled
Expand description

Compiles one file as far as opts.emit asks for and renders the result.

name is the path as the user wrote it, which is the name every diagnostic about the file uses. EmitKind::Tast and EmitKind::Ir produce text today. Every later kind runs the same front end and gives back nothing, so that a file with a mistake in it is reported the same way whichever of them was asked for, rather than compiling silently until the part that is written notices.

The checking is skipped when the parse reported an error. The two poisoning rules mean a diagnosed expression produces no further complaints, but a declaration the parser had to skip past leaves no declaration behind at all, and every later use of that name would be reported as undeclared. One mistake is worth one message.