Kaydet (Commit) 454f3f72 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Fix unoidl sourceprovider interface base and member checks

...and enable tests shared with idlc

Change-Id: I422b16c9b2636835d276cc2085cb640073894c97
üst e00562d9
......@@ -113,3 +113,65 @@ interface Derived {
[optional] interface Base1;
[optional] interface Base2;
};
EXPECT FAILURE "methodoverload.tests 10":
interface I {
[attribute] long a;
[attribute] short a;
};
EXPECT FAILURE "methodoverload.tests 11":
interface I1 {
[attribute] long a;
};
interface I2 {
[attribute] short a;
interface I1;
};
EXPECT FAILURE "methodoverload.tests 12":
interface I {
[attribute] long a;
void a();
};
EXPECT FAILURE "methodoverload.tests 13":
interface I1 {
[attribute] long a;
}
interface I2 {
void a();
interface I1;
};
EXPECT FAILURE "methodoverload.tests 14":
interface I1 {
void a();
}
interface I2 {
[attribute] long a;
interface I1;
};
EXPECT SUCCESS "methodoverload.tests 15":
interface I {
[attribute] long a;
void geta();
void seta();
};
EXPECT SUCCESS "methodoverload.tests 16":
interface I1 {
[attribute] long a;
};
interface I2: I1 {
void geta();
void seta();
};
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
$(eval $(call gb_CustomTarget_CustomTarget,unoidl/unoidl-write_test))
# this target is phony to run it every time
.PHONY : $(call gb_CustomTarget_get_target,unoidl/unoidl-write_test)
$(call gb_CustomTarget_get_target,unoidl/unoidl-write_test) : \
$(call gb_Executable_get_runtime_dependencies,unoidl-write) \
$(SRCDIR)/solenv/bin/exectest.pl \
$(SRCDIR)/idlc/test/parser/attribute.tests \
$(SRCDIR)/idlc/test/parser/constant.tests \
$(SRCDIR)/idlc/test/parser/constructor.tests \
$(SRCDIR)/idlc/test/parser/interfaceinheritance.tests \
$(SRCDIR)/idlc/test/parser/methodoverload.tests \
$(SRCDIR)/idlc/test/parser/polystruct.tests \
$(SRCDIR)/idlc/test/parser/published.tests \
$(SRCDIR)/idlc/test/parser/struct.tests \
$(SRCDIR)/idlc/test/parser/typedef.tests \
| $(call gb_CustomTarget_get_workdir,unoidl/unoidl-write_test)/.dir
$(call gb_Helper_abbreviate_dirs,( \
$(PERL) $(SRCDIR)/solenv/bin/exectest.pl \
$(SRCDIR)/idlc/test/parser/attribute.tests \
$(call gb_CustomTarget_get_workdir,unoidl/unoidl-write_test)/in.idl \
1 $(call gb_Executable_get_command,unoidl-write) $(SRCDIR)/udkapi \
{} \
$(call gb_CustomTarget_get_workdir,unoidl/unoidl-write_test)/out.rdb \
&& $(PERL) $(SRCDIR)/solenv/bin/exectest.pl \
$(SRCDIR)/idlc/test/parser/constant.tests \
$(call gb_CustomTarget_get_workdir,unoidl/unoidl-write_test)/in.idl \
1 $(call gb_Executable_get_command,unoidl-write) $(SRCDIR)/udkapi \
{} \
$(call gb_CustomTarget_get_workdir,unoidl/unoidl-write_test)/out.rdb \
&& $(PERL) $(SRCDIR)/solenv/bin/exectest.pl \
$(SRCDIR)/idlc/test/parser/constructor.tests \
$(call gb_CustomTarget_get_workdir,unoidl/unoidl-write_test)/in.idl \
1 $(call gb_Executable_get_command,unoidl-write) $(SRCDIR)/udkapi \
{} \
$(call gb_CustomTarget_get_workdir,unoidl/unoidl-write_test)/out.rdb \
&& $(PERL) $(SRCDIR)/solenv/bin/exectest.pl \
$(SRCDIR)/idlc/test/parser/interfaceinheritance.tests \
$(call gb_CustomTarget_get_workdir,unoidl/unoidl-write_test)/in.idl \
1 $(call gb_Executable_get_command,unoidl-write) $(SRCDIR)/udkapi \
{} \
$(call gb_CustomTarget_get_workdir,unoidl/unoidl-write_test)/out.rdb \
&& $(PERL) $(SRCDIR)/solenv/bin/exectest.pl \
$(SRCDIR)/idlc/test/parser/methodoverload.tests \
$(call gb_CustomTarget_get_workdir,unoidl/unoidl-write_test)/in.idl \
1 $(call gb_Executable_get_command,unoidl-write) $(SRCDIR)/udkapi \
{} \
$(call gb_CustomTarget_get_workdir,unoidl/unoidl-write_test)/out.rdb \
&& $(PERL) $(SRCDIR)/solenv/bin/exectest.pl \
$(SRCDIR)/idlc/test/parser/oldstyle.tests \
$(call gb_CustomTarget_get_workdir,unoidl/unoidl-write_test)/in.idl \
1 $(call gb_Executable_get_command,unoidl-write) $(SRCDIR)/udkapi \
{} \
$(call gb_CustomTarget_get_workdir,unoidl/unoidl-write_test)/out.rdb \
&& $(PERL) $(SRCDIR)/solenv/bin/exectest.pl \
$(SRCDIR)/idlc/test/parser/polystruct.tests \
$(call gb_CustomTarget_get_workdir,unoidl/unoidl-write_test)/in.idl \
1 $(call gb_Executable_get_command,unoidl-write) $(SRCDIR)/udkapi \
{} \
$(call gb_CustomTarget_get_workdir,unoidl/unoidl-write_test)/out.rdb \
&& $(PERL) $(SRCDIR)/solenv/bin/exectest.pl \
$(SRCDIR)/idlc/test/parser/published.tests \
$(call gb_CustomTarget_get_workdir,unoidl/unoidl-write_test)/in.idl \
1 $(call gb_Executable_get_command,unoidl-write) $(SRCDIR)/udkapi \
{} \
$(call gb_CustomTarget_get_workdir,unoidl/unoidl-write_test)/out.rdb \
&& $(PERL) $(SRCDIR)/solenv/bin/exectest.pl \
$(SRCDIR)/idlc/test/parser/struct.tests \
$(call gb_CustomTarget_get_workdir,unoidl/unoidl-write_test)/in.idl \
1 $(call gb_Executable_get_command,unoidl-write) $(SRCDIR)/udkapi \
{} \
$(call gb_CustomTarget_get_workdir,unoidl/unoidl-write_test)/out.rdb \
&& $(PERL) $(SRCDIR)/solenv/bin/exectest.pl \
$(SRCDIR)/idlc/test/parser/typedef.tests \
$(call gb_CustomTarget_get_workdir,unoidl/unoidl-write_test)/in.idl \
1 $(call gb_Executable_get_command,unoidl-write) $(SRCDIR)/udkapi \
{} \
$(call gb_CustomTarget_get_workdir,unoidl/unoidl-write_test)/out.rdb) \
> $@.log 2>&1 || (cat $@.log && false))
# vim: set noet sw=4 ts=4:
......@@ -16,6 +16,7 @@ $(eval $(call gb_Module_add_targets,unoidl, \
))
$(eval $(call gb_Module_add_targets_for_build,unoidl, \
CustomTarget_unoidl-write_test \
Executable_unoidl-check \
Executable_unoidl-write \
))
......
......@@ -14,6 +14,7 @@
#include <cassert>
#include <map>
#include <set>
#include <vector>
#include "rtl/ref.hxx"
......@@ -27,6 +28,8 @@
namespace unoidl { namespace detail {
struct SourceProviderScannerData;
class SourceProviderEntityPad: public salhelper::SimpleReferenceObject {
public:
bool isPublished() const { return published_; }
......@@ -103,41 +106,76 @@ private:
class SourceProviderInterfaceTypeEntityPad: public SourceProviderEntityPad {
public:
struct Base {
Base(
struct DirectBase {
DirectBase(
OUString const & theName,
rtl::Reference<unoidl::InterfaceTypeEntity> const & theEntity,
std::vector<OUString> const & theAnnotations):
name(theName), entity(theEntity), annotations(theAnnotations)
{}
{ assert(theEntity.is()); }
OUString name;
rtl::Reference<unoidl::InterfaceTypeEntity> entity;
std::vector<OUString> annotations;
};
SourceProviderInterfaceTypeEntityPad(
bool published, OUString singleBaseName,
rtl::Reference<unoidl::InterfaceTypeEntity> const & singleBaseEntity):
SourceProviderEntityPad(published),
singleBase(!singleBaseName.isEmpty())
{
assert(singleBaseName.isEmpty() != (bool) singleBaseEntity.is());
if (singleBase) {
mandatoryBases.push_back(
Base(
singleBaseName, singleBaseEntity, std::vector<OUString>()));
}
}
enum BaseKind {
BASE_INDIRECT_OPTIONAL, BASE_DIRECT_OPTIONAL, BASE_INDIRECT_MANDATORY,
BASE_DIRECT_MANDATORY
};
struct Member {
OUString mandatory;
std::set<OUString> optional;
explicit Member(OUString theMandatory): mandatory(theMandatory) {}
};
SourceProviderInterfaceTypeEntityPad(bool published, bool theSingleBase):
SourceProviderEntityPad(published), singleBase(theSingleBase)
{}
bool addDirectBase(
YYLTYPE location, yyscan_t yyscanner, SourceProviderScannerData * data,
DirectBase const & base, bool optional);
bool addDirectMember(
YYLTYPE location, yyscan_t yyscanner, SourceProviderScannerData * data,
OUString const & name);
bool singleBase;
std::vector<Base> mandatoryBases;
std::vector<Base> optionalBases;
std::vector<unoidl::InterfaceTypeEntity::Attribute> attributes;
std::vector<unoidl::InterfaceTypeEntity::Method> methods;
std::vector<DirectBase> directMandatoryBases;
std::vector<DirectBase> directOptionalBases;
std::vector<unoidl::InterfaceTypeEntity::Attribute> directAttributes;
std::vector<unoidl::InterfaceTypeEntity::Method> directMethods;
std::map<OUString, BaseKind> allBases;
std::map<OUString, Member> allMembers;
private:
virtual ~SourceProviderInterfaceTypeEntityPad() throw () {}
bool checkBaseClashes(
YYLTYPE location, yyscan_t yyscanner, SourceProviderScannerData * data,
OUString const & name,
rtl::Reference<unoidl::InterfaceTypeEntity> const & entity,
bool direct, bool optional, bool outerOptional,
std::set<OUString> * seen) const;
bool checkMemberClashes(
YYLTYPE location, yyscan_t yyscanner, SourceProviderScannerData * data,
OUString const & interfaceName, OUString const & memberName,
bool checkOptional) const;
bool addBase(
YYLTYPE location, yyscan_t yyscanner, SourceProviderScannerData * data,
OUString const & directBaseName, OUString const & name,
rtl::Reference<unoidl::InterfaceTypeEntity> const & entity, bool direct,
bool optional);
bool addOptionalBaseMembers(
YYLTYPE location, yyscan_t yyscanner, SourceProviderScannerData * data,
OUString const & name,
rtl::Reference<unoidl::InterfaceTypeEntity> const & entity);
};
class SourceProviderConstantGroupEntityPad: public SourceProviderEntityPad {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment