https://bugs.webkit.org/show_bug.cgi?id=108565
Patch by Nils Barth <nbarth@google.com> on 2013-01-31
Reviewed by Kentaro Hara.
Since legacy code generators (CodeGenerator{CPP,GObject,ObjC}.pm)
do not support enumerations, add test to skip attributes of enum type.
This lets us remove #if macro from enum in test file and not need
these in future.
Also minor associated code cleaning:
auxiliary variable: $type = $attribute->signature->type.
Test: bindings/scripts/test/TestObj.idl (run-bindings-test)
* bindings/scripts/CodeGeneratorCPP.pm:
(SkipAttribute):
* bindings/scripts/CodeGeneratorGObject.pm:
(SkipAttribute):
* bindings/scripts/CodeGeneratorObjC.pm:
(SkipAttribute):
* bindings/scripts/test/TestObj.idl: remove #if macro
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@141541
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2013-01-31 Nils Barth <nbarth@google.com>
+
+ [CPP,GObject,ObjC] Add 'enum' skip to CodeGenerator{CPP,GObject,ObjC}.pm
+ https://bugs.webkit.org/show_bug.cgi?id=108565
+
+ Reviewed by Kentaro Hara.
+
+ Since legacy code generators (CodeGenerator{CPP,GObject,ObjC}.pm)
+ do not support enumerations, add test to skip attributes of enum type.
+ This lets us remove #if macro from enum in test file and not need
+ these in future.
+ Also minor associated code cleaning:
+ auxiliary variable: $type = $attribute->signature->type.
+
+ Test: bindings/scripts/test/TestObj.idl (run-bindings-test)
+
+ * bindings/scripts/CodeGeneratorCPP.pm:
+ (SkipAttribute):
+ * bindings/scripts/CodeGeneratorGObject.pm:
+ (SkipAttribute):
+ * bindings/scripts/CodeGeneratorObjC.pm:
+ (SkipAttribute):
+ * bindings/scripts/test/TestObj.idl: remove #if macro
+
2013-01-31 Kent Tamura <tkent@chromium.org>
Refactoring: Remove the default argument value for Node::setFocus
sub SkipAttribute
{
my $attribute = shift;
+ my $type = $attribute->signature->type;
return 1 if $attribute->signature->extendedAttributes->{"Custom"}
or $attribute->signature->extendedAttributes->{"CustomGetter"};
- return 1 if $attribute->signature->type =~ /Constructor$/;
+ return 1 if $type =~ /Constructor$/;
- return 1 if $codeGenerator->IsTypedArrayType($attribute->signature->type);
+ return 1 if $codeGenerator->IsTypedArrayType($type);
- if ($codeGenerator->GetArrayType($attribute->signature->type)) {
+ if ($codeGenerator->GetArrayType($type)) {
return 1;
}
- if ($codeGenerator->GetSequenceType($attribute->signature->type)) {
+ if ($codeGenerator->GetSequenceType($type)) {
return 1;
}
- $codeGenerator->AssertNotSequenceType($attribute->signature->type);
+ if ($codeGenerator->IsEnumType($type)) {
+ return 1;
+ }
+
+ $codeGenerator->AssertNotSequenceType($type);
# FIXME: This is typically used to add script execution state arguments to the method.
# These functions will not compile with the C++ bindings as is, so disable them
return 1;
}
+ if ($codeGenerator->IsEnumType($propType)) {
+ return 1;
+ }
+
# This is for DOMWindow.idl location attribute
if ($attribute->signature->name eq "location") {
return 1;
sub SkipAttribute
{
my $attribute = shift;
+ my $type = $attribute->signature->type;
- $codeGenerator->AssertNotSequenceType($attribute->signature->type);
- return 1 if $codeGenerator->GetArrayType($attribute->signature->type);
- return 1 if $codeGenerator->IsTypedArrayType($attribute->signature->type);
+ $codeGenerator->AssertNotSequenceType($type);
+ return 1 if $codeGenerator->GetArrayType($type);
+ return 1 if $codeGenerator->IsTypedArrayType($type);
+ return 1 if $codeGenerator->IsEnumType($type);
# This is for DynamicsCompressorNode.idl
if ($attribute->signature->name eq "release") {
// This IDL file is for testing the bindings code generator and for tracking
// changes in its ouput.
-#if defined(TESTING_JS) || defined(TESTING_V8)
enum TestEnumType { "", "EnumValue1", "EnumValue2", "EnumValue3" };
-#endif
[
Constructor(in [Callback] TestCallback testCallback),
static readonly attribute long staticReadOnlyLongAttr;
static attribute DOMString staticStringAttr;
static readonly attribute TestSubObjConstructor TestSubObj;
- attribute TestEnumType enumAttr;
#endif
+ attribute TestEnumType enumAttr;
attribute short shortAttr;
attribute unsigned short unsignedShortAttr;
attribute long longAttr;