Save module dependencies in script, so we can easily read these
This commit is contained in:
parent
e78ad21d0e
commit
11092c11ff
|
@ -69,7 +69,7 @@ namespace Upsilon.Binder
|
|||
variable.ResultType = resultType;
|
||||
}
|
||||
_unboundFunctions = new Dictionary<string, UnboundFunctionExpression>();
|
||||
return new BoundScript((BoundBlockStatement) bound, e.Span, Scope, fileName);
|
||||
return new BoundScript((BoundBlockStatement) bound, e.Span, Scope, fileName, _script);
|
||||
}
|
||||
|
||||
private BoundStatement BindStatement(StatementSyntax s)
|
||||
|
@ -256,6 +256,8 @@ namespace Upsilon.Binder
|
|||
{
|
||||
var moduleName = be.Value.ToString();
|
||||
var module = _script.Options.ModuleHandler.GetModule(_script, moduleName);
|
||||
if (!_script.ModuleDependencies.Contains(moduleName))
|
||||
_script.ModuleDependencies.Add(moduleName);
|
||||
if (module == null)
|
||||
{
|
||||
var fullPath = Path.GetFullPath(_script.Options.ScriptLoader.ModulesPath);
|
||||
|
|
|
@ -1,15 +1,19 @@
|
|||
using System.Collections.Generic;
|
||||
using Upsilon.Evaluator;
|
||||
using Upsilon.Text;
|
||||
|
||||
namespace Upsilon.Binder
|
||||
{
|
||||
public class BoundScript : BoundStatement
|
||||
{
|
||||
public BoundScript(BoundBlockStatement statement, TextSpan span, BoundScope scope, string fileName) : base(span)
|
||||
public Script Script { get; }
|
||||
|
||||
public BoundScript(BoundBlockStatement statement, TextSpan span, BoundScope scope, string fileName, Script script) : base(span)
|
||||
{
|
||||
Statement = statement;
|
||||
Scope = scope;
|
||||
FileName = fileName;
|
||||
Script = script;
|
||||
}
|
||||
|
||||
public string FileName { get; set; }
|
||||
|
|
|
@ -25,6 +25,7 @@ namespace Upsilon.Evaluator
|
|||
public Diagnostics Diagnostics { get; }
|
||||
private Binder.Binder Binder { get; }
|
||||
private EvaluationScope Scope { get; }
|
||||
public List<string> ModuleDependencies { get; } = new List<string>();
|
||||
|
||||
internal Script(string scriptString, string fileName, ScriptOptions options )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue