Skip to content

Commit

Permalink
A few more typos
Browse files Browse the repository at this point in the history
  • Loading branch information
kazimuth committed Sep 9, 2024
1 parent a52ef5c commit f2fe780
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions crates/schema/src/type_for_generate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ impl TypespaceForGenerateBuilder<'_> {
match ty {
AlgebraicType::Ref(ref_) => {
// Indirectly recurse.
self.add_ref(*ref_)
self.parse_ref(*ref_)
}
AlgebraicType::Array(ArrayType { elem_ty }) => {
let elem_ty = self.parse_use(elem_ty)?;
Expand Down Expand Up @@ -457,7 +457,7 @@ impl TypespaceForGenerateBuilder<'_> {
/// This is the only seriously complicated case of `parse_use`, which has to deal with cycle detection.
/// So it gets its own function.
/// Mutually recursive with `parse_use`.
fn add_ref(&mut self, ref_: AlgebraicTypeRef) -> Result<AlgebraicTypeUse> {
fn parse_ref(&mut self, ref_: AlgebraicTypeRef) -> Result<AlgebraicTypeUse> {
if self.is_def.contains(&ref_) {
// We know this type is going to be a definition.
// So, we can just return a ref to it.
Expand Down Expand Up @@ -505,9 +505,12 @@ impl TypespaceForGenerateBuilder<'_> {
/// Does not detect cycles, those are left for `mark_allowed_cycles`, which is called after all definitions are processed.
///
/// Why not invoke this for all definitions ourselves, since we know which refs are definitions?
/// It's so that the caller can wrap definitions with better context and error information.
/// It's so that the caller can wrap errors with better context information.
pub fn add_definition(&mut self, ref_: AlgebraicTypeRef) -> Result<()> {
assert!(self.is_def.contains(&ref_));
assert!(
self.is_def.contains(&ref_),
"internal codegen error: any AlgebraicTypeRef passed to `add_definition` must refer to a declared definition, {ref_} does not"
);

let def = self
.typespace
Expand Down Expand Up @@ -563,7 +566,7 @@ impl TypespaceForGenerateBuilder<'_> {
result
}

/// Process an element of a product or sum type.
/// Process an element/variant of a product/sum type.
///
/// `def` is the *containing* type that corresponds to a `Def`,
/// `algebraic_type` is the type of the element/variant inside `def` and corresponds to a `Use`.
Expand Down

0 comments on commit f2fe780

Please sign in to comment.