Changeset 58510 in webkit
- Timestamp:
- Apr 29, 2010 6:49:52 AM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r58507 r58510 1 2010-04-29 Xan Lopez <xlopez@igalia.com> 2 3 Reviewed by Gustavo Noronha. 4 5 [GTK] GObject DOM bindings 6 https://bugs.webkit.org/show_bug.cgi?id=33590 7 8 Do not generate unneeded boilerplate in {get,set}_property methods 9 when there are no properties to generate code for. This gets rid 10 of lots of compiler warnings. 11 12 * bindings/scripts/CodeGeneratorGObject.pm: 13 1 14 2010-04-29 Simon Hausmann <simon.hausmann@nokia.com> 2 15 -
trunk/WebCore/bindings/scripts/CodeGeneratorGObject.pm
r58345 r58510 272 272 } 273 273 274 sub GetReadableProperties { 275 my $properties = shift; 276 277 my @result = (); 278 279 foreach my $property (@{$properties}) { 280 if (!SkipAttribute($property)) { 281 push(@result, $property); 282 } 283 } 284 285 return @result; 286 } 287 288 sub GetWriteableProperties { 289 my $properties = shift; 290 my @result = (); 291 292 foreach my $property (@{$properties}) { 293 my $writeable = $property->type !~ /^readonly/; 294 my $gtype = GetGValueTypeName($property->signature->type); 295 my $hasGtypeSignature = ($gtype eq "boolean" || $gtype eq "float" || $gtype eq "double" || 296 $gtype eq "uint64" || $gtype eq "ulong" || $gtype eq "long" || 297 $gtype eq "uint" || $gtype eq "ushort" || $gtype eq "uchar" || 298 $gtype eq "char" || $gtype eq "string"); 299 if ($writeable && $hasGtypeSignature) { 300 push(@result, $property); 301 } 302 } 303 304 return @result; 305 } 306 274 307 sub GenerateProperties { 275 308 my ($object, $interfaceName, $dataNode) = @_; … … 292 325 my @txtGetProps = (); 293 326 327 my @readableProperties = GetReadableProperties($dataNode->attributes); 328 294 329 my $privFunction = GetCoreObject($interfaceName, "coreSelf", "self"); 295 330 … … 297 332 static void ${lowerCaseIfaceName}_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec* pspec) 298 333 { 334 EOF 335 push(@txtGetProps, $txtGetProp); 336 if (scalar @readableProperties > 0) { 337 $txtGetProp = << "EOF"; 299 338 ${className}* self = WEBKIT_DOM_${clsCaps}(object); 300 339 $privFunction 301 340 EOF 341 push(@txtGetProps, $txtGetProp); 342 } 343 344 $txtGetProp = << "EOF"; 302 345 switch (prop_id) { 303 346 EOF 304 347 push(@txtGetProps, $txtGetProp); 348 349 my @writeableProperties = GetWriteableProperties(\@readableProperties); 305 350 306 351 my $txtSetProps = << "EOF"; 307 352 static void ${lowerCaseIfaceName}_set_property(GObject* object, guint prop_id, const GValue* value, GParamSpec* pspec) 308 353 { 354 EOF 355 push(@txtSetProps, $txtSetProps); 356 357 if (scalar @writeableProperties > 0) { 358 $txtSetProps = << "EOF"; 309 359 ${className} *self = WEBKIT_DOM_${clsCaps}(object); 310 360 $privFunction 311 361 EOF 362 push(@txtSetProps, $txtSetProps); 363 } 364 365 $txtSetProps = << "EOF"; 312 366 switch (prop_id) { 313 367 EOF … … 317 371 # each one of them. 318 372 SKIPENUM: 319 foreach my $attribute (@{$dataNode->attributes}) { 320 if (SkipAttribute($attribute)) { 321 next SKIPENUM; 322 } 323 373 foreach my $attribute (@readableProperties) { 324 374 my $camelPropName = $attribute->signature->name; 325 375 my $setPropNameFunction = $codeGenerator->WK_ucfirst($camelPropName); … … 379 429 } 380 430 381 if ($writeable && ($gtype eq "boolean" || $gtype eq "float" || $gtype eq "double" || 382 $gtype eq "uint64" || $gtype eq "ulong" || $gtype eq "long" || 383 $gtype eq "uint" || $gtype eq "ushort" || $gtype eq "uchar" || 384 $gtype eq "char" || $gtype eq "string")) { 385 431 if (grep {$_ eq $attribute} @writeableProperties) { 386 432 push(@txtSetProps, " case ${propEnum}:\n {\n"); 387 433 push(@txtSetProps, " WebCore::ExceptionCode ec = 0;\n") if @{$attribute->setterExceptions};
Note: See TracChangeset
for help on using the changeset viewer.