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

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

Issue 16708002: Simplify Custom Element constructors to be functions, not wrappers (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 7 years, 6 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/IDLAttributes.txt ('k') | Source/bindings/tests/idls/TestObject.idl » ('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 4c01be57732207aa3c0be77db30da8fd9114a45a..444feb6a10c5dc998540e256e9fdc90f878d8ac5 100644
--- a/Source/bindings/scripts/IDLParser.pm
+++ b/Source/bindings/scripts/IDLParser.pm
@@ -35,9 +35,16 @@ use constant EmptyToken => 5;
# Used to represent a parsed IDL document
struct( idlDocument => {
- interfaces => '@', # All parsed interfaces
- enumerations => '@', # All parsed enumerations
fileName => '$', # file name
+ callbackFunctions => '@',
+ enumerations => '@', # All parsed enumerations
+ interfaces => '@', # All parsed interfaces
+});
+
+struct( callbackFunction => {
+ name => '$',
+ type => '$',
+ parameters => '@',
});
# Used to represent 'interface' blocks
@@ -209,6 +216,8 @@ sub Parse
push(@{$document->interfaces}, $definition);
} elsif (ref($definition) eq "domEnum") {
push(@{$document->enumerations}, $definition);
+ } elsif (ref($definition) eq "callbackFunction") {
+ push(@{$document->callbackFunctions}, $definition);
} else {
die "Unrecognized IDL definition kind: \"" . ref($definition) . "\"";
}
@@ -811,14 +820,17 @@ sub parseCallbackRest
my $next = $self->nextToken();
if ($next->type() == IdentifierToken) {
- $self->assertTokenType($self->getToken(), IdentifierToken);
+ my $callback = callbackFunction->new();
+ my $name = $self->getToken();
+ $self->assertTokenType($name, IdentifierToken);
+ $callback->name($name->value());
$self->assertTokenValue($self->getToken(), "=", __LINE__);
- $self->parseReturnType();
+ $callback->type($self->parseReturnType());
$self->assertTokenValue($self->getToken(), "(", __LINE__);
- $self->parseArgumentList();
+ $callback->parameters($self->parseArgumentList());
$self->assertTokenValue($self->getToken(), ")", __LINE__);
$self->assertTokenValue($self->getToken(), ";", __LINE__);
- return;
+ return $callback;
}
$self->assertUnexpectedToken($next->value(), __LINE__);
}
@@ -1339,7 +1351,7 @@ sub parseOperationRest
$newDataNode->signature(domSignature->new());
my $name = $self->parseOptionalIdentifier();
$newDataNode->signature->name($name);
- $self->assertTokenValue($self->getToken(), "(", $name, __LINE__);
+ $self->assertTokenValue($self->getToken(), "(", __LINE__);
push(@{$newDataNode->parameters}, @{$self->parseArgumentList()});
$self->assertTokenValue($self->getToken(), ")", __LINE__);
$self->assertTokenValue($self->getToken(), ";", __LINE__);
« no previous file with comments | « Source/bindings/scripts/IDLAttributes.txt ('k') | Source/bindings/tests/idls/TestObject.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698