Index: Source/bindings/scripts/IDLParser.pm |
diff --git a/Source/bindings/scripts/IDLParser.pm b/Source/bindings/scripts/IDLParser.pm |
index c61f6adfdb390449e11c806db769a8edf0ef6cdb..3a2af0110a4617622a00026649b81730512db926 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 |
}); |
@@ -373,7 +374,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); |
@@ -1138,6 +1139,11 @@ sub parseAttributeRest |
$self->assertTokenType($token, IdentifierToken); |
$newDataNode->signature->name($token->value()); |
$self->assertTokenValue($self->getToken(), ";", __LINE__); |
+ # CustomConstructor may also be used on attributes. |
+ if (defined $extendedAttributeList->{"CustomConstructors"}) { |
+ delete $extendedAttributeList->{"CustomConstructors"}; |
+ $extendedAttributeList->{"CustomConstructor"} = "VALUE_IS_MISSING"; |
+ } |
$newDataNode->signature->extendedAttributes($extendedAttributeList); |
return $newDataNode; |
} |
@@ -1497,6 +1503,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}; |
} |
@@ -1583,7 +1596,7 @@ sub parseExtendedAttributeRest |
return $attrs; |
} |
- if ($name eq "Constructor") { |
+ if ($name eq "Constructor" || $name eq "CustomConstructor") { |
$attrs->{$name} = []; |
} else { |
$attrs->{$name} = "VALUE_IS_MISSING"; |
@@ -2178,6 +2191,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); |
} |