mirror of
https://github.com/edg-l/edlang.git
synced 2024-11-09 09:38:24 +00:00
format
This commit is contained in:
parent
c68daa2d93
commit
7e88b8fb12
44
src/check.rs
44
src/check.rs
|
@ -33,13 +33,11 @@ pub fn check<'a>(data: &'a ProgramData, ast: &ast::Program) -> Vec<Check<'a>> {
|
|||
line_start: 1,
|
||||
fold: true,
|
||||
origin: Some(&data.filename),
|
||||
annotations: vec![
|
||||
SourceAnnotation {
|
||||
label: "unexpected statement",
|
||||
annotation_type: AnnotationType::Error,
|
||||
range: statement.span.into(),
|
||||
},
|
||||
],
|
||||
annotations: vec![SourceAnnotation {
|
||||
label: "unexpected statement",
|
||||
annotation_type: AnnotationType::Error,
|
||||
range: statement.span.into(),
|
||||
}],
|
||||
}],
|
||||
opt: FormatOptions {
|
||||
color: true,
|
||||
|
@ -51,8 +49,8 @@ pub fn check<'a>(data: &'a ProgramData, ast: &ast::Program) -> Vec<Check<'a>> {
|
|||
errors.push(Check::Error(dl));
|
||||
}
|
||||
Statement::Definition(_) => {
|
||||
// can't have a top level assignment yet.
|
||||
let snippet = Snippet {
|
||||
// can't have a top level assignment yet.
|
||||
let snippet = Snippet {
|
||||
title: Some(Annotation {
|
||||
id: None,
|
||||
label: Some("unexpected definition at top level"),
|
||||
|
@ -64,13 +62,11 @@ pub fn check<'a>(data: &'a ProgramData, ast: &ast::Program) -> Vec<Check<'a>> {
|
|||
line_start: 1,
|
||||
fold: true,
|
||||
origin: Some(&data.filename),
|
||||
annotations: vec![
|
||||
SourceAnnotation {
|
||||
label: "unexpected statement",
|
||||
annotation_type: AnnotationType::Error,
|
||||
range: statement.span.into(),
|
||||
},
|
||||
],
|
||||
annotations: vec![SourceAnnotation {
|
||||
label: "unexpected statement",
|
||||
annotation_type: AnnotationType::Error,
|
||||
range: statement.span.into(),
|
||||
}],
|
||||
}],
|
||||
opt: FormatOptions {
|
||||
color: true,
|
||||
|
@ -80,7 +76,7 @@ pub fn check<'a>(data: &'a ProgramData, ast: &ast::Program) -> Vec<Check<'a>> {
|
|||
|
||||
let dl = DisplayList::from(snippet);
|
||||
errors.push(Check::Error(dl));
|
||||
},
|
||||
}
|
||||
Statement::Return(_x) => {
|
||||
// can't have a top level assignment yet.
|
||||
let snippet = Snippet {
|
||||
|
@ -95,13 +91,11 @@ pub fn check<'a>(data: &'a ProgramData, ast: &ast::Program) -> Vec<Check<'a>> {
|
|||
line_start: 1,
|
||||
fold: true,
|
||||
origin: Some(&data.filename),
|
||||
annotations: vec![
|
||||
SourceAnnotation {
|
||||
label: "unexpected return",
|
||||
annotation_type: AnnotationType::Error,
|
||||
range: statement.span.into(),
|
||||
},
|
||||
],
|
||||
annotations: vec![SourceAnnotation {
|
||||
label: "unexpected return",
|
||||
annotation_type: AnnotationType::Error,
|
||||
range: statement.span.into(),
|
||||
}],
|
||||
}],
|
||||
opt: FormatOptions {
|
||||
color: true,
|
||||
|
@ -111,7 +105,7 @@ pub fn check<'a>(data: &'a ProgramData, ast: &ast::Program) -> Vec<Check<'a>> {
|
|||
|
||||
let dl = DisplayList::from(snippet);
|
||||
errors.push(Check::Error(dl));
|
||||
},
|
||||
}
|
||||
Statement::Function(_function) => {}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue