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 using namespace ::rtl
;
26 FeDeclarator::FeDeclarator(const OString
& name
, DeclaratorType declType
, AstDeclaration
* pComplPart
)
27 : m_pComplexPart(pComplPart
)
29 , m_declType(declType
)
33 FeDeclarator::~FeDeclarator()
37 bool FeDeclarator::checkType(AstDeclaration
const * type
)
40 sal_Int32 count
= m_name
.lastIndexOf( ':' );
42 tmp
= m_name
.copy( count
+1 );
44 if (tmp
== type
->getLocalName())
50 AstType
const * FeDeclarator::compose(AstDeclaration
const * pDecl
)
58 if ( !pDecl
->isType() )
60 idlc()->error()->noTypeError(pDecl
);
63 pType
= (AstType
*)pDecl
;
64 if (m_declType
== FD_simple
|| m_pComplexPart
== NULL
)
67 return NULL
; // return through this statement should not happen
70 FeInheritanceHeader::FeInheritanceHeader(
71 NodeType nodeType
, OString
* pName
, OString
* pInherits
,
72 std::vector
< OString
> * typeParameters
)
73 : m_nodeType(nodeType
)
77 if (typeParameters
!= 0) {
78 m_typeParameters
= *typeParameters
;
80 initializeInherits(pInherits
);
83 void FeInheritanceHeader::initializeInherits(OString
* pInherits
)
87 AstScope
* pScope
= idlc()->scopes()->topNonNull();
88 AstDeclaration
* pDecl
= pScope
->lookupByName(*pInherits
);
91 AstDeclaration
const * resolved
= resolveTypedefs(pDecl
);
92 if ( resolved
->getNodeType() == getNodeType()
93 && (resolved
->getNodeType() != NT_interface
94 || static_cast< AstInterface
const * >(
95 resolved
)->isDefined()) )
97 if ( idlc()->error()->checkPublished( pDecl
) )
104 idlc()->error()->inheritanceError(
105 getNodeType(), getName(), pDecl
);
110 idlc()->error()->lookupError(*pInherits
);
115 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */