Author: bryanduxbury
Date: Thu Aug 12 01:48:51 2010
New Revision: 984628

URL: http://svn.apache.org/viewvc?rev=984628&view=rev
Log:
THRIFT-570. Thrift compiler does not error when duplicate method names are 
present

This patch causes the compiler to throw an exception when duplicate method 
names are found.

Patch: Bruce Simpson

Modified:
    incubator/thrift/trunk/compiler/cpp/src/parse/t_service.h

Modified: incubator/thrift/trunk/compiler/cpp/src/parse/t_service.h
URL: 
http://svn.apache.org/viewvc/incubator/thrift/trunk/compiler/cpp/src/parse/t_service.h?rev=984628&r1=984627&r2=984628&view=diff
==============================================================================
--- incubator/thrift/trunk/compiler/cpp/src/parse/t_service.h (original)
+++ incubator/thrift/trunk/compiler/cpp/src/parse/t_service.h Thu Aug 12 
01:48:51 2010
@@ -44,6 +44,12 @@ class t_service : public t_type {
   }
 
   void add_function(t_function* func) {
+    std::vector<t_function*>::const_iterator iter;
+    for (iter = functions_.begin(); iter != functions_.end(); iter++) {
+      if (func->get_name() == (*iter)->get_name()) {
+        throw "Function " + func->get_name() + " is already defined";
+      }
+    }
     functions_.push_back(func);
   }
 


Reply via email to