Ejemplo n.º 1
0
        public Expression <Func <object, ExecutionContext, object> > CompileInitializer(InitializerNode parseTree, string initializerName)
        {
            if (parseTree == null)
            {
                throw new ArgumentNullException("parseTree");
            }

            ParameterExpression    self             = Expression.Parameter(typeof(object), "self");
            ParameterExpression    executionContext = Expression.Parameter(typeof(ExecutionContext), "executionContext");
            RootCompilationContext context          = new RootCompilationContext(this, this.GlobalScope, this.ReservedScope, self, executionContext, new ParameterExpression[0], null, initializerName);
            InitializerVisitor     visitor          = new InitializerVisitor(context, initializerName);
            Expression <Func <object, ExecutionContext, object> > code = parseTree.Accept(visitor);

            return(code);
        }
 private InitializerCompilationResult Compile(SmalltalkRuntime runtime, BindingScope globalScope, BindingScope reservedScope)
 {
     InitializerVisitor visitor = new InitializerVisitor(runtime, globalScope, reservedScope);
     var code = this.ParseTree.Accept(visitor);
     return new InitializerCompilationResult(code, visitor.BindingRestrictions);
 }