From eb1473089bfe9105b3884a490edafeb561df935e Mon Sep 17 00:00:00 2001 From: Joe George Date: Thu, 3 Dec 2015 09:45:09 -0500 Subject: ICE-6897 - Add delegate metadata The "delegate" metadata tag can be applied to interfaces with one operation. In C++ they are mapped to std::function's, in C# delegates. In Java we still generate a interface with one operation, which is a FunctionalInterface. --- cpp/src/Slice/CsUtil.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'cpp/src/Slice/CsUtil.cpp') diff --git a/cpp/src/Slice/CsUtil.cpp b/cpp/src/Slice/CsUtil.cpp index ac8f3d05e57..d02f8bdfd13 100644 --- a/cpp/src/Slice/CsUtil.cpp +++ b/cpp/src/Slice/CsUtil.cpp @@ -1179,7 +1179,7 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out, << "> e__ = " << param << ".GetEnumerator();"; out << nl << "while(e__.MoveNext())"; out << sb; - string func = (builtin->kind() == Builtin::KindObject || + string func = (builtin->kind() == Builtin::KindObject || builtin->kind() == Builtin::KindValue) ? "writeObject" : "writeProxy"; out << nl << stream << '.' << func << "(e__.Current);"; out << eb; @@ -2639,5 +2639,19 @@ Slice::CsGenerator::MetaDataVisitor::validate(const ContainedPtr& cont) _history.insert(s); } } + + if(_history.count(s) == 0) + { + if(s == "delegate") + { + ClassDefPtr cl = ClassDefPtr::dynamicCast(cont); + if(cl && cl->isDelegate()) + { + continue; + } + emitWarning(cont->file(), cont->line(), msg + " `" + s + "'"); + _history.insert(s); + } + } } } -- cgit v1.2.3