Adds GetChildren method for boundNodes
This commit is contained in:
parent
1d6b5673d6
commit
1e7fc7629e
|
@ -36,6 +36,12 @@ namespace Upsilon.Binder
|
|||
yield return this;
|
||||
}
|
||||
|
||||
public override IEnumerable<BoundNode> GetChildren()
|
||||
{
|
||||
yield return LeftExpression;
|
||||
yield return RightExpression;
|
||||
}
|
||||
|
||||
public override Type Type { get; }
|
||||
|
||||
public BoundBinaryOperator Operator { get; }
|
||||
|
|
|
@ -43,6 +43,15 @@ namespace Upsilon.Binder
|
|||
yield return this;
|
||||
}
|
||||
|
||||
public override IEnumerable<BoundNode> GetChildren()
|
||||
{
|
||||
yield return Identifier;
|
||||
foreach (var parameter in Parameters)
|
||||
{
|
||||
yield return parameter;
|
||||
}
|
||||
}
|
||||
|
||||
public override Type Type { get; }
|
||||
}
|
||||
}
|
|
@ -1,7 +1,8 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using Upsilon.BaseTypes;
|
||||
using Upsilon.Text;
|
||||
using Type = Upsilon.BaseTypes.Type;
|
||||
|
||||
namespace Upsilon.Binder
|
||||
{
|
||||
|
@ -38,6 +39,15 @@ namespace Upsilon.Binder
|
|||
yield return this;
|
||||
}
|
||||
|
||||
public override IEnumerable<BoundNode> GetChildren()
|
||||
{
|
||||
foreach (var parameter in Parameters)
|
||||
{
|
||||
yield return parameter;
|
||||
}
|
||||
yield return Block;
|
||||
}
|
||||
|
||||
public override Type Type => Type.Function;
|
||||
public BoundScope Scope { get; set; }
|
||||
public Type ReturnType { get; }
|
||||
|
|
|
@ -33,6 +33,12 @@ namespace Upsilon.Binder
|
|||
yield return this;
|
||||
}
|
||||
|
||||
public override IEnumerable<BoundNode> GetChildren()
|
||||
{
|
||||
yield return Identifier;
|
||||
yield return Index;
|
||||
}
|
||||
|
||||
public override Type Type { get; }
|
||||
}
|
||||
|
||||
|
@ -61,6 +67,11 @@ namespace Upsilon.Binder
|
|||
yield return this;
|
||||
}
|
||||
|
||||
public override IEnumerable<BoundNode> GetChildren()
|
||||
{
|
||||
yield return Expression;
|
||||
}
|
||||
|
||||
public override Type Type { get; }
|
||||
}
|
||||
}
|
|
@ -17,6 +17,11 @@ namespace Upsilon.Binder
|
|||
yield return this;
|
||||
}
|
||||
|
||||
public override IEnumerable<BoundNode> GetChildren()
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
|
||||
public override Type Type => Value.Type;
|
||||
public ScriptType Value { get; }
|
||||
}
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using Upsilon.BaseTypes;
|
||||
using Upsilon.Binder.VariableSymbols;
|
||||
using Upsilon.Text;
|
||||
using Type = Upsilon.BaseTypes.Type;
|
||||
|
||||
namespace Upsilon.Binder
|
||||
{
|
||||
|
@ -29,6 +30,11 @@ namespace Upsilon.Binder
|
|||
yield return this;
|
||||
}
|
||||
|
||||
public override IEnumerable<BoundNode> GetChildren()
|
||||
{
|
||||
return Statements;
|
||||
}
|
||||
|
||||
public override Type Type => Type.Table;
|
||||
|
||||
|
||||
|
|
|
@ -17,6 +17,11 @@ namespace Upsilon.Binder
|
|||
yield return this;
|
||||
}
|
||||
|
||||
public override IEnumerable<BoundNode> GetChildren()
|
||||
{
|
||||
yield return InExpression;
|
||||
}
|
||||
|
||||
public override Type Type { get; }
|
||||
|
||||
public BoundUnaryExpression(BoundUnaryOperator op, BoundExpression inExpression, Type type, TextSpan span) : base(span)
|
||||
|
|
|
@ -19,6 +19,11 @@ namespace Upsilon.Binder
|
|||
yield return Variable;
|
||||
}
|
||||
|
||||
public override IEnumerable<BoundNode> GetChildren()
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
|
||||
public override Type Type => Variable.Type;
|
||||
}
|
||||
}
|
|
@ -14,5 +14,6 @@ namespace Upsilon.Binder
|
|||
public TextSpan Span { get; }
|
||||
|
||||
public abstract IEnumerable<BoundNode> GetNodeAtPosition(int linePosition, int characterPosition);
|
||||
public abstract IEnumerable<BoundNode> GetChildren();
|
||||
}
|
||||
}
|
|
@ -28,6 +28,11 @@ namespace Upsilon.Binder
|
|||
yield return this;
|
||||
}
|
||||
|
||||
public override IEnumerable<BoundNode> GetChildren()
|
||||
{
|
||||
return Statements;
|
||||
}
|
||||
|
||||
public ImmutableArray<BoundStatement> Statements { get; }
|
||||
}
|
||||
}
|
|
@ -14,5 +14,10 @@ namespace Upsilon.Binder
|
|||
{
|
||||
yield return this;
|
||||
}
|
||||
|
||||
public override IEnumerable<BoundNode> GetChildren()
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -14,6 +14,11 @@ namespace Upsilon.Binder
|
|||
|
||||
}
|
||||
|
||||
public override IEnumerable<BoundNode> GetChildren()
|
||||
{
|
||||
yield return Expression;
|
||||
}
|
||||
|
||||
public BoundExpressionStatement(BoundExpression expression, TextSpan span):base(span)
|
||||
{
|
||||
Expression = expression;
|
||||
|
|
|
@ -24,5 +24,10 @@ namespace Upsilon.Binder
|
|||
|
||||
yield return this;
|
||||
}
|
||||
|
||||
public override IEnumerable<BoundNode> GetChildren()
|
||||
{
|
||||
yield return Func;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -34,5 +34,11 @@ namespace Upsilon.Binder
|
|||
}
|
||||
yield return this;
|
||||
}
|
||||
|
||||
public override IEnumerable<BoundNode> GetChildren()
|
||||
{
|
||||
yield return BoundEnumerableExpression;
|
||||
yield return Block;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -50,6 +50,14 @@ namespace Upsilon.Binder
|
|||
yield return this;
|
||||
}
|
||||
|
||||
public override IEnumerable<BoundNode> GetChildren()
|
||||
{
|
||||
yield return Condition;
|
||||
yield return Block;
|
||||
if (NextElseIf != null) yield return NextElseIf;
|
||||
if (ElseStatement != null) yield return ElseStatement;
|
||||
}
|
||||
|
||||
public BoundExpressionStatement Condition { get; }
|
||||
public BoundBlockStatement Block { get; }
|
||||
public BoundIfStatement NextElseIf { get; }
|
||||
|
@ -75,5 +83,10 @@ namespace Upsilon.Binder
|
|||
}
|
||||
yield return this;
|
||||
}
|
||||
|
||||
public override IEnumerable<BoundNode> GetChildren()
|
||||
{
|
||||
yield return Block;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -26,5 +26,10 @@ namespace Upsilon.Binder
|
|||
|
||||
yield return this;
|
||||
}
|
||||
|
||||
public override IEnumerable<BoundNode> GetChildren()
|
||||
{
|
||||
yield return Assignment;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -39,5 +39,13 @@ namespace Upsilon.Binder
|
|||
yield return boundNode;
|
||||
yield return this;
|
||||
}
|
||||
|
||||
public override IEnumerable<BoundNode> GetChildren()
|
||||
{
|
||||
yield return BoundStart;
|
||||
yield return BoundStop;
|
||||
yield return BoundStep;
|
||||
yield return Block;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -19,5 +19,10 @@ namespace Upsilon.Binder
|
|||
yield return boundNode;
|
||||
yield return this;
|
||||
}
|
||||
|
||||
public override IEnumerable<BoundNode> GetChildren()
|
||||
{
|
||||
yield return Expression;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -23,6 +23,11 @@ namespace Upsilon.Binder
|
|||
foreach (var boundNode in Statement.GetNodeAtPosition(linePosition, characterPosition)) yield return boundNode;
|
||||
}
|
||||
|
||||
public override IEnumerable<BoundNode> GetChildren()
|
||||
{
|
||||
yield return Statement;
|
||||
}
|
||||
|
||||
public BoundBlockStatement Statement { get; }
|
||||
public BoundScope Scope { get; }
|
||||
}
|
||||
|
|
|
@ -26,5 +26,11 @@ namespace Upsilon.Binder
|
|||
yield return boundNode;
|
||||
yield return this;
|
||||
}
|
||||
|
||||
public override IEnumerable<BoundNode> GetChildren()
|
||||
{
|
||||
yield return TableIndexExpression;
|
||||
yield return Value;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -28,5 +28,10 @@ namespace Upsilon.Binder
|
|||
|
||||
yield return this;
|
||||
}
|
||||
|
||||
public override IEnumerable<BoundNode> GetChildren()
|
||||
{
|
||||
yield return BoundExpression;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -27,5 +27,11 @@ namespace Upsilon.Binder
|
|||
yield return boundNode;
|
||||
yield return this;
|
||||
}
|
||||
|
||||
public override IEnumerable<BoundNode> GetChildren()
|
||||
{
|
||||
yield return Condition;
|
||||
yield return Block;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -22,6 +22,11 @@ namespace Upsilon.Binder
|
|||
yield return this;
|
||||
}
|
||||
|
||||
public override IEnumerable<BoundNode> GetChildren()
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
|
||||
public override Type Type => VariableSymbol.Type;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue