コード例 #1
0
        public override NodeFinderResult VisitBlockExpr(AstBlockExpr block, int i = 0)
        {
            foreach (var s in block.Statements)
            {
                if (GetRelativeLocation(s.Location, i) == RelativeLocation.Same)
                {
                    return(s.Accept(this, i));
                }
            }

            return(new NodeFinderResult(block.Scope, expr: block));
        }
コード例 #2
0
        public override string VisitBlockExpr(AstBlockExpr block, int indentLevel = 0)
        {
            var sb = new StringBuilder();

            {
                int i = 0;
                foreach (var s in block.Statements)
                {
                    if (i > 0)
                    {
                        sb.AppendLine();
                    }
                    if (s is AstConstantDeclaration c && c.Type == CheezType.Code)
                    {
                        ; // local const code in macro, dont print
                    }
コード例 #3
0
ファイル: RawAstPrinter.cs プロジェクト: CheezLang/CheezLang
        public override string VisitBlockExpr(AstBlockExpr block, int indentLevel = 0)
        {
            var sb = new StringBuilder();

            {
                int i = 0;
                foreach (var s in block.Statements)
                {
                    if (i > 0)
                    {
                        sb.AppendLine();
                    }
                    sb.Append(s.Accept(this));
                    ++i;
                }
            }

            return($"{{\n{sb.ToString().Indent(4)}\n}}".Indent(indentLevel));
        }
コード例 #4
0
 public virtual ReturnType VisitBlockExpr(AstBlockExpr expr, DataType data             = default) => default;
コード例 #5
0
 public AstWhileStmt(AstBlockExpr body, AstIdExpr label, ILocation Location = null)
     : base(Location: Location)
 {
     this.Body  = body;
     this.Label = label;
 }