Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
LPeter1997 committed Oct 28, 2024
1 parent 2e22ffe commit d66be23
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
12 changes: 8 additions & 4 deletions src/Draco.Compiler/Internal/FlowAnalysis/CompleteFlowAnalysis.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ public static void AnalyzeFunction(SourceFunctionSymbol symbol, DiagnosticBag di
}

/// <summary>
/// Analyzes a global value.
/// Analyzes a global field.
/// </summary>
/// <param name="symbol">The symbol to analyze.</param>
/// <param name="diagnostics">The diagnostics to report errors to.</param>
public static void AnalyzeValue(SourceFieldSymbol symbol, DiagnosticBag diagnostics)
public static void AnalyzeField(SourceFieldSymbol symbol, DiagnosticBag diagnostics)
{
if (symbol.Value is null)
{
Expand All @@ -63,8 +63,12 @@ public static void AnalyzeValue(SourceFieldSymbol symbol, DiagnosticBag diagnost
symbol.Value.Accept(analysis);
}

// TODO: Copypasta from SourceFieldSymbol
public static void AnalyzeValue(SourceAutoPropertySymbol symbol, DiagnosticBag diagnostics)
/// <summary>
/// Analyzes a global property.
/// </summary>
/// <param name="symbol">The symbol to analyze.</param>
/// <param name="diagnostics">The diagnostics to report errors to.</param>
public static void AnalyzeProperty(SourceAutoPropertySymbol symbol, DiagnosticBag diagnostics)
{
if (symbol.Value is null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ public override void VisitField(FieldSymbol fieldSymbol)
}
}

// TODO: Copypasta from VisitField
public override void VisitProperty(PropertySymbol propertySymbol)
{
// TODO: Not flexible, won't work for non-auto props
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public override void Bind(IBinderProvider binderProvider)
this.BindTypeAndValueIfNeeded(binderProvider);

// Flow analysis
CompleteFlowAnalysis.AnalyzeValue(this, binderProvider.DiagnosticBag);
CompleteFlowAnalysis.AnalyzeProperty(this, binderProvider.DiagnosticBag);
}

private (TypeSymbol Type, BoundExpression? Value) BindTypeAndValueIfNeeded(IBinderProvider binderProvider)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public override void Bind(IBinderProvider binderProvider)
this.BindTypeAndValueIfNeeded(binderProvider);

// Flow analysis
CompleteFlowAnalysis.AnalyzeValue(this, binderProvider.DiagnosticBag);
CompleteFlowAnalysis.AnalyzeField(this, binderProvider.DiagnosticBag);
}

private (TypeSymbol Type, BoundExpression? Value) BindTypeAndValueIfNeeded(IBinderProvider binderProvider)
Expand Down

0 comments on commit d66be23

Please sign in to comment.