2019-02-13 17:10:39 +00:00
|
|
|
using System.Collections;
|
2018-11-16 13:46:12 +00:00
|
|
|
using System.Collections.Generic;
|
2018-12-14 17:48:53 +00:00
|
|
|
using Upsilon.Evaluator;
|
2018-11-25 18:30:18 +00:00
|
|
|
using Upsilon.Text;
|
2018-11-16 13:46:12 +00:00
|
|
|
|
2018-11-11 17:12:42 +00:00
|
|
|
namespace Upsilon.Binder
|
|
|
|
{
|
2018-11-12 15:21:59 +00:00
|
|
|
public class BoundScript : BoundStatement
|
2018-11-11 17:12:42 +00:00
|
|
|
{
|
2018-12-14 17:48:53 +00:00
|
|
|
public Script Script { get; }
|
2019-01-16 22:57:42 +00:00
|
|
|
|
2018-12-14 17:48:53 +00:00
|
|
|
public BoundScript(BoundBlockStatement statement, TextSpan span, BoundScope scope, string fileName, Script script) : base(span)
|
2018-11-11 17:12:42 +00:00
|
|
|
{
|
|
|
|
Statement = statement;
|
2018-11-27 17:38:28 +00:00
|
|
|
Scope = scope;
|
2018-12-07 13:51:02 +00:00
|
|
|
FileName = fileName;
|
2018-12-14 17:48:53 +00:00
|
|
|
Script = script;
|
2018-11-11 17:12:42 +00:00
|
|
|
}
|
|
|
|
|
2018-12-07 13:51:02 +00:00
|
|
|
public string FileName { get; set; }
|
2018-11-11 17:12:42 +00:00
|
|
|
public override BoundKind Kind => BoundKind.BoundScript;
|
|
|
|
|
2019-01-17 12:56:53 +00:00
|
|
|
public override IEnumerable<BoundNode> GetChildren()
|
|
|
|
{
|
|
|
|
yield return Statement;
|
|
|
|
}
|
|
|
|
|
2018-11-16 13:46:12 +00:00
|
|
|
public BoundBlockStatement Statement { get; }
|
2018-11-27 17:38:28 +00:00
|
|
|
public BoundScope Scope { get; }
|
2019-02-13 15:29:58 +00:00
|
|
|
|
|
|
|
internal override void Evaluate(EvaluationScope scope, Diagnostics diagnostics, ref EvaluationState state)
|
|
|
|
{
|
|
|
|
Statement.Evaluate(scope, diagnostics, ref state);
|
|
|
|
}
|
2019-02-13 17:10:39 +00:00
|
|
|
|
|
|
|
internal override IEnumerator EvaluateCoroutine(EvaluationScope scope, Diagnostics diagnostics, EvaluationState state)
|
|
|
|
{
|
|
|
|
return Statement.EvaluateCoroutine(scope, diagnostics, state);
|
|
|
|
}
|
2018-11-11 17:12:42 +00:00
|
|
|
}
|
|
|
|
}
|