Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(274)

Unified Diff: Source/bindings/scripts/IDLParser.pm

Issue 14244017: Make length property return useful values for DOM bindings functions (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Replace [Optional] by optional Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/bindings/scripts/CodeGeneratorV8.pm ('k') | Source/bindings/tests/results/V8Float64Array.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
« no previous file with comments | « Source/bindings/scripts/CodeGeneratorV8.pm ('k') | Source/bindings/tests/results/V8Float64Array.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698