public InjectionRuntime(IApiBridge bridge, IDebuggerServer debuggerServer, ITimeSource timeSource, Func <CancellationToken?> retrieveCancellationToken) { paths = new Paths(() => Path.GetDirectoryName(CurrentScript.FileName)); Api = new InjectionApi(bridge, Metadata, State, timeSource, paths); RegisterNatives(); this.bridge = bridge; this.debuggerServer = debuggerServer; this.timeSource = timeSource; this.retrieveCancellationToken = retrieveCancellationToken; CurrentScript = new ScriptFile("<empty>", string.Empty, null); interpreter = new ThreadLocal <Interpreter>(() => new Interpreter(Metadata, CurrentScript.FileName, debuggerServer.Create(), retrieveCancellationToken)); }
public MessageCollection Load(string content, string fileName) { var parser = new Parser(); var syntax = parser.ParseFile(content, out var errors); CurrentScript = new ScriptFile(fileName, content, syntax); interpreter = new ThreadLocal <Interpreter>(() => new Interpreter(Metadata, CurrentScript.FileName, debuggerServer.Create(), retrieveCancellationToken)); Metadata.Reset(); var collector = new DefinitionCollector(Metadata); collector.Visit(CurrentScript.Syntax); if (errors.Any()) { return(errors); } var sanityAnalyzer = new SanityAnalyzer(); return(sanityAnalyzer.Analyze(CurrentScript.Syntax, Metadata)); }
public InjectionRuntime(IApiBridge bridge, IDebuggerServer debuggerServer, ITimeSource timeSource) { interpreter = new ThreadLocal <Interpreter>(() => new Interpreter(Metadata, CurrentFileName, debuggerServer.Create())); Api = new InjectionApi(bridge, Metadata, Globals, timeSource); RegisterNatives(); }