Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
bd21de41
Kaydet (Commit)
bd21de41
authored
Kas 22, 2013
tarafından
Stephan Bergmann
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix unoidl sourceprovider polystruct argument checks
Change-Id: Ib7ee3188b87b9b4216214b65347e34970e1b92a5
üst
add28638
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
30 deletions
+42
-30
polystruct.tests
idlc/test/parser/polystruct.tests
+5
-0
sourceprovider-parser.y
unoidl/source/sourceprovider-parser.y
+37
-30
No files found.
idlc/test/parser/polystruct.tests
Dosyayı görüntüle @
bd21de41
...
...
@@ -133,6 +133,11 @@ struct Struct1<T> { long member; };
struct Struct2 { Struct1<Struct2> member; };
EXPECT SUCCESS "polystruct.tests 25a":
struct Struct<T> { long member; };
interface X { [attribute] Struct<X> member; };
EXPECT FAILURE "polystruct.tests 26":
struct Struct1<T> { long member; };
struct Struct2<T> { long member; };
...
...
unoidl/source/sourceprovider-parser.y
Dosyayı görüntüle @
bd21de41
...
...
@@ -802,6 +802,7 @@ Found findEntity(
}
}
bool checkTypeArgument(
YYLTYPE location, yyscan_t yyscanner,
unoidl::detail::SourceProviderType const & type)
...
...
@@ -817,11 +818,33 @@ bool checkTypeArgument(
location, yyscanner,
"bad instantiated polymorphic struct type argument");
return false;
case unoidl::detail::SourceProviderType::TYPE_SEQUENCE:
return checkTypeArgument(location, yyscanner, type.subtypes.front());
default:
return true;
}
}
bool checkInstantiatedPolymorphicStructTypeArgument(
unoidl::detail::SourceProviderType const & type, OUString const & name)
{
if (type.type
== unoidl::detail::SourceProviderType::TYPE_INSTANTIATED_POLYMORPHIC_STRUCT)
{
for (std::vector<unoidl::detail::SourceProviderType>::const_iterator i(
type.subtypes.begin());
i != type.subtypes.end(); ++i)
{
if (checkInstantiatedPolymorphicStructTypeArgument(*i, name)
|| i->getName() == name) // no need to worry about typedef
{
return true;
}
}
}
return false;
}
std::vector<OUString> annotations(bool deprecated) {
std::vector<OUString> ann;
if (deprecated) {
...
...
@@ -1161,16 +1184,7 @@ typeParameters:
pad(getCurrentPad<unoidl::detail::SourceProviderPolymorphicStructTypeTemplateEntityPad>(
data));
OUString id(convertName($3));
if (nameHasSameIdentifierAs(data->currentName, id)) {
error(
@3, yyscanner,
("polymorphic struct type template " + data->currentName
+ " type parameter " + id
+ " has same unqualified identifer as the type itself"));
YYERROR;
}
if (std::find(
pad->typeParameters.begin(), pad->typeParameters.end(), id)
if (std::find(pad->typeParameters.begin(), pad->typeParameters.end(), id)
!= pad->typeParameters.end())
{
error(
...
...
@@ -1189,14 +1203,6 @@ typeParameters:
pad(getCurrentPad<unoidl::detail::SourceProviderPolymorphicStructTypeTemplateEntityPad>(
data));
OUString id(convertName($1));
if (nameHasSameIdentifierAs(data->currentName, id)) {
error(
@1, yyscanner,
("polymorphic struct type template " + data->currentName
+ " type parameter " + id
+ " has same unqualified identifer as the type itself"));
YYERROR;
}
assert(pad->typeParameters.empty());
pad->typeParameters.push_back(id);
}
...
...
@@ -1288,13 +1294,25 @@ structMember:
default:
break;
}
if (t.getName() == data->currentName) { // no need to worry about typedefs
if (t.type != unoidl::detail::SourceProviderType::TYPE_PARAMETER
&& t.getName() == data->currentName) // no need to worry about typedef
{
error(
@2, yyscanner,
("struct/exception type " + data->currentName + " direct member "
+ id + " has same type as the type itself"));
YYERROR;
}
if (checkInstantiatedPolymorphicStructTypeArgument(t, data->currentName))
{
error(
@2, yyscanner,
("struct/exception type " + data->currentName + " direct member "
+ id
+ (" has instantiated polymorphic struct type that uses the type"
" itself as an argument")));
YYERROR;
}
if (nameHasSameIdentifierAs(data->currentName, id)) {
error(
@3, yyscanner,
...
...
@@ -1382,17 +1400,6 @@ structMember:
p2 = dynamic_cast<unoidl::detail::SourceProviderPolymorphicStructTypeTemplateEntityPad *>(
ent->pad.get());
if (p2 != 0) {
if (std::find(
p2->typeParameters.begin(), p2->typeParameters.end(), id)
!= p2->typeParameters.end())
{
error(
@3, yyscanner,
("polymorphic struct type template " + data->currentName
+ " direct member " + id
+ " has same identifier as a type parameter"));
YYERROR;
}
for (std::vector<unoidl::PolymorphicStructTypeTemplateEntity::Member>::iterator i(
p2->members.begin());
i != p2->members.end(); ++i)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment