public Expression CompileMethod(MethodNode parseTree, SmalltalkClass cls, Expression self, Expression executionContext, Expression[] arguments) { if (parseTree == null) { throw new ArgumentNullException("parseTree"); } if (cls == null) { throw new ArgumentNullException("cls"); } if (self == null) { throw new ArgumentNullException("self"); } if (arguments == null) { throw new ArgumentNullException("arguments"); } RootCompilationContext context = this.GetCompilationContext(parseTree, cls, self, executionContext, arguments); MethodVisitor visitor = new MethodVisitor(context); Expression code = parseTree.Accept(visitor); return(code); }
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); }