示例#1
0
        // 匿名メソッドは、ラムダ式文法で代替する事にする。
        // 実際には、変数のキャプチャなどを行うと C++/CLI ではコンパイル出来ない。
        private static void WriteAnonymousMethod(LanguageWriter w, IAnonymousMethodExpression exp)
        {
            w.Write("[&]");
            w.WriteMethodParameterCollection(exp.Parameters);

            // 戻り型
            TypeRef return_type = new TypeRef(exp.ReturnType.Type);

            if (!return_type.IsVoid)
            {
                w.Write(" -> ");
                return_type.WriteNameWithRef(w);
            }

            // 中身
            w.PushScope();
            w.Write(" {");
            w.WriteLine();
            w.WriteIndent();
            w.WriteStatement(exp.Body);
            w.WriteOutdent();
            w.Write("}");
            w.PopScope();
        }