Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Remove macros_api module #6190

Merged
merged 2 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions compiler/noirc_driver/src/abi_gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@ use noirc_abi::{
use noirc_frontend::ast::{Signedness, Visibility};
use noirc_frontend::{
hir::Context,
hir_def::{expr::HirArrayLiteral, function::Param, stmt::HirPattern, types::Type},
macros_api::{HirExpression, HirLiteral},
hir_def::{
expr::{HirArrayLiteral, HirExpression, HirLiteral},
function::Param,
stmt::HirPattern,
types::Type,
},
node_interner::{FuncId, NodeInterner},
};
use noirc_frontend::{TypeBinding, TypeVariableKind};
Expand Down
5 changes: 3 additions & 2 deletions compiler/noirc_frontend/src/ast/expression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ use crate::ast::{
UnresolvedTraitConstraint, UnresolvedType, UnresolvedTypeData, Visibility,
};
use crate::hir::def_collector::errors::DefCollectorErrorKind;
use crate::macros_api::StructId;
use crate::node_interner::{ExprId, InternedExpressionKind, InternedStatementKind, QuotedTypeId};
use crate::node_interner::{
ExprId, InternedExpressionKind, InternedStatementKind, QuotedTypeId, StructId,
};
use crate::token::{Attributes, FunctionAttribute, Token, Tokens};
use crate::{Kind, Type};
use acvm::{acir::AcirField, FieldElement};
Expand Down
8 changes: 5 additions & 3 deletions compiler/noirc_frontend/src/ast/statement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ use super::{
BlockExpression, ConstructorExpression, Expression, ExpressionKind, GenericTypeArgs,
IndexExpression, ItemVisibility, MemberAccessExpression, MethodCallExpression, UnresolvedType,
};
use crate::ast::UnresolvedTypeData;
use crate::elaborator::types::SELF_TYPE_NAME;
use crate::lexer::token::SpannedToken;
use crate::macros_api::{NodeInterner, SecondaryAttribute, UnresolvedTypeData};
use crate::node_interner::{InternedExpressionKind, InternedPattern, InternedStatementKind};
use crate::node_interner::{
InternedExpressionKind, InternedPattern, InternedStatementKind, NodeInterner,
};
use crate::parser::{ParserError, ParserErrorReason};
use crate::token::Token;
use crate::token::{SecondaryAttribute, Token};

/// This is used when an identifier fails to parse in the parser.
/// Instead of failing the parse, we can often recover using this
Expand Down
2 changes: 1 addition & 1 deletion compiler/noirc_frontend/src/ast/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ use crate::ast::{
BlockExpression, Expression, FunctionReturnType, Ident, NoirFunction, Path, UnresolvedGenerics,
UnresolvedType,
};
use crate::macros_api::SecondaryAttribute;
use crate::node_interner::TraitId;
use crate::token::SecondaryAttribute;

use super::{Documented, GenericTypeArgs, ItemVisibility};

Expand Down
10 changes: 4 additions & 6 deletions compiler/noirc_frontend/src/elaborator/comptime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use iter_extended::vecmap;
use noirc_errors::{Location, Span};

use crate::{
ast::Documented,
ast::{Documented, Expression, ExpressionKind},
hir::{
comptime::{Interpreter, InterpreterError, Value},
def_collector::{
Expand All @@ -19,13 +19,11 @@ use crate::{
def_map::{LocalModuleId, ModuleId},
resolution::errors::ResolverError,
},
hir_def::expr::HirIdent,
hir_def::expr::{HirExpression, HirIdent},
lexer::Lexer,
macros_api::{
Expression, ExpressionKind, HirExpression, NodeInterner, SecondaryAttribute, StructId,
},
node_interner::{DefinitionKind, DependencyId, FuncId, TraitId},
node_interner::{DefinitionKind, DependencyId, FuncId, NodeInterner, StructId, TraitId},
parser::{self, TopLevelStatement, TopLevelStatementKind},
token::SecondaryAttribute,
Type, TypeBindings, UnificationError,
};

Expand Down
14 changes: 6 additions & 8 deletions compiler/noirc_frontend/src/elaborator/expressions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ use rustc_hash::FxHashSet as HashSet;

use crate::{
ast::{
ArrayLiteral, ConstructorExpression, IfExpression, InfixExpression, Lambda, UnaryOp,
UnresolvedTypeData, UnresolvedTypeExpression,
ArrayLiteral, BlockExpression, CallExpression, CastExpression, ConstructorExpression,
Expression, ExpressionKind, Ident, IfExpression, IndexExpression, InfixExpression, Lambda,
Literal, MemberAccessExpression, MethodCallExpression, PrefixExpression, StatementKind,
UnaryOp, UnresolvedTypeData, UnresolvedTypeExpression,
},
hir::{
comptime::{self, InterpreterError},
Expand All @@ -17,16 +19,12 @@ use crate::{
expr::{
HirArrayLiteral, HirBinaryOp, HirBlockExpression, HirCallExpression, HirCastExpression,
HirConstructorExpression, HirExpression, HirIfExpression, HirIndexExpression,
HirInfixExpression, HirLambda, HirMemberAccess, HirMethodCallExpression,
HirInfixExpression, HirLambda, HirLiteral, HirMemberAccess, HirMethodCallExpression,
HirPrefixExpression,
},
stmt::HirStatement,
traits::TraitConstraint,
},
macros_api::{
BlockExpression, CallExpression, CastExpression, Expression, ExpressionKind, HirLiteral,
HirStatement, Ident, IndexExpression, Literal, MemberAccessExpression,
MethodCallExpression, PrefixExpression, StatementKind,
},
node_interner::{DefinitionKind, ExprId, FuncId, InternedStatementKind, TraitMethodId},
token::Tokens,
Kind, QuotedType, Shared, StructType, Type,
Expand Down
9 changes: 5 additions & 4 deletions compiler/noirc_frontend/src/elaborator/lints.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
use crate::{
ast::{FunctionKind, Ident},
ast::{FunctionKind, Ident, NoirFunction, Signedness, UnaryOp, Visibility},
graph::CrateId,
hir::{
resolution::errors::{PubPosition, ResolverError},
type_check::TypeCheckError,
},
hir_def::{expr::HirIdent, function::FuncMeta},
macros_api::{
HirExpression, HirLiteral, NodeInterner, NoirFunction, Signedness, UnaryOp, Visibility,
hir_def::{
expr::{HirExpression, HirIdent, HirLiteral},
function::FuncMeta,
},
node_interner::NodeInterner,
node_interner::{DefinitionKind, ExprId, FuncId, FunctionModifiers},
Type,
};
Expand Down
52 changes: 19 additions & 33 deletions compiler/noirc_frontend/src/elaborator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,56 +3,42 @@ use std::{
rc::Rc,
};

use crate::ast::ItemVisibility;
use crate::{
ast::{FunctionKind, GenericTypeArgs, UnresolvedTraitConstraint},
ast::{
BlockExpression, FunctionKind, GenericTypeArgs, Ident, NoirFunction, NoirStruct, Param,
Path, Pattern, TraitBound, UnresolvedGeneric, UnresolvedGenerics,
UnresolvedTraitConstraint, UnresolvedTypeData,
},
graph::CrateId,
hir::{
def_collector::dc_crate::{
filter_literal_globals, CompilationError, ImplMap, UnresolvedGlobal, UnresolvedStruct,
UnresolvedTypeAlias,
filter_literal_globals, CompilationError, ImplMap, UnresolvedFunctions,
UnresolvedGlobal, UnresolvedStruct, UnresolvedTraitImpl, UnresolvedTypeAlias,
},
def_map::DefMaps,
def_collector::{dc_crate::CollectedItems, errors::DefCollectorErrorKind},
def_map::{DefMaps, ModuleData},
def_map::{LocalModuleId, ModuleDefId, ModuleId, MAIN_FUNCTION},
resolution::errors::ResolverError,
resolution::import::PathResolution,
scope::ScopeForest as GenericScopeForest,
type_check::{generics::TraitGenerics, TypeCheckError},
Context,
},
hir_def::traits::TraitImpl,
hir_def::{
expr::{HirCapturedVar, HirIdent},
function::FunctionBody,
function::{FuncMeta, FunctionBody, HirFunction},
traits::TraitConstraint,
types::{Generics, Kind, ResolvedGeneric},
},
macros_api::{
BlockExpression, Ident, NodeInterner, NoirFunction, NoirStruct, Pattern,
SecondaryAttribute, StructId,
},
node_interner::{
DefinitionKind, DependencyId, ExprId, FuncId, FunctionModifiers, GlobalId, ReferenceId,
TraitId, TypeAliasId,
DefinitionKind, DependencyId, ExprId, FuncId, FunctionModifiers, GlobalId, NodeInterner,
ReferenceId, StructId, TraitId, TraitImplId, TypeAliasId,
},
token::CustomAttribute,
token::{CustomAttribute, SecondaryAttribute},
Shared, Type, TypeVariable,
};
use crate::{
ast::{TraitBound, UnresolvedGeneric, UnresolvedGenerics},
graph::CrateId,
hir::{
def_collector::{dc_crate::CollectedItems, errors::DefCollectorErrorKind},
def_map::{LocalModuleId, ModuleDefId, ModuleId, MAIN_FUNCTION},
resolution::import::PathResolution,
Context,
},
hir_def::function::{FuncMeta, HirFunction},
macros_api::{Param, Path, UnresolvedTypeData},
node_interner::TraitImplId,
};
use crate::{
hir::{
def_collector::dc_crate::{UnresolvedFunctions, UnresolvedTraitImpl},
def_map::ModuleData,
},
hir_def::traits::TraitImpl,
macros_api::ItemVisibility,
};

mod comptime;
mod expressions;
Expand Down
7 changes: 4 additions & 3 deletions compiler/noirc_frontend/src/elaborator/patterns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@ use noirc_errors::{Location, Span};
use rustc_hash::FxHashSet as HashSet;

use crate::{
ast::{TypePath, UnresolvedType, ERROR_IDENT},
ast::{
Expression, ExpressionKind, Ident, Path, Pattern, TypePath, UnresolvedType, ERROR_IDENT,
},
hir::{
def_collector::dc_crate::CompilationError,
resolution::errors::ResolverError,
type_check::{Source, TypeCheckError},
},
hir_def::{
expr::{HirIdent, HirMethodReference, ImplKind},
expr::{HirExpression, HirIdent, HirMethodReference, ImplKind},
stmt::HirPattern,
},
macros_api::{Expression, ExpressionKind, HirExpression, Ident, Path, Pattern},
node_interner::{DefinitionId, DefinitionKind, ExprId, FuncId, GlobalId, TraitImplKind},
ResolvedGeneric, Shared, StructType, Type, TypeBindings,
};
Expand Down
6 changes: 2 additions & 4 deletions compiler/noirc_frontend/src/elaborator/scope.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
use noirc_errors::{Location, Spanned};

use crate::ast::{PathKind, ERROR_IDENT};
use crate::ast::{Ident, Path, PathKind, ERROR_IDENT};
use crate::hir::def_map::{LocalModuleId, ModuleId};
use crate::hir::resolution::import::{PathResolution, PathResolutionResult};
use crate::hir::resolution::path_resolver::{PathResolver, StandardPathResolver};
use crate::hir::scope::{Scope as GenericScope, ScopeTree as GenericScopeTree};
use crate::macros_api::Ident;
use crate::{
hir::{
def_map::{ModuleDefId, TryFromModuleDefId},
Expand All @@ -15,8 +14,7 @@ use crate::{
expr::{HirCapturedVar, HirIdent},
traits::Trait,
},
macros_api::{Path, StructId},
node_interner::{DefinitionId, TraitId},
node_interner::{DefinitionId, StructId, TraitId},
Shared, StructType,
};
use crate::{Type, TypeAlias};
Expand Down
7 changes: 3 additions & 4 deletions compiler/noirc_frontend/src/elaborator/statements.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ use noirc_errors::{Location, Span, Spanned};
use crate::{
ast::{
AssignStatement, BinaryOpKind, ConstrainKind, ConstrainStatement, Expression,
ExpressionKind, InfixExpression, LValue,
ExpressionKind, ForLoopStatement, ForRange, InfixExpression, LValue, LetStatement, Path,
Statement, StatementKind,
},
hir::{
resolution::errors::ResolverError,
Expand All @@ -13,11 +14,9 @@ use crate::{
expr::HirIdent,
stmt::{
HirAssignStatement, HirConstrainStatement, HirForStatement, HirLValue, HirLetStatement,
HirStatement,
},
},
macros_api::{
ForLoopStatement, ForRange, HirStatement, LetStatement, Path, Statement, StatementKind,
},
node_interner::{DefinitionId, DefinitionKind, GlobalId, StmtId},
Type,
};
Expand Down
3 changes: 1 addition & 2 deletions compiler/noirc_frontend/src/elaborator/trait_impls.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use crate::{
ast::UnresolvedTypeExpression,
ast::{Ident, UnresolvedType, UnresolvedTypeData, UnresolvedTypeExpression},
graph::CrateId,
hir::def_collector::{dc_crate::UnresolvedTraitImpl, errors::DefCollectorErrorKind},
macros_api::{Ident, UnresolvedType, UnresolvedTypeData},
node_interner::TraitImplId,
ResolvedGeneric,
};
Expand Down
10 changes: 4 additions & 6 deletions compiler/noirc_frontend/src/elaborator/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@ use noirc_errors::{Location, Span};

use crate::{
ast::{
FunctionKind, TraitItem, UnresolvedGeneric, UnresolvedGenerics, UnresolvedTraitConstraint,
BlockExpression, FunctionDefinition, FunctionKind, FunctionReturnType, Ident,
ItemVisibility, NoirFunction, TraitItem, UnresolvedGeneric, UnresolvedGenerics,
UnresolvedTraitConstraint, UnresolvedType,
},
hir::{def_collector::dc_crate::UnresolvedTrait, type_check::TypeCheckError},
hir_def::{function::Parameters, traits::TraitFunction},
macros_api::{
BlockExpression, FunctionDefinition, FunctionReturnType, Ident, ItemVisibility,
NodeInterner, NoirFunction, UnresolvedType,
},
node_interner::{FuncId, ReferenceId, TraitId},
node_interner::{FuncId, NodeInterner, ReferenceId, TraitId},
Kind, ResolvedGeneric, Type, TypeBindings, TypeVariableKind,
};

Expand Down
19 changes: 9 additions & 10 deletions compiler/noirc_frontend/src/elaborator/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ use rustc_hash::FxHashMap as HashMap;

use crate::{
ast::{
AsTraitPath, BinaryOpKind, GenericTypeArgs, IntegerBitSize, UnresolvedGeneric,
UnresolvedGenerics, UnresolvedTypeExpression,
AsTraitPath, BinaryOpKind, GenericTypeArgs, Ident, IntegerBitSize, Path, PathKind,
Signedness, UnaryOp, UnresolvedGeneric, UnresolvedGenerics, UnresolvedType,
UnresolvedTypeData, UnresolvedTypeExpression,
},
hir::{
comptime::{Interpreter, Value},
Expand All @@ -22,20 +23,18 @@ use crate::{
},
hir_def::{
expr::{
HirBinaryOp, HirCallExpression, HirMemberAccess, HirMethodReference,
HirPrefixExpression,
HirBinaryOp, HirCallExpression, HirExpression, HirLiteral, HirMemberAccess,
HirMethodReference, HirPrefixExpression,
},
function::{FuncMeta, Parameters},
stmt::HirStatement,
traits::{NamedType, TraitConstraint},
},
macros_api::{
HirExpression, HirLiteral, HirStatement, Ident, NodeInterner, Path, PathKind,
SecondaryAttribute, Signedness, UnaryOp, UnresolvedType, UnresolvedTypeData,
},
node_interner::{
DefinitionKind, DependencyId, ExprId, FuncId, GlobalId, ImplSearchErrorKind, TraitId,
TraitImplKind, TraitMethodId,
DefinitionKind, DependencyId, ExprId, FuncId, GlobalId, ImplSearchErrorKind, NodeInterner,
TraitId, TraitImplKind, TraitMethodId,
},
token::SecondaryAttribute,
Generics, Kind, ResolvedGeneric, Type, TypeBinding, TypeBindings, TypeVariable,
TypeVariableKind, UnificationError,
};
Expand Down
2 changes: 1 addition & 1 deletion compiler/noirc_frontend/src/elaborator/unquote.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::{
macros_api::Path,
ast::Path,
token::{SpannedToken, Token, Tokens},
};

Expand Down
3 changes: 1 addition & 2 deletions compiler/noirc_frontend/src/hir/comptime/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ use crate::{
UnresolvedTypeData,
},
hir_def::traits::TraitConstraint,
macros_api::NodeInterner,
node_interner::InternedStatementKind,
node_interner::{InternedStatementKind, NodeInterner},
token::{Keyword, Token},
Type,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ use crate::ast::{
UnresolvedType, UnresolvedTypeData, UnresolvedTypeExpression,
};
use crate::ast::{ConstrainStatement, Expression, Statement, StatementKind};
use crate::hir_def::expr::{HirArrayLiteral, HirBlockExpression, HirExpression, HirIdent};
use crate::hir_def::expr::{
HirArrayLiteral, HirBlockExpression, HirExpression, HirIdent, HirLiteral,
};
use crate::hir_def::stmt::{HirLValue, HirPattern, HirStatement};
use crate::hir_def::types::{Type, TypeBinding};
use crate::macros_api::HirLiteral;
use crate::node_interner::{ExprId, NodeInterner, StmtId};

// TODO:
Expand Down
Loading
Loading