public Statement CompileDraw(Function func, List <VariableScope> vscopeStack, AstDraw draw) { var method = func as Method; if (method == null || method.IsStatic || !method.DeclaringType.Methods.Contains(method)) { Log.Error(draw.Source, ErrorCode.E3222, "'draw' is not allowed in this scope because " + func.Quote() + " is not a non-static method"); return(Expression.Invalid); } var parent = method.DeclaringType as ClassType; if (parent == null || parent.IsFlattenedDefinition) { Log.Error(draw.Source, ErrorCode.E3223, "'draw' is not allowed in this scope because " + method.DeclaringType.Quote() + " is not a non-generic class"); return(Expression.Invalid); } var result = new DrawBlock(draw.Source, parent, method, FlattenVariableScopes(vscopeStack)); method.DrawBlocks.Add(result); EnqueueBlock(result, x => PopulateBlock(draw.Block, x)); _enqueuedDrawClasses.Add(method.DeclaringType); return(result.DrawScope); }
public void WriteDraw(AstDraw a) { Write(a.Source); WriteBlockMembers(a.Block.Members); }