1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <idlc/fehelper.hxx>
21 #include <idlc/errorhandler.hxx>
22 #include "idlc/idlc.hxx"
24 FeDeclarator::FeDeclarator(const OString
& name
, DeclaratorType declType
, AstDeclaration
* pComplPart
)
25 : m_pComplexPart(pComplPart
)
27 , m_declType(declType
)
31 FeDeclarator::~FeDeclarator()
35 bool FeDeclarator::checkType(AstDeclaration
const * type
)
38 sal_Int32 count
= m_name
.lastIndexOf( ':' );
40 tmp
= m_name
.copy( count
+1 );
42 if (tmp
== type
->getLocalName())
48 AstType
const * FeDeclarator::compose(AstDeclaration
const * pDecl
)
56 if ( !pDecl
->isType() )
58 ErrorHandler::noTypeError(pDecl
);
61 pType
= static_cast<const AstType
*>(pDecl
);
62 if (m_declType
== FD_simple
|| m_pComplexPart
== NULL
)
65 return NULL
; // return through this statement should not happen
68 FeInheritanceHeader::FeInheritanceHeader(
69 NodeType nodeType
, OString
* pName
, OString
* pInherits
,
70 std::vector
< OString
> * typeParameters
)
71 : m_nodeType(nodeType
)
75 if (typeParameters
!= 0) {
76 m_typeParameters
= *typeParameters
;
78 initializeInherits(pInherits
);
81 void FeInheritanceHeader::initializeInherits(OString
* pInherits
)
85 AstScope
* pScope
= idlc()->scopes()->topNonNull();
86 AstDeclaration
* pDecl
= pScope
->lookupByName(*pInherits
);
89 AstDeclaration
const * resolved
= resolveTypedefs(pDecl
);
90 if ( resolved
->getNodeType() == getNodeType()
91 && (resolved
->getNodeType() != NT_interface
92 || static_cast< AstInterface
const * >(
93 resolved
)->isDefined()) )
95 if ( ErrorHandler::checkPublished( pDecl
) )
102 ErrorHandler::inheritanceError(
103 getNodeType(), getName(), pDecl
);
108 ErrorHandler::lookupError(*pInherits
);
113 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */