Skip to content

Commit

Permalink
Merge cb88a90 into 76dea7b
Browse files Browse the repository at this point in the history
  • Loading branch information
asterite authored Sep 13, 2024
2 parents 76dea7b + cb88a90 commit ef13ab4
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
6 changes: 3 additions & 3 deletions compiler/noirc_frontend/src/ast/visitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use crate::{
InternedUnresolvedTypeData, QuotedTypeId,
},
parser::{Item, ItemKind, ParsedSubModule},
token::{CustomAtrribute, SecondaryAttribute, Tokens},
token::{CustomAttribute, SecondaryAttribute, Tokens},
ParsedModule, QuotedType,
};

Expand Down Expand Up @@ -461,7 +461,7 @@ pub trait Visitor {
true
}

fn visit_custom_attribute(&mut self, _: &CustomAtrribute, _target: AttributeTarget) {}
fn visit_custom_attribute(&mut self, _: &CustomAttribute, _target: AttributeTarget) {}
}

impl ParsedModule {
Expand Down Expand Up @@ -1377,7 +1377,7 @@ impl SecondaryAttribute {
}
}

impl CustomAtrribute {
impl CustomAttribute {
pub fn accept(&self, target: AttributeTarget, visitor: &mut impl Visitor) {
visitor.visit_custom_attribute(self, target);
}
Expand Down
4 changes: 2 additions & 2 deletions compiler/noirc_frontend/src/elaborator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use crate::{
DefinitionKind, DependencyId, ExprId, FuncId, FunctionModifiers, GlobalId, ReferenceId,
TraitId, TypeAliasId,
},
token::CustomAtrribute,
token::CustomAttribute,
Shared, Type, TypeVariable,
};
use crate::{
Expand Down Expand Up @@ -800,7 +800,7 @@ impl<'context> Elaborator<'context> {
let attributes = func.secondary_attributes().iter();
let attributes =
attributes.filter_map(|secondary_attribute| secondary_attribute.as_custom());
let attributes: Vec<CustomAtrribute> = attributes.cloned().collect();
let attributes: Vec<CustomAttribute> = attributes.cloned().collect();

let meta = FuncMeta {
name: name_ident,
Expand Down
4 changes: 2 additions & 2 deletions compiler/noirc_frontend/src/hir_def/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::graph::CrateId;
use crate::hir::def_map::LocalModuleId;
use crate::macros_api::{BlockExpression, StructId};
use crate::node_interner::{ExprId, NodeInterner, TraitId, TraitImplId};
use crate::token::CustomAtrribute;
use crate::token::CustomAttribute;
use crate::{ResolvedGeneric, Type};

/// A Hir function is a block expression with a list of statements.
Expand Down Expand Up @@ -167,7 +167,7 @@ pub struct FuncMeta {
pub self_type: Option<Type>,

/// Custom attributes attached to this function.
pub custom_attributes: Vec<CustomAtrribute>,
pub custom_attributes: Vec<CustomAttribute>,
}

#[derive(Debug, Clone)]
Expand Down
6 changes: 3 additions & 3 deletions compiler/noirc_frontend/src/lexer/lexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ mod tests {
use iter_extended::vecmap;

use super::*;
use crate::token::{CustomAtrribute, FunctionAttribute, SecondaryAttribute, TestScope};
use crate::token::{CustomAttribute, FunctionAttribute, SecondaryAttribute, TestScope};

#[test]
fn test_single_double_char() {
Expand Down Expand Up @@ -818,7 +818,7 @@ mod tests {
let token = lexer.next_token().unwrap();
assert_eq!(
token.token(),
&Token::Attribute(Attribute::Secondary(SecondaryAttribute::Custom(CustomAtrribute {
&Token::Attribute(Attribute::Secondary(SecondaryAttribute::Custom(CustomAttribute {
contents: "custom(hello)".to_string(),
span: Span::from(0..16),
contents_span: Span::from(2..15)
Expand Down Expand Up @@ -916,7 +916,7 @@ mod tests {
let token = lexer.next_token().unwrap();
assert_eq!(
token.token(),
&Token::InnerAttribute(SecondaryAttribute::Custom(CustomAtrribute {
&Token::InnerAttribute(SecondaryAttribute::Custom(CustomAttribute {
contents: "something".to_string(),
span: Span::from(0..13),
contents_span: Span::from(3..12),
Expand Down
10 changes: 5 additions & 5 deletions compiler/noirc_frontend/src/lexer/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@ impl Attribute {
["varargs"] => Attribute::Secondary(SecondaryAttribute::Varargs),
tokens => {
tokens.iter().try_for_each(|token| validate(token))?;
Attribute::Secondary(SecondaryAttribute::Custom(CustomAtrribute {
Attribute::Secondary(SecondaryAttribute::Custom(CustomAttribute {
contents: word.to_owned(),
span,
contents_span,
Expand Down Expand Up @@ -910,15 +910,15 @@ pub enum SecondaryAttribute {
ContractLibraryMethod,
Export,
Field(String),
Custom(CustomAtrribute),
Custom(CustomAttribute),
Abi(String),

/// A variable-argument comptime function.
Varargs,
}

impl SecondaryAttribute {
pub(crate) fn as_custom(&self) -> Option<&CustomAtrribute> {
pub(crate) fn as_custom(&self) -> Option<&CustomAttribute> {
if let Self::Custom(attribute) = self {
Some(attribute)
} else {
Expand Down Expand Up @@ -959,15 +959,15 @@ impl fmt::Display for SecondaryAttribute {
}

#[derive(PartialEq, Eq, Hash, Debug, Clone, PartialOrd, Ord)]
pub struct CustomAtrribute {
pub struct CustomAttribute {
pub contents: String,
// The span of the entire attribute, including leading `#[` and trailing `]`
pub span: Span,
// The span for the attribute contents (what's inside `#[...]`)
pub contents_span: Span,
}

impl CustomAtrribute {
impl CustomAttribute {
fn name(&self) -> Option<String> {
let mut lexer = Lexer::new(&self.contents);
let token = lexer.next()?.ok()?;
Expand Down
4 changes: 2 additions & 2 deletions tooling/lsp/src/requests/completion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use noirc_frontend::{
macros_api::{ModuleDefId, NodeInterner},
node_interner::ReferenceId,
parser::{Item, ItemKind, ParsedSubModule},
token::CustomAtrribute,
token::CustomAttribute,
ParsedModule, StructType, Type,
};
use sort_text::underscore_sort_text;
Expand Down Expand Up @@ -1434,7 +1434,7 @@ impl<'a> Visitor for NodeFinder<'a> {
false
}

fn visit_custom_attribute(&mut self, attribute: &CustomAtrribute, target: AttributeTarget) {
fn visit_custom_attribute(&mut self, attribute: &CustomAttribute, target: AttributeTarget) {
if self.byte_index != attribute.contents_span.end() as usize {
return;
}
Expand Down

0 comments on commit ef13ab4

Please sign in to comment.