s/AbilityDemand/AbilityMember

This is a better name
This commit is contained in:
Ayaz Hafiz 2022-04-06 11:20:34 -04:00
parent d58300e016
commit 2dc0445f46
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
4 changed files with 11 additions and 11 deletions

View file

@ -273,7 +273,7 @@ pub enum Has<'a> {
/// An ability demand is a value defining the ability; for example `hash : a -> U64 | a has Hash` /// An ability demand is a value defining the ability; for example `hash : a -> U64 | a has Hash`
/// for a `Hash` ability. /// for a `Hash` ability.
#[derive(Debug, Clone, Copy, PartialEq)] #[derive(Debug, Clone, Copy, PartialEq)]
pub struct AbilityDemand<'a> { pub struct AbilityMember<'a> {
pub name: Loc<Spaced<'a, &'a str>>, pub name: Loc<Spaced<'a, &'a str>>,
pub typ: Loc<TypeAnnotation<'a>>, pub typ: Loc<TypeAnnotation<'a>>,
} }
@ -305,7 +305,7 @@ pub enum Def<'a> {
Ability { Ability {
header: TypeHeader<'a>, header: TypeHeader<'a>,
loc_has: Loc<Has<'a>>, loc_has: Loc<Has<'a>>,
demands: &'a [AbilityDemand<'a>], members: &'a [AbilityMember<'a>],
}, },
// TODO in canonicalization, check to see if there are any newlines after the // TODO in canonicalization, check to see if there are any newlines after the

View file

@ -1074,14 +1074,14 @@ fn finish_parsing_alias_or_opaque<'a>(
mod ability { mod ability {
use super::*; use super::*;
use crate::{ use crate::{
ast::{AbilityDemand, Spaceable, Spaced}, ast::{AbilityMember, Spaceable, Spaced},
parser::EAbility, parser::EAbility,
}; };
/// Parses a single ability demand line; see `parse_demand`. /// Parses a single ability demand line; see `parse_demand`.
fn parse_demand_help<'a>( fn parse_demand_help<'a>(
start_column: u32, start_column: u32,
) -> impl Parser<'a, AbilityDemand<'a>, EAbility<'a>> { ) -> impl Parser<'a, AbilityMember<'a>, EAbility<'a>> {
map!( map!(
and!( and!(
specialize(|_, pos| EAbility::DemandName(pos), loc!(lowercase_ident())), specialize(|_, pos| EAbility::DemandName(pos), loc!(lowercase_ident())),
@ -1099,7 +1099,7 @@ mod ability {
) )
), ),
|(name, typ): (Loc<&'a str>, Loc<TypeAnnotation<'a>>)| { |(name, typ): (Loc<&'a str>, Loc<TypeAnnotation<'a>>)| {
AbilityDemand { AbilityMember {
name: name.map_owned(Spaced::Item), name: name.map_owned(Spaced::Item),
typ, typ,
} }
@ -1117,7 +1117,7 @@ mod ability {
/// This is basically the same as parsing a free-floating annotation, but with stricter rules. /// This is basically the same as parsing a free-floating annotation, but with stricter rules.
pub fn parse_demand<'a>( pub fn parse_demand<'a>(
indent: IndentLevel, indent: IndentLevel,
) -> impl Parser<'a, (u32, AbilityDemand<'a>), EAbility<'a>> { ) -> impl Parser<'a, (u32, AbilityMember<'a>), EAbility<'a>> {
move |arena, state: State<'a>| { move |arena, state: State<'a>| {
let initial = state.clone(); let initial = state.clone();

View file

@ -6,8 +6,8 @@ Defs(
vars: [], vars: [],
}, },
loc_has: @5-8 Has, loc_has: @5-8 Has,
demands: [ members: [
AbilityDemand { AbilityMember {
name: @11-15 SpaceBefore( name: @11-15 SpaceBefore(
"hash", "hash",
[ [

View file

@ -6,8 +6,8 @@ Defs(
vars: [], vars: [],
}, },
loc_has: @5-8 Has, loc_has: @5-8 Has,
demands: [ members: [
AbilityDemand { AbilityMember {
name: @11-15 SpaceBefore( name: @11-15 SpaceBefore(
"hash", "hash",
[ [
@ -27,7 +27,7 @@ Defs(
), ),
), ),
}, },
AbilityDemand { AbilityMember {
name: @29-34 SpaceBefore( name: @29-34 SpaceBefore(
"hash2", "hash2",
[ [