コード例 #1
0
ファイル: SourceGenerator.cs プロジェクト: haifenghuang/ci
 protected void Write(CiExpr expr)
 {
     if (expr is CiConstExpr)
     {
         WriteConst(((CiConstExpr)expr).Value);
     }
     else if (expr is CiConstAccess)
     {
         WriteName(((CiConstAccess)expr).Const);
     }
     else if (expr is CiVarAccess)
     {
         Write((CiVarAccess)expr);
     }
     else if (expr is CiFieldAccess)
     {
         Write((CiFieldAccess)expr);
     }
     else if (expr is CiPropertyAccess)
     {
         Write((CiPropertyAccess)expr);
     }
     else if (expr is CiArrayAccess)
     {
         Write((CiArrayAccess)expr);
     }
     else if (expr is CiMethodCall)
     {
         Write((CiMethodCall)expr);
     }
     else if (expr is CiUnaryExpr)
     {
         Write((CiUnaryExpr)expr);
     }
     else if (expr is CiCondNotExpr)
     {
         Write((CiCondNotExpr)expr);
     }
     else if (expr is CiPostfixExpr)
     {
         Write((CiPostfixExpr)expr);
     }
     else if (expr is CiBinaryExpr)
     {
         Write((CiBinaryExpr)expr);
     }
     else if (expr is CiCondExpr)
     {
         Write((CiCondExpr)expr);
     }
     else if (expr is CiBinaryResourceExpr)
     {
         Write((CiBinaryResourceExpr)expr);
     }
     else if (expr is CiNewExpr)
     {
         WriteNew(((CiNewExpr)expr).NewType);
     }
     else if (expr is CiCoercion)
     {
         Write((CiCoercion)expr);
     }
     else
     {
         throw new ArgumentException(expr.ToString());
     }
 }
コード例 #2
0
ファイル: SourceGenerator.cs プロジェクト: epi/cito
 protected void Write(CiExpr expr)
 {
     if (expr is CiConstExpr)
     WriteConst(((CiConstExpr) expr).Value);
     else if (expr is CiConstAccess)
     WriteName(((CiConstAccess) expr).Const);
     else if (expr is CiVarAccess)
     Write((CiVarAccess) expr);
     else if (expr is CiFieldAccess)
     Write((CiFieldAccess) expr);
     else if (expr is CiPropertyAccess)
     Write((CiPropertyAccess) expr);
     else if (expr is CiArrayAccess)
     Write((CiArrayAccess) expr);
     else if (expr is CiMethodCall)
     Write((CiMethodCall) expr);
     else if (expr is CiUnaryExpr)
     Write((CiUnaryExpr) expr);
     else if (expr is CiCondNotExpr)
     Write((CiCondNotExpr) expr);
     else if (expr is CiPostfixExpr)
     Write((CiPostfixExpr) expr);
     else if (expr is CiBinaryExpr)
     Write((CiBinaryExpr) expr);
     else if (expr is CiCondExpr)
     Write((CiCondExpr) expr);
     else if (expr is CiBinaryResourceExpr)
     Write((CiBinaryResourceExpr) expr);
     else if (expr is CiNewExpr)
     WriteNew(((CiNewExpr) expr).NewType);
     else if (expr is CiCoercion)
     Write((CiCoercion) expr);
     else
     throw new ArgumentException(expr.ToString());
 }