Chromium Code Reviews| Index: Source/bindings/scripts/IDLParser.pm |
| diff --git a/Source/bindings/scripts/IDLParser.pm b/Source/bindings/scripts/IDLParser.pm |
| index 5337a4a270f215b5a99418cdf6ed3b459af83912..9513dca2b0c77e206b76647e0490e03499d13164 100644 |
| --- a/Source/bindings/scripts/IDLParser.pm |
| +++ b/Source/bindings/scripts/IDLParser.pm |
| @@ -49,6 +49,7 @@ struct( domInterface => { |
| attributes => '@', # List of 'domAttribute' |
| extendedAttributes => '$', # Extended attributes |
| constructors => '@', # Constructors, list of 'domFunction' |
| + customConstructors => '@', # Custom constructors, list of 'domFunction' |
| isException => '$', # Used for exception interfaces |
| }); |
| @@ -375,7 +376,7 @@ sub applyTypedefs |
| foreach my $attribute (@{$definition->attributes}) { |
| $self->applyTypedefsForSignature($attribute->signature); |
| } |
| - foreach my $function (@{$definition->functions}, @{$definition->constructors}) { |
| + foreach my $function (@{$definition->functions}, @{$definition->constructors}, @{$definition->customConstructors}) { |
| $self->applyTypedefsForSignature($function->signature); |
| foreach my $signature (@{$function->parameters}) { |
| $self->applyTypedefsForSignature($signature); |
| @@ -1149,6 +1150,11 @@ sub parseAttributeRest |
| $self->assertTokenType($token, IdentifierToken); |
| $newDataNode->signature->name($token->value()); |
| $self->assertTokenValue($self->getToken(), ";", __LINE__); |
| + # CustomConstructor may also be used on attributes. |
|
haraken
2013/04/16 11:58:27
Where can it happen?
do-not-use
2013/04/16 12:02:23
It is used in DOMWindow.idl for:
[CustomConstructo
haraken
2013/04/16 12:05:44
ah....
Actually I do want to remove the [CustomCo
|
| + if (defined $extendedAttributeList->{"CustomConstructors"}) { |
| + delete $extendedAttributeList->{"CustomConstructors"}; |
| + $extendedAttributeList->{"CustomConstructor"} = "VALUE_IS_MISSING"; |
| + } |
| $newDataNode->signature->extendedAttributes($extendedAttributeList); |
| return $newDataNode; |
| } |
| @@ -1516,6 +1522,13 @@ sub copyExtendedAttributes |
| foreach my $constructor (@constructors) { |
| push(@{$extendedAttributeList->{"Constructors"}}, $constructor); |
| } |
| + } elsif ($key eq "CustomConstructor") { |
| + push(@{$extendedAttributeList->{"CustomConstructors"}}, $attr->{$key}); |
| + } elsif ($key eq "CustomConstructors") { |
| + my @customConstructors = @{$attr->{$key}}; |
| + foreach my $customConstructor (@customConstructors) { |
| + push(@{$extendedAttributeList->{"CustomConstructors"}}, $customConstructor); |
| + } |
| } else { |
| $extendedAttributeList->{$key} = $attr->{$key}; |
| } |
| @@ -1602,7 +1615,7 @@ sub parseExtendedAttributeRest |
| return $attrs; |
| } |
| - if ($name eq "Constructor") { |
| + if ($name eq "Constructor" || $name eq "CustomConstructor") { |
| $attrs->{$name} = []; |
| } else { |
| $attrs->{$name} = "VALUE_IS_MISSING"; |
| @@ -2098,7 +2111,7 @@ sub parseInterfaceOld |
| if ($next->value() eq "interface") { |
| my $interface = domInterface->new(); |
| $self->assertTokenValue($self->getToken(), "interface", __LINE__); |
| - my $extendedAttributeList = $self->parseExtendedAttributeListAllowEmpty(); |
| + my $extendedAttributeList = $self->parseExtendedAttributeListAllowEmpty(1); |
|
haraken
2013/04/16 11:58:27
What is this change for?
do-not-use
2013/04/16 12:02:23
My bad. Forgot to remove this local change.
|
| my $token = $self->getToken(); |
| $self->assertTokenType($token, IdentifierToken); |
| $interface->name($token->value()); |
| @@ -2453,6 +2466,21 @@ sub applyExtendedAttributeList |
| $extendedAttributeList->{"NamedConstructor"} = $constructorName; |
| push(@{$interface->constructors}, $newDataNode); |
| } |
| + if (defined $extendedAttributeList->{"CustomConstructors"}) { |
| + my @customConstructorParams = @{$extendedAttributeList->{"CustomConstructors"}}; |
| + my $index = (@customConstructorParams == 1) ? 0 : 1; |
| + foreach my $param (@customConstructorParams) { |
| + my $customConstructor = domFunction->new(); |
| + $customConstructor->signature(domSignature->new()); |
| + $customConstructor->signature->name("CustomConstructor"); |
| + $customConstructor->signature->extendedAttributes($extendedAttributeList); |
| + $customConstructor->parameters($param); |
| + $customConstructor->{overloadedIndex} = $index++; |
| + push(@{$interface->customConstructors}, $customConstructor); |
| + } |
| + delete $extendedAttributeList->{"CustomConstructors"}; |
| + $extendedAttributeList->{"CustomConstructor"} = "VALUE_IS_MISSING"; |
| + } |
| $interface->extendedAttributes($extendedAttributeList); |
| } |