コード例 #1
0
        public override IAstNode VisitRepl([NotNull] ReplContext context)
        {
            var children = from child in context.children
                           select child.Accept(this);

            return(new RootNode(context.GetSourceSpan( ), children));
        }
コード例 #2
0
ファイル: ReplContextFactory.cs プロジェクト: wbennett/sharpy
        public static ReplContext NewInstance(IActivationStrategy <ReplContext> strategy)
        {
            if (strategy == null)
            {
                throw new InvalidOperationException("Activation strategy cannot be null.");
            }

            var engine = Container.GetInstance()
                         .Kernel.Get <ScriptEngine>();

            var ctx = new ReplContext()
            {
                Id      = Guid.NewGuid(),
                Session = engine.CreateSession()
            };

            strategy.Activate(ctx);
            return(ctx);
        }