1*2fe1ca3dSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*2fe1ca3dSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*2fe1ca3dSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*2fe1ca3dSAndrew Rist * distributed with this work for additional information 6*2fe1ca3dSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*2fe1ca3dSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*2fe1ca3dSAndrew Rist * "License"); you may not use this file except in compliance 9*2fe1ca3dSAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*2fe1ca3dSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*2fe1ca3dSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*2fe1ca3dSAndrew Rist * software distributed under the License is distributed on an 15*2fe1ca3dSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*2fe1ca3dSAndrew Rist * KIND, either express or implied. See the License for the 17*2fe1ca3dSAndrew Rist * specific language governing permissions and limitations 18*2fe1ca3dSAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*2fe1ca3dSAndrew Rist *************************************************************/ 21*2fe1ca3dSAndrew Rist 22*2fe1ca3dSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_idlc.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include "sal/config.h" 28cdf0e10cSrcweir 29cdf0e10cSrcweir #include "idlc/astmember.hxx" 30cdf0e10cSrcweir #include "idlc/astoperation.hxx" 31cdf0e10cSrcweir #include "idlc/astservice.hxx" 32cdf0e10cSrcweir #include "idlc/asttype.hxx" 33cdf0e10cSrcweir checkLastConstructor() const34cdf0e10cSrcweirbool AstService::checkLastConstructor() const { 35cdf0e10cSrcweir AstOperation const * last = static_cast< AstOperation const * >(getLast()); 36cdf0e10cSrcweir for (DeclList::const_iterator i(getIteratorBegin()); i != getIteratorEnd(); 37cdf0e10cSrcweir ++i) 38cdf0e10cSrcweir { 39cdf0e10cSrcweir if (*i != last && (*i)->getNodeType() == NT_operation) { 40cdf0e10cSrcweir AstOperation const * ctor = static_cast< AstOperation * >(*i); 41cdf0e10cSrcweir if (ctor->isVariadic() && last->isVariadic()) { 42cdf0e10cSrcweir return true; 43cdf0e10cSrcweir } 44cdf0e10cSrcweir sal_uInt32 n = ctor->nMembers(); 45cdf0e10cSrcweir if (n == last->nMembers()) { 46cdf0e10cSrcweir for (DeclList::const_iterator i1(ctor->getIteratorBegin()), 47cdf0e10cSrcweir i2(last->getIteratorBegin()); 48cdf0e10cSrcweir i1 != ctor->getIteratorEnd(); ++i1, ++i2) 49cdf0e10cSrcweir { 50cdf0e10cSrcweir sal_Int32 r1; 51cdf0e10cSrcweir AstDeclaration const * t1 = deconstructAndResolveTypedefs( 52cdf0e10cSrcweir static_cast< AstMember * >(*i1)->getType(), &r1); 53cdf0e10cSrcweir sal_Int32 r2; 54cdf0e10cSrcweir AstDeclaration const * t2 = deconstructAndResolveTypedefs( 55cdf0e10cSrcweir static_cast< AstMember * >(*i2)->getType(), &r2); 56cdf0e10cSrcweir if (r1 != r2 || t1->getScopedName() != t2->getScopedName()) 57cdf0e10cSrcweir { 58cdf0e10cSrcweir return false; 59cdf0e10cSrcweir } 60cdf0e10cSrcweir } 61cdf0e10cSrcweir return true; 62cdf0e10cSrcweir } 63cdf0e10cSrcweir } 64cdf0e10cSrcweir } 65cdf0e10cSrcweir return false; 66cdf0e10cSrcweir } 67