Skip to content

Commit 15c4e6b

Browse files
hopefully REALLY added recursive var res to API
1 parent 084b687 commit 15c4e6b

File tree

15 files changed

+81
-19
lines changed

15 files changed

+81
-19
lines changed

ReCT/CodeAnalysis/Binding/Binder.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,8 @@ public static BoundGlobalScope BindGlobalScope(bool isScript, BoundGlobalScope p
169169
else
170170
{
171171
mainFunction = new FunctionSymbol("main", ImmutableArray<ParameterSymbol>.Empty, TypeSymbol.Void, null);
172+
var bbs = new BoundBlockStatement(statements.ToImmutable());
173+
mainFunction.block = bbs;
172174
}
173175
}
174176
}
@@ -209,7 +211,7 @@ public static BoundProgram BindProgram(bool isScript, BoundProgram previous, Bou
209211
var loweredBody = Lowerer.Lower(fs, body);
210212

211213
fs.scope = ((BoundBlockStatement)body).Scope;
212-
fs.block = (BoundBlockStatement)body;
214+
fs.block = body;
213215

214216
if (fs.Type != TypeSymbol.Void && !ControlFlowGraph.AllPathsReturn(loweredBody))
215217
Binder._diagnostics.ReportAllPathsMustReturn(fs.Declaration.Identifier.Location);
@@ -227,7 +229,7 @@ public static BoundProgram BindProgram(bool isScript, BoundProgram previous, Bou
227229
var loweredBody = Lowerer.Lower(function, body);
228230

229231
function.scope = ((BoundBlockStatement)body).Scope;
230-
function.block = (BoundBlockStatement)body;
232+
function.block = body;
231233

232234
if (function.Type != TypeSymbol.Void && !ControlFlowGraph.AllPathsReturn(loweredBody))
233235
Binder._diagnostics.ReportAllPathsMustReturn(function.Declaration.Identifier.Location);
@@ -244,7 +246,7 @@ public static BoundProgram BindProgram(bool isScript, BoundProgram previous, Bou
244246
var loweredBody = Lowerer.Lower(function, body);
245247

246248
function.scope = ((BoundBlockStatement)body).Scope;
247-
function.block = (BoundBlockStatement)body;
249+
function.block = body;
248250

249251
if (function.Type != TypeSymbol.Void && !ControlFlowGraph.AllPathsReturn(loweredBody))
250252
Binder._diagnostics.ReportAllPathsMustReturn(function.Declaration.Identifier.Location);

ReCT/CodeAnalysis/Binding/BoundExpression.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
namespace ReCT.CodeAnalysis.Binding
55
{
6-
internal abstract class BoundExpression : BoundNode
6+
public abstract class BoundExpression : BoundNode
77
{
88
public abstract TypeSymbol Type { get; }
99
}

ReCT/CodeAnalysis/Binding/BoundForStatement.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
namespace ReCT.CodeAnalysis.Binding
22
{
3-
internal sealed class BoundForStatement : BoundLoopStatement
3+
public sealed class BoundForStatement : BoundLoopStatement
44
{
55
public BoundForStatement(BoundStatement variable, BoundExpression condition, BoundExpression action, BoundStatement body, BoundLabel breakLabel, BoundLabel continueLabel)
66
: base(breakLabel, continueLabel)

ReCT/CodeAnalysis/Binding/BoundFromToStatement.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace ReCT.CodeAnalysis.Binding
44
{
5-
internal sealed class BoundFromToStatement : BoundLoopStatement
5+
public sealed class BoundFromToStatement : BoundLoopStatement
66
{
77
public BoundFromToStatement(VariableSymbol variable, BoundExpression lowerBound, BoundExpression upperBound, BoundStatement body, BoundLabel breakLabel, BoundLabel continueLabel)
88
: base(breakLabel, continueLabel)

ReCT/CodeAnalysis/Binding/BoundIfStatement.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
namespace ReCT.CodeAnalysis.Binding
22
{
3-
internal sealed class BoundIfStatement : BoundStatement
3+
public sealed class BoundIfStatement : BoundStatement
44
{
55
public BoundIfStatement(BoundExpression condition, BoundStatement thenStatement, BoundStatement elseStatement)
66
{

ReCT/CodeAnalysis/Binding/BoundLabel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
namespace ReCT.CodeAnalysis.Binding
22
{
3-
internal sealed class BoundLabel
3+
public sealed class BoundLabel
44
{
55
internal BoundLabel(string name)
66
{

ReCT/CodeAnalysis/Binding/BoundLoopStatement.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
namespace ReCT.CodeAnalysis.Binding
22
{
3-
internal abstract class BoundLoopStatement : BoundStatement
3+
public abstract class BoundLoopStatement : BoundStatement
44
{
55
protected BoundLoopStatement(BoundLabel breakLabel, BoundLabel continueLabel)
66
{

ReCT/CodeAnalysis/Binding/BoundTryCatchStatement.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
namespace ReCT.CodeAnalysis.Binding
22
{
3-
internal sealed class BoundTryCatchStatement : BoundStatement
3+
public sealed class BoundTryCatchStatement : BoundStatement
44
{
55
public BoundTryCatchStatement(BoundStatement normalStatement, BoundStatement exceptionStatement)
66
{

ReCT/CodeAnalysis/Binding/BoundWhileStatement.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
namespace ReCT.CodeAnalysis.Binding
22
{
3-
internal sealed class BoundWhileStatement : BoundLoopStatement
3+
public sealed class BoundWhileStatement : BoundLoopStatement
44
{
55
public BoundWhileStatement(BoundExpression condition, BoundStatement body, BoundLabel breakLabel, BoundLabel continueLabel)
66
: base(breakLabel, continueLabel)

ReCT/CodeAnalysis/Symbols/FunctionSymbol.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ public sealed class FunctionSymbol : Symbol
2626
public ImmutableArray<ParameterSymbol> Parameters { get; }
2727
public TypeSymbol Type { get; }
2828
public ReCT.CodeAnalysis.Binding.BoundScope scope;
29-
public ReCT.CodeAnalysis.Binding.BoundBlockStatement block;
29+
public ReCT.CodeAnalysis.Binding.BoundStatement block;
3030
}
3131
}

0 commit comments

Comments
 (0)