LCOV - code coverage report
Current view: top level - idlc/source - fehelper.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 39 44 88.6 %
Date: 2014-11-03 Functions: 7 7 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <idlc/fehelper.hxx>
      21             : #include <idlc/errorhandler.hxx>
      22             : #include "idlc/idlc.hxx"
      23             : 
      24         514 : FeDeclarator::FeDeclarator(const OString& name, DeclaratorType declType, AstDeclaration* pComplPart)
      25             :     : m_pComplexPart(pComplPart)
      26             :     , m_name(name)
      27         514 :     , m_declType(declType)
      28             : {
      29         514 : }
      30             : 
      31         728 : FeDeclarator::~FeDeclarator()
      32             : {
      33         728 : }
      34             : 
      35         290 : bool FeDeclarator::checkType(AstDeclaration const * type)
      36             : {
      37         290 :     OString tmp(m_name);
      38         290 :     sal_Int32 count = m_name.lastIndexOf( ':' );
      39         290 :     if( count != -1 )
      40           0 :         tmp = m_name.copy( count+1 );
      41             : 
      42         290 :     if (tmp == type->getLocalName())
      43           2 :         return false;
      44             :     else
      45         288 :         return true;
      46             : }
      47             : 
      48         444 : AstType const * FeDeclarator::compose(AstDeclaration const * pDecl)
      49             : {
      50             :     const AstType*    pType;
      51             : 
      52         444 :     if ( pDecl == 0 )
      53             :     {
      54           2 :         return NULL;
      55             :     }
      56         442 :     if ( !pDecl->isType() )
      57             :     {
      58           0 :         idlc()->error()->noTypeError(pDecl);
      59           0 :         return NULL;
      60             :     }
      61         442 :     pType = static_cast<const AstType*>(pDecl);
      62         442 :     if (m_declType == FD_simple || m_pComplexPart == NULL)
      63         442 :         return pType;
      64             : 
      65           0 :     return NULL; // return through this statement should not happen
      66             : }
      67             : 
      68         820 : FeInheritanceHeader::FeInheritanceHeader(
      69             :     NodeType nodeType, OString* pName, OString* pInherits,
      70             :     std::vector< OString > * typeParameters)
      71             :     : m_nodeType(nodeType)
      72             :     , m_pName(pName)
      73         820 :     , m_pInherits(NULL)
      74             : {
      75         820 :     if (typeParameters != 0) {
      76         142 :         m_typeParameters = *typeParameters;
      77             :     }
      78         820 :     initializeInherits(pInherits);
      79         820 : }
      80             : 
      81         820 : void FeInheritanceHeader::initializeInherits(OString* pInherits)
      82             : {
      83         820 :     if ( pInherits )
      84             :     {
      85          74 :         AstScope* pScope = idlc()->scopes()->topNonNull();
      86          74 :         AstDeclaration* pDecl = pScope->lookupByName(*pInherits);
      87          74 :         if ( pDecl )
      88             :         {
      89          74 :             AstDeclaration const * resolved = resolveTypedefs(pDecl);
      90         148 :             if ( resolved->getNodeType() == getNodeType()
      91         142 :                  && (resolved->getNodeType() != NT_interface
      92          46 :                      || static_cast< AstInterface const * >(
      93          46 :                          resolved)->isDefined()) )
      94             :             {
      95          68 :                 if ( idlc()->error()->checkPublished( pDecl ) )
      96             :                 {
      97          62 :                     m_pInherits = pDecl;
      98             :                 }
      99             :             }
     100             :             else
     101             :             {
     102             :                 idlc()->error()->inheritanceError(
     103           6 :                     getNodeType(), getName(), pDecl);
     104             :             }
     105             :         }
     106             :         else
     107             :         {
     108           0 :             idlc()->error()->lookupError(*pInherits);
     109             :         }
     110             :     }
     111         820 : }
     112             : 
     113             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10