Skip to content

Commit

Permalink
SectionProxy::end_section() is not needed
Browse files Browse the repository at this point in the history
  • Loading branch information
amitu committed Nov 2, 2024
1 parent 3dd1f15 commit d41bb0f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 21 deletions.
1 change: 1 addition & 0 deletions v0.5/fastn-lang/src/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,5 +286,6 @@ fn error(e: &fastn_lang::Error, _s: &fastn_lang::Span, _source: &str) -> serde_j
fastn_lang::Error::SectionNameNotFoundForEnd => "section_name_not_found_for_end",
fastn_lang::Error::EndContainsData => "end_contains_data",
fastn_lang::Error::EndWithoutStart => "end_without_start",
fastn_lang::Error::ImportCantHaveType => "import_cant_have_type",
}})
}
21 changes: 0 additions & 21 deletions v0.5/fastn-lang/src/section/wiggin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ fn inner_ender<T: SectionProxy>(
// ended.
if name == e_name && !candidate.has_ended() {
candidate.add_children(children);
candidate.end_section();
stack.push(candidate);
continue 'outer;
} else {
Expand Down Expand Up @@ -137,19 +136,6 @@ trait SectionProxy: Sized + std::fmt::Debug {
fn mark<'input>(&'input self, source: &'input str) -> Result<Mark<'input>, fastn_lang::Error>;
fn add_children(&mut self, children: Vec<Self>);

/// Marks the current section as ended.
///
/// This function is triggered when an `end` marker (`-- end: <section-name>`) is found
/// in the source, corresponding to a previously opened section with the same name.
///
/// # Example
/// For the input:
/// 1. -- bar:
/// 2. -- end: bar
/// When `2. -- end: bar` is encountered, this function will mark the corresponding
/// `bar` (`1. -- bar`) section as ended, indicating that no further children can be added.
fn end_section(&mut self);

/// Checks if the current section is marked as ended.
///
/// # Returns
Expand Down Expand Up @@ -195,10 +181,6 @@ impl SectionProxy for fastn_lang::Section {
self.has_end = true;
}

fn end_section(&mut self) {
self.has_end = true;
}

fn has_ended(&self) -> bool {
self.has_end
}
Expand Down Expand Up @@ -239,9 +221,6 @@ mod test {

fn add_children(&mut self, children: Vec<Self>) {
self.children = children;
}

fn end_section(&mut self) {
self.has_ended = true;
}

Expand Down

0 comments on commit d41bb0f

Please sign in to comment.