Skip to content

Commit 2946cc6

Browse files
committed
dsdsa
1 parent f2154a3 commit 2946cc6

File tree

2 files changed

+31
-36
lines changed

2 files changed

+31
-36
lines changed

sway-core/src/semantic_analysis/symbol_resolve.rs

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -501,11 +501,8 @@ impl ResolveSymbols for Expression {
501501
ExpressionKind::Literal(_) => {}
502502
ExpressionKind::AmbiguousPathExpression(_) => {}
503503
ExpressionKind::FunctionApplication(expr) => {
504-
let result = SymbolResolveTypeBinding::resolve_symbol(
505-
&mut expr.call_path_binding,
506-
&Handler::default(),
507-
ctx.by_ref(),
508-
);
504+
let result = expr.call_path_binding.resolve_symbol(handler, ctx.by_ref());
505+
509506
if let Ok(result) = result {
510507
expr.resolved_call_path_binding = Some(TypeBinding::<
511508
ResolvedCallPath<ParsedDeclId<FunctionDeclaration>>,
@@ -541,13 +538,11 @@ impl ResolveSymbols for Expression {
541538
.iter_mut()
542539
.for_each(|e| e.resolve_symbols(handler, ctx.by_ref())),
543540
ExpressionKind::Struct(expr) => {
544-
expr.call_path_binding
545-
.resolve_symbols(handler, ctx.by_ref());
546-
let result = SymbolResolveTypeBinding::resolve_symbol(
547-
&mut expr.call_path_binding,
548-
&Handler::default(),
549-
ctx.by_ref(),
550-
);
541+
// expr.call_path_binding
542+
// .resolve_symbols(handler, ctx.by_ref());
543+
544+
let result = expr.call_path_binding.resolve_symbol(handler, ctx.by_ref());
545+
551546
if let Ok(result) = result {
552547
expr.resolved_call_path_binding = Some(TypeBinding::<
553548
ResolvedCallPath<ParsedDeclId<StructDeclaration>>,
@@ -597,13 +592,13 @@ impl ResolveSymbols for Expression {
597592
.for_each(|arg| arg.resolve_symbols(handler, ctx.by_ref()));
598593
}
599594
ExpressionKind::Subfield(expr) => expr.prefix.resolve_symbols(handler, ctx),
600-
ExpressionKind::DelineatedPath(ref mut expr) => {
601-
expr.call_path_binding
602-
.resolve_symbols(handler, ctx.by_ref());
595+
ExpressionKind::DelineatedPath(expr) => {
596+
// expr.call_path_binding
597+
// .resolve_symbols(handler, ctx.by_ref());
603598

604-
// let result =
605-
// expr.call_path_binding
606-
// .resolve_symbol(handler, ctx.by_ref(), self.span.clone());
599+
let result =
600+
expr.call_path_binding
601+
.resolve_symbol(handler, ctx.by_ref(), self.span.clone());
607602

608603
// if let Ok(result) = result {
609604
// expr.resolved_call_path_binding = Some(TypeBinding::<

sway-core/src/type_system/ast_elements/binding.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,24 @@ impl TypeBinding<QualifiedCallPath> {
641641
}
642642
}
643643

644+
impl SymbolResolveTypeBinding<ParsedDeclId<ConstantDeclaration>> for TypeBinding<CallPath> {
645+
fn resolve_symbol(
646+
&mut self,
647+
handler: &Handler,
648+
ctx: SymbolResolveContext,
649+
) -> Result<ParsedDeclId<ConstantDeclaration>, ErrorEmitted> {
650+
// Grab the declaration.
651+
let unknown_decl = ctx
652+
.resolve_call_path_with_visibility_check(handler, &self.inner)?
653+
.expect_parsed();
654+
655+
// Check to see if this is a const declaration.
656+
let const_ref = unknown_decl.to_const_decl(handler, ctx.engines())?;
657+
658+
Ok(const_ref)
659+
}
660+
}
661+
644662
impl SymbolResolveTypeBinding<(ParsedDeclId<ConstantDeclaration>, TypeBinding<CallPath>)>
645663
for TypeBinding<QualifiedCallPath>
646664
{
@@ -737,21 +755,3 @@ impl TypeCheckTypeBinding<ty::TyConstantDecl> for TypeBinding<CallPath> {
737755
Ok((const_ref, None, None))
738756
}
739757
}
740-
741-
impl SymbolResolveTypeBinding<ParsedDeclId<ConstantDeclaration>> for TypeBinding<CallPath> {
742-
fn resolve_symbol(
743-
&mut self,
744-
handler: &Handler,
745-
ctx: SymbolResolveContext,
746-
) -> Result<ParsedDeclId<ConstantDeclaration>, ErrorEmitted> {
747-
// Grab the declaration.
748-
let unknown_decl = ctx
749-
.resolve_call_path_with_visibility_check(handler, &self.inner)?
750-
.expect_parsed();
751-
752-
// Check to see if this is a const declaration.
753-
let const_ref = unknown_decl.to_const_decl(handler, ctx.engines())?;
754-
755-
Ok(const_ref)
756-
}
757-
}

0 commit comments

Comments
 (0)