private static void WriteArrayIndexerExpression(LanguageWriter w, IArrayIndexerExpression exp) { w.WriteExpression(exp.Target); w.Write("["); w.WriteExpressionCollection(exp.Indices); w.Write("]"); }
private static void WriteExpression(LanguageWriter w, IExpressionStatement state) { w.WriteExpression(state.Expression); if (w.SkipWriteLine) { return; } w.Write(";"); w.WriteLine(); }
private static void WriteTryCatchFinally_catch(LanguageWriter w, ICatchClause clause) { w.Write(" "); w.WriteKeyword("catch"); // 特別な場合 catch(...) を検出 // → clauseBody を改変 // clauseBody は StatementAnalyze の時点で改変する様にした bool catchAll = clause.Condition is StatementAnalyze.IsCatchAll; IStatementCollection clause_body = clause.Body == null?null:clause.Body.Statements; TypeRef var_type = new TypeRef(clause.Variable.VariableType); /* * if(var_type.IsObject&&clause.Condition!=null) { * ISnippetExpression iSnippent=clause.Condition as ISnippetExpression; * if(iSnippent!=null&&iSnippent.Value=="?"&&StatementAnalyze.IsCatchAllClause(ref clause_body)){ * catchAll=true; * } * } * //*/ if (catchAll) { w.Write(" (...)"); } else { if (clause.Variable.Name.Length != 0 || !var_type.IsObject) { w.scope.RegisterVariable(clause.Variable, false); w.Write(" ("); var_type.WriteNameWithRef(w); w.Write(" "); w.WriteDeclaration(clause.Variable.Name); w.Write(")"); } if (clause.Condition != null) { w.Write(" "); w.WriteKeyword("when"); w.Write(" "); w.Write("("); w.WriteExpression(clause.Condition); w.Write(")"); } } w.Write(" {"); w.WriteLine(); w.WriteIndent(); if (clause_body != null) { for (int num = 0; num < clause_body.Count; num++) { IStatement statement3 = clause_body[num]; #if EXTRA_TEMP #warning catch: "コンストラクタの中で、最後の一行で、throw" の場合は書き込まない? // →之は、恐らく、 constructor に function-try-statement を適用した時の話である // よって無視する if (w.SomeConstructor && num + 1 >= clause_body.Count && statement3 is IThrowExceptionStatement) { break; } #endif WriteStatement(w, statement3); } } w.WriteOutdent(); w.Write("}"); }