<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[208134] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/208134">208134</a></dd>
<dt>Author</dt> <dd>weinig@apple.com</dd>
<dt>Date</dt> <dd>2016-10-30 15:35:00 -0700 (Sun, 30 Oct 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>[WebIDL] Restructure IDLParser structs to better match modern WebIDL concepts
https://bugs.webkit.org/show_bug.cgi?id=164208
Reviewed by Darin Adler.
Source/WebCore:
Restructure IDLParsers structs to match modern WebIDL conventions:
- Rename structs to have more WebCore like naming, consistently using
the prefix IDL.
- Remove domSignature. Sinking it's properties into the structs that
contained it.
- Add IDLArgument, replacing the use of domSignatures for arguments.
IDLArgument is the subset of domSignatures needed for arguments.
- Rename domFunction to IDLOperation (matching WebILD nomenclature),
replace signature with its own name, type (for returnType), specials,
and extended attributes properties.
- Give IDLAttribute it's own name, type and extended attributes properties.
- Add IDLDictionaryMember, replacing the use of domSignature as the
type of members in IDLDictionary. Give it name, type, isRequired,
default and extendedAttributes properties.
- Renamed Typedef to be IDLTypedef. Remove the extended attributes
property as those are not allowed in typedefs per-PebIDL.
Also fix some parsing issues:
- Stop parsing 'in' directives in function arguments.
- Stop parsing extended attributes in typedefs.
- Support applying typedefs to types deep in aggregate types
(e.g. (sequence<(LONG or STRING)> or DOMString)?).
* bindings/scripts/CodeGenerator.pm:
* bindings/scripts/IDLParser.pm:
* bindings/scripts/generate-bindings.pl:
Update for new struct types.
* bindings/scripts/test/JS/JSTestTypedefs.cpp:
* bindings/scripts/test/TestTypedefs.idl:
Remove test which tested extended attributes in typedefs,
and add a test which tests typedefs used in deep type structures.
* page/make_settings.pl:
Don't generate the 'in' prefix for arguments in IDL files.
Tools:
* DumpRenderTree/Bindings/CodeGeneratorDumpRenderTree.pm:
* WebKitTestRunner/InjectedBundle/Bindings/CodeGeneratorTestRunner.pm:
Update for new struct types.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptsCodeGeneratorpm">trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm">trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptsIDLParserpm">trunk/Source/WebCore/bindings/scripts/IDLParser.pm</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptsgeneratebindingspl">trunk/Source/WebCore/bindings/scripts/generate-bindings.pl</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestTypedefscpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestTestTypedefsidl">trunk/Source/WebCore/bindings/scripts/test/TestTypedefs.idl</a></li>
<li><a href="#trunkSourceWebCorepagemake_settingspl">trunk/Source/WebCore/page/make_settings.pl</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsDumpRenderTreeBindingsCodeGeneratorDumpRenderTreepm">trunk/Tools/DumpRenderTree/Bindings/CodeGeneratorDumpRenderTree.pm</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleBindingsCodeGeneratorTestRunnerpm">trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/CodeGeneratorTestRunner.pm</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (208133 => 208134)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-10-30 22:33:02 UTC (rev 208133)
+++ trunk/Source/WebCore/ChangeLog        2016-10-30 22:35:00 UTC (rev 208134)
</span><span class="lines">@@ -1,3 +1,46 @@
</span><ins>+2016-10-30 Sam Weinig <sam@webkit.org>
+
+ [WebIDL] Restructure IDLParser structs to better match modern WebIDL concepts
+ https://bugs.webkit.org/show_bug.cgi?id=164208
+
+ Reviewed by Darin Adler.
+
+ Restructure IDLParsers structs to match modern WebIDL conventions:
+ - Rename structs to have more WebCore like naming, consistently using
+ the prefix IDL.
+ - Remove domSignature. Sinking it's properties into the structs that
+ contained it.
+ - Add IDLArgument, replacing the use of domSignatures for arguments.
+ IDLArgument is the subset of domSignatures needed for arguments.
+ - Rename domFunction to IDLOperation (matching WebILD nomenclature),
+ replace signature with its own name, type (for returnType), specials,
+ and extended attributes properties.
+ - Give IDLAttribute it's own name, type and extended attributes properties.
+ - Add IDLDictionaryMember, replacing the use of domSignature as the
+ type of members in IDLDictionary. Give it name, type, isRequired,
+ default and extendedAttributes properties.
+ - Renamed Typedef to be IDLTypedef. Remove the extended attributes
+ property as those are not allowed in typedefs per-PebIDL.
+
+ Also fix some parsing issues:
+ - Stop parsing 'in' directives in function arguments.
+ - Stop parsing extended attributes in typedefs.
+ - Support applying typedefs to types deep in aggregate types
+ (e.g. (sequence<(LONG or STRING)> or DOMString)?).
+
+ * bindings/scripts/CodeGenerator.pm:
+ * bindings/scripts/IDLParser.pm:
+ * bindings/scripts/generate-bindings.pl:
+ Update for new struct types.
+
+ * bindings/scripts/test/JS/JSTestTypedefs.cpp:
+ * bindings/scripts/test/TestTypedefs.idl:
+ Remove test which tested extended attributes in typedefs,
+ and add a test which tests typedefs used in deep type structures.
+
+ * page/make_settings.pl:
+ Don't generate the 'in' prefix for arguments in IDL files.
+
</ins><span class="cx"> 2016-10-30 Dave Hyatt <hyatt@apple.com>
</span><span class="cx">
</span><span class="cx"> [CSS Parser] Fix nth-child serialization
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsCodeGeneratorpm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm (208133 => 208134)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm        2016-10-30 22:33:02 UTC (rev 208133)
+++ trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm        2016-10-30 22:35:00 UTC (rev 208134)
</span><span class="lines">@@ -91,8 +91,6 @@
</span><span class="cx"> "Uint8ClampedArray" => 1,
</span><span class="cx"> );
</span><span class="cx">
</span><del>-my %nonPointerTypeHash = ( "DOMTimeStamp" => 1 );
-
</del><span class="cx"> my %svgAttributesInHTMLHash = (
</span><span class="cx"> "class" => 1,
</span><span class="cx"> "id" => 1,
</span><span class="lines">@@ -288,22 +286,6 @@
</span><span class="cx"> &$recurse($interface, $interface);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-sub FindSuperMethod
-{
- my ($object, $interface, $functionName) = @_;
- my $indexer;
- $object->ForAllParents($interface, undef, sub {
- my $currentInterface = shift;
- foreach my $function (@{$currentInterface->functions}) {
- if ($function->signature->name eq $functionName) {
- $indexer = $function->signature;
- return 'prune';
- }
- }
- });
- return $indexer;
-}
-
</del><span class="cx"> sub IDLFileForInterface
</span><span class="cx"> {
</span><span class="cx"> my $object = shift;
</span><span class="lines">@@ -332,7 +314,7 @@
</span><span class="cx">
</span><span class="cx"> my $interface = $object->ParseInterface($outerInterface, $interfaceName);
</span><span class="cx"> for my $attribute (@{$interface->attributes}) {
</span><del>- return $attribute if $attribute->signature->name eq $attributeName;
</del><ins>+ return $attribute if $attribute->name eq $attributeName;
</ins><span class="cx"> }
</span><span class="cx"> die("Could not find attribute '$attributeName' on interface '$interfaceName'.");
</span><span class="cx"> }
</span><span class="lines">@@ -395,7 +377,7 @@
</span><span class="cx"> {
</span><span class="cx"> my ($object, $type) = @_;
</span><span class="cx">
</span><del>- assert("Not a type") if ref($type) ne "domType";
</del><ins>+ assert("Not a type") if ref($type) ne "IDLType";
</ins><span class="cx">
</span><span class="cx"> return 1 if $integerTypeHash{$type->name};
</span><span class="cx"> return 1 if $floatingPointTypeHash{$type->name};
</span><span class="lines">@@ -406,7 +388,7 @@
</span><span class="cx"> {
</span><span class="cx"> my ($object, $type) = @_;
</span><span class="cx">
</span><del>- assert("Not a type") if ref($type) ne "domType";
</del><ins>+ assert("Not a type") if ref($type) ne "IDLType";
</ins><span class="cx">
</span><span class="cx"> return 1 if $object->IsStringType($type);
</span><span class="cx"> return 1 if $object->IsEnumType($type);
</span><span class="lines">@@ -417,7 +399,7 @@
</span><span class="cx"> {
</span><span class="cx"> my ($object, $type) = @_;
</span><span class="cx">
</span><del>- assert("Not a type") if ref($type) ne "domType";
</del><ins>+ assert("Not a type") if ref($type) ne "IDLType";
</ins><span class="cx">
</span><span class="cx"> return 1 if $integerTypeHash{$type->name};
</span><span class="cx"> return 0;
</span><span class="lines">@@ -427,7 +409,7 @@
</span><span class="cx"> {
</span><span class="cx"> my ($object, $type) = @_;
</span><span class="cx">
</span><del>- assert("Not a type") if ref($type) ne "domType";
</del><ins>+ assert("Not a type") if ref($type) ne "IDLType";
</ins><span class="cx">
</span><span class="cx"> return 1 if $floatingPointTypeHash{$type->name};
</span><span class="cx"> return 0;
</span><span class="lines">@@ -437,7 +419,7 @@
</span><span class="cx"> {
</span><span class="cx"> my ($object, $type) = @_;
</span><span class="cx">
</span><del>- assert("Not a type") if ref($type) ne "domType";
</del><ins>+ assert("Not a type") if ref($type) ne "IDLType";
</ins><span class="cx">
</span><span class="cx"> return 1 if $primitiveTypeHash{$type->name};
</span><span class="cx"> return 1 if $object->IsNumericType($type);
</span><span class="lines">@@ -449,7 +431,7 @@
</span><span class="cx"> {
</span><span class="cx"> my ($object, $type) = @_;
</span><span class="cx">
</span><del>- assert("Not a type") if ref($type) ne "domType";
</del><ins>+ assert("Not a type") if ref($type) ne "IDLType";
</ins><span class="cx">
</span><span class="cx"> return 1 if $type->name eq "DOMString";
</span><span class="cx"> return 1 if $type->name eq "USVString";
</span><span class="lines">@@ -460,7 +442,7 @@
</span><span class="cx"> {
</span><span class="cx"> my ($object, $type) = @_;
</span><span class="cx">
</span><del>- assert("Not a type") if ref($type) ne "domType";
</del><ins>+ assert("Not a type") if ref($type) ne "IDLType";
</ins><span class="cx">
</span><span class="cx"> return defined($object->GetEnumByType($type));
</span><span class="cx"> }
</span><span class="lines">@@ -469,7 +451,7 @@
</span><span class="cx"> {
</span><span class="cx"> my ($object, $type) = @_;
</span><span class="cx">
</span><del>- assert("Not a type") if ref($type) ne "domType";
</del><ins>+ assert("Not a type") if ref($type) ne "IDLType";
</ins><span class="cx">
</span><span class="cx"> my $name = $type->name;
</span><span class="cx">
</span><span class="lines">@@ -509,7 +491,7 @@
</span><span class="cx"> {
</span><span class="cx"> my ($object, $type) = @_;
</span><span class="cx">
</span><del>- assert("Not a type") if ref($type) ne "domType";
</del><ins>+ assert("Not a type") if ref($type) ne "IDLType";
</ins><span class="cx">
</span><span class="cx"> return $object->IsEnumType($type) && defined($cachedExternalEnumerations->{$type->name});
</span><span class="cx"> }
</span><span class="lines">@@ -518,7 +500,7 @@
</span><span class="cx"> {
</span><span class="cx"> my ($object, $type) = @_;
</span><span class="cx">
</span><del>- assert("Not a type") if ref($type) ne "domType";
</del><ins>+ assert("Not a type") if ref($type) ne "IDLType";
</ins><span class="cx">
</span><span class="cx"> return 1 if exists $enumTypeImplementationNameOverrides{$type->name};
</span><span class="cx"> return 0;
</span><span class="lines">@@ -528,7 +510,7 @@
</span><span class="cx"> {
</span><span class="cx"> my ($object, $type) = @_;
</span><span class="cx">
</span><del>- assert("Not a type") if ref($type) ne "domType";
</del><ins>+ assert("Not a type") if ref($type) ne "IDLType";
</ins><span class="cx">
</span><span class="cx"> return $enumTypeImplementationNameOverrides{$type->name};
</span><span class="cx"> }
</span><span class="lines">@@ -537,7 +519,7 @@
</span><span class="cx"> {
</span><span class="cx"> my ($object, $type) = @_;
</span><span class="cx">
</span><del>- assert("Not a type") if ref($type) ne "domType";
</del><ins>+ assert("Not a type") if ref($type) ne "IDLType";
</ins><span class="cx">
</span><span class="cx"> my $name = $type->name;
</span><span class="cx">
</span><span class="lines">@@ -576,7 +558,7 @@
</span><span class="cx"> {
</span><span class="cx"> my ($object, $type) = @_;
</span><span class="cx">
</span><del>- assert("Not a type") if ref($type) ne "domType";
</del><ins>+ assert("Not a type") if ref($type) ne "IDLType";
</ins><span class="cx">
</span><span class="cx"> return $type->name =~ /^[A-Z]/ && defined($object->GetDictionaryByType($type));
</span><span class="cx"> }
</span><span class="lines">@@ -586,7 +568,7 @@
</span><span class="cx"> {
</span><span class="cx"> my ($object, $type) = @_;
</span><span class="cx">
</span><del>- assert("Not a type") if ref($type) ne "domType";
</del><ins>+ assert("Not a type") if ref($type) ne "IDLType";
</ins><span class="cx">
</span><span class="cx"> return $object->IsDictionaryType($type) && defined($cachedExternalDictionaries->{$type->name});
</span><span class="cx"> }
</span><span class="lines">@@ -595,7 +577,7 @@
</span><span class="cx"> {
</span><span class="cx"> my ($object, $type) = @_;
</span><span class="cx">
</span><del>- assert("Not a type") if ref($type) ne "domType";
</del><ins>+ assert("Not a type") if ref($type) ne "IDLType";
</ins><span class="cx">
</span><span class="cx"> return 1 if exists $dictionaryTypeImplementationNameOverrides{$type->name};
</span><span class="cx"> return 0;
</span><span class="lines">@@ -605,7 +587,7 @@
</span><span class="cx"> {
</span><span class="cx"> my ($object, $type) = @_;
</span><span class="cx">
</span><del>- assert("Not a type") if ref($type) ne "domType";
</del><ins>+ assert("Not a type") if ref($type) ne "IDLType";
</ins><span class="cx">
</span><span class="cx"> return $dictionaryTypeImplementationNameOverrides{$type->name};
</span><span class="cx"> }
</span><span class="lines">@@ -614,9 +596,8 @@
</span><span class="cx"> {
</span><span class="cx"> my ($object, $type) = @_;
</span><span class="cx">
</span><del>- assert("Not a type") if ref($type) ne "domType";
</del><ins>+ assert("Not a type") if ref($type) ne "IDLType";
</ins><span class="cx">
</span><del>- return 1 if $nonPointerTypeHash{$type->name};
</del><span class="cx"> return 1 if $object->IsPrimitiveType($type);
</span><span class="cx"> return 0;
</span><span class="cx"> }
</span><span class="lines">@@ -625,7 +606,7 @@
</span><span class="cx"> {
</span><span class="cx"> my ($object, $type) = @_;
</span><span class="cx">
</span><del>- assert("Not a type") if ref($type) ne "domType";
</del><ins>+ assert("Not a type") if ref($type) ne "IDLType";
</ins><span class="cx">
</span><span class="cx"> return 1 if exists $svgTypeNeedingTearOff{$type->name};
</span><span class="cx"> return 0;
</span><span class="lines">@@ -635,7 +616,7 @@
</span><span class="cx"> {
</span><span class="cx"> my ($object, $type) = @_;
</span><span class="cx">
</span><del>- assert("Not a type") if ref($type) ne "domType";
</del><ins>+ assert("Not a type") if ref($type) ne "IDLType";
</ins><span class="cx">
</span><span class="cx"> return 1 if $svgTypeWithWritablePropertiesNeedingTearOff{$type->name};
</span><span class="cx"> return 0;
</span><span class="lines">@@ -645,7 +626,7 @@
</span><span class="cx"> {
</span><span class="cx"> my ($object, $type) = @_;
</span><span class="cx">
</span><del>- assert("Not a type") if ref($type) ne "domType";
</del><ins>+ assert("Not a type") if ref($type) ne "IDLType";
</ins><span class="cx">
</span><span class="cx"> return 1 if $typedArrayTypes{$type->name};
</span><span class="cx"> return 0;
</span><span class="lines">@@ -655,7 +636,7 @@
</span><span class="cx"> {
</span><span class="cx"> my ($object, $type) = @_;
</span><span class="cx">
</span><del>- assert("Not a type") if ref($type) ne "domType";
</del><ins>+ assert("Not a type") if ref($type) ne "IDLType";
</ins><span class="cx">
</span><span class="cx"> return 0 if $object->IsPrimitiveType($type);
</span><span class="cx"> return 0 if $object->IsDictionaryType($type);
</span><span class="lines">@@ -671,7 +652,7 @@
</span><span class="cx"> {
</span><span class="cx"> my ($object, $type) = @_;
</span><span class="cx">
</span><del>- assert("Not a type") if ref($type) ne "domType";
</del><ins>+ assert("Not a type") if ref($type) ne "IDLType";
</ins><span class="cx">
</span><span class="cx"> return $svgTypeNeedingTearOff{$type->name} if exists $svgTypeNeedingTearOff{$type->name};
</span><span class="cx"> return undef;
</span><span class="lines">@@ -681,7 +662,7 @@
</span><span class="cx"> {
</span><span class="cx"> my ($object, $type) = @_;
</span><span class="cx">
</span><del>- assert("Not a type") if ref($type) ne "domType";
</del><ins>+ assert("Not a type") if ref($type) ne "IDLType";
</ins><span class="cx">
</span><span class="cx"> my $svgTypeNeedingTearOff = $object->GetSVGTypeNeedingTearOff($type);
</span><span class="cx"> return $svgTypeNeedingTearOff if not $svgTypeNeedingTearOff;
</span><span class="lines">@@ -711,7 +692,7 @@
</span><span class="cx"> {
</span><span class="cx"> my ($object, $type) = @_;
</span><span class="cx">
</span><del>- assert("Not a type") if ref($type) ne "domType";
</del><ins>+ assert("Not a type") if ref($type) ne "IDLType";
</ins><span class="cx">
</span><span class="cx"> return $object->IsSVGAnimatedTypeName($type->name);
</span><span class="cx"> }
</span><span class="lines">@@ -720,7 +701,7 @@
</span><span class="cx"> {
</span><span class="cx"> my ($object, $type) = @_;
</span><span class="cx">
</span><del>- assert("Not a type") if ref($type) ne "domType";
</del><ins>+ assert("Not a type") if ref($type) ne "IDLType";
</ins><span class="cx">
</span><span class="cx"> return $type->name =~ /Constructor$/;
</span><span class="cx"> }
</span><span class="lines">@@ -729,7 +710,7 @@
</span><span class="cx"> {
</span><span class="cx"> my ($object, $type) = @_;
</span><span class="cx">
</span><del>- assert("Not a type") if ref($type) ne "domType";
</del><ins>+ assert("Not a type") if ref($type) ne "IDLType";
</ins><span class="cx">
</span><span class="cx"> return $type->name eq "sequence";
</span><span class="cx"> }
</span><span class="lines">@@ -738,7 +719,7 @@
</span><span class="cx"> {
</span><span class="cx"> my ($object, $type) = @_;
</span><span class="cx">
</span><del>- assert("Not a type") if ref($type) ne "domType";
</del><ins>+ assert("Not a type") if ref($type) ne "IDLType";
</ins><span class="cx">
</span><span class="cx"> return @{$type->subtypes}[0];
</span><span class="cx"> }
</span><span class="lines">@@ -747,7 +728,7 @@
</span><span class="cx"> {
</span><span class="cx"> my ($object, $type) = @_;
</span><span class="cx">
</span><del>- assert("Not a type") if ref($type) ne "domType";
</del><ins>+ assert("Not a type") if ref($type) ne "IDLType";
</ins><span class="cx">
</span><span class="cx"> return $type->name eq "FrozenArray";
</span><span class="cx"> }
</span><span class="lines">@@ -756,7 +737,7 @@
</span><span class="cx"> {
</span><span class="cx"> my ($object, $type) = @_;
</span><span class="cx">
</span><del>- assert("Not a type") if ref($type) ne "domType";
</del><ins>+ assert("Not a type") if ref($type) ne "IDLType";
</ins><span class="cx">
</span><span class="cx"> return @{$type->subtypes}[0];
</span><span class="cx"> }
</span><span class="lines">@@ -765,7 +746,7 @@
</span><span class="cx"> {
</span><span class="cx"> my ($object, $type) = @_;
</span><span class="cx">
</span><del>- assert("Not a type") if ref($type) ne "domType";
</del><ins>+ assert("Not a type") if ref($type) ne "IDLType";
</ins><span class="cx">
</span><span class="cx"> return $object->IsSequenceType($type) || $object->IsFrozenArrayType($type);
</span><span class="cx"> }
</span><span class="lines">@@ -774,7 +755,7 @@
</span><span class="cx"> {
</span><span class="cx"> my ($object, $type) = @_;
</span><span class="cx">
</span><del>- assert("Not a type") if ref($type) ne "domType";
</del><ins>+ assert("Not a type") if ref($type) ne "IDLType";
</ins><span class="cx">
</span><span class="cx"> return @{$type->subtypes}[0];
</span><span class="cx"> }
</span><span class="lines">@@ -853,7 +834,7 @@
</span><span class="cx">
</span><span class="cx"> my %nameToFunctionsMap = ();
</span><span class="cx"> foreach my $function (@{$interface->functions}) {
</span><del>- my $name = $function->signature->name;
</del><ins>+ my $name = $function->name;
</ins><span class="cx"> $nameToFunctionsMap{$name} = [] if !exists $nameToFunctionsMap{$name};
</span><span class="cx"> push(@{$nameToFunctionsMap{$name}}, $function);
</span><span class="cx"> $function->{overloads} = $nameToFunctionsMap{$name};
</span><span class="lines">@@ -872,11 +853,11 @@
</span><span class="cx"> {
</span><span class="cx"> my ($generator, $attribute) = @_;
</span><span class="cx">
</span><del>- my $attributeName = $attribute->signature->name;
- if ($attribute->signature->extendedAttributes->{"ImplementedAs"}) {
- $attributeName = $attribute->signature->extendedAttributes->{"ImplementedAs"};
</del><ins>+ my $attributeName = $attribute->name;
+ if ($attribute->extendedAttributes->{"ImplementedAs"}) {
+ $attributeName = $attribute->extendedAttributes->{"ImplementedAs"};
</ins><span class="cx"> }
</span><del>- my $attributeType = $attribute->signature->type;
</del><ins>+ my $attributeType = $attribute->type;
</ins><span class="cx">
</span><span class="cx"> # SVG animated types need to use a special attribute name.
</span><span class="cx"> # The rest of the special casing for SVG animated types is handled in the language-specific code generators.
</span><span class="lines">@@ -889,7 +870,7 @@
</span><span class="cx"> {
</span><span class="cx"> my ($generator, $implIncludes, $interfaceName, $attribute) = @_;
</span><span class="cx">
</span><del>- my $contentAttributeName = $attribute->signature->extendedAttributes->{"Reflect"};
</del><ins>+ my $contentAttributeName = $attribute->extendedAttributes->{"Reflect"};
</ins><span class="cx"> return undef if !$contentAttributeName;
</span><span class="cx">
</span><span class="cx"> $contentAttributeName = lc $generator->AttributeNameForGetterAndSetter($attribute) if $contentAttributeName eq "VALUE_IS_MISSING";
</span><span class="lines">@@ -910,10 +891,10 @@
</span><span class="cx"> return ($generator->WK_lcfirst($generator->AttributeNameForGetterAndSetter($attribute)));
</span><span class="cx"> }
</span><span class="cx">
</span><del>- my $attributeType = $attribute->signature->type;
</del><ins>+ my $attributeType = $attribute->type;
</ins><span class="cx">
</span><span class="cx"> my $functionName;
</span><del>- if ($attribute->signature->extendedAttributes->{"URL"}) {
</del><ins>+ if ($attribute->extendedAttributes->{"URL"}) {
</ins><span class="cx"> $functionName = "getURLAttribute";
</span><span class="cx"> } elsif ($attributeType->name eq "boolean") {
</span><span class="cx"> $functionName = "hasAttributeWithoutSynchronization";
</span><span class="lines">@@ -948,7 +929,7 @@
</span><span class="cx"> return ("set" . $generator->WK_ucfirst($generator->AttributeNameForGetterAndSetter($attribute)));
</span><span class="cx"> }
</span><span class="cx">
</span><del>- my $attributeType = $attribute->signature->type;
</del><ins>+ my $attributeType = $attribute->type;
</ins><span class="cx">
</span><span class="cx"> my $functionName;
</span><span class="cx"> if ($attributeType->name eq "boolean") {
</span><span class="lines">@@ -970,7 +951,7 @@
</span><span class="cx"> {
</span><span class="cx"> my ($object, $type) = @_;
</span><span class="cx">
</span><del>- assert("Not a type") if ref($type) ne "domType";
</del><ins>+ assert("Not a type") if ref($type) ne "IDLType";
</ins><span class="cx">
</span><span class="cx"> return 0 if !$object->IsRefPtrType($type);
</span><span class="cx"> return 0 if $object->IsTypedArrayType($type);
</span><span class="lines">@@ -1017,7 +998,7 @@
</span><span class="cx"> {
</span><span class="cx"> my ($object, $type) = @_;
</span><span class="cx">
</span><del>- assert("Not a type") if ref($type) ne "domType";
</del><ins>+ assert("Not a type") if ref($type) ne "IDLType";
</ins><span class="cx">
</span><span class="cx"> return 0 unless $object->IsWrapperType($type);
</span><span class="cx">
</span><span class="lines">@@ -1042,7 +1023,7 @@
</span><span class="cx">
</span><span class="cx"> my ($object, $type) = @_;
</span><span class="cx">
</span><del>- assert("Not a type") if ref($type) ne "domType";
</del><ins>+ assert("Not a type") if ref($type) ne "IDLType";
</ins><span class="cx">
</span><span class="cx"> return $isCallbackInterface{$type->name} if exists $isCallbackInterface{$type->name};
</span><span class="cx"> my $result = $object->ComputeIsCallbackInterface($type);
</span><span class="lines">@@ -1057,7 +1038,7 @@
</span><span class="cx"> {
</span><span class="cx"> my ($object, $type) = @_;
</span><span class="cx">
</span><del>- assert("Not a type") if ref($type) ne "domType";
</del><ins>+ assert("Not a type") if ref($type) ne "IDLType";
</ins><span class="cx">
</span><span class="cx"> return 0 unless $object->IsCallbackInterface($type);
</span><span class="cx">
</span><span class="lines">@@ -1095,7 +1076,7 @@
</span><span class="cx">
</span><span class="cx"> my ($object, $type) = @_;
</span><span class="cx">
</span><del>- assert("Not a type") if ref($type) ne "domType";
</del><ins>+ assert("Not a type") if ref($type) ne "IDLType";
</ins><span class="cx">
</span><span class="cx"> return $isFunctionOnlyCallbackInterface{$type->name} if exists $isFunctionOnlyCallbackInterface{$type->name};
</span><span class="cx"> my $result = $object->ComputeIsFunctionOnlyCallbackInterface($type);
</span><span class="lines">@@ -1220,12 +1201,11 @@
</span><span class="cx">
</span><span class="cx"> sub ShouldPassWrapperByReference
</span><span class="cx"> {
</span><del>- my ($object, $parameter, $interface) = @_;
</del><ins>+ my ($object, $argument) = @_;
</ins><span class="cx">
</span><del>- return 0 if $parameter->isVariadic;
- return 0 if $parameter->type->isNullable;
- return 0 if !$object->IsWrapperType($parameter->type) && !$object->IsTypedArrayType($parameter->type);
- return 0 if $object->IsSVGTypeNeedingTearOff($parameter->type);
</del><ins>+ return 0 if $argument->type->isNullable;
+ return 0 if !$object->IsWrapperType($argument->type) && !$object->IsTypedArrayType($argument->type);
+ return 0 if $object->IsSVGTypeNeedingTearOff($argument->type);
</ins><span class="cx">
</span><span class="cx"> return 1;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (208133 => 208134)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2016-10-30 22:33:02 UTC (rev 208133)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2016-10-30 22:35:00 UTC (rev 208134)
</span><span class="lines">@@ -173,19 +173,19 @@
</span><span class="cx"> foreach my $attribute (@{$interface->attributes}) {
</span><span class="cx"> next unless $attribute->isStringifier;
</span><span class="cx">
</span><del>- my $stringifier = domFunction->new();
- $stringifier->signature(domSignature->new());
</del><ins>+ my $stringifier = IDLOperation->new();
+ $stringifier->name("toString");
+
</ins><span class="cx"> my $extendedAttributeList = {};
</span><del>- $extendedAttributeList->{ImplementedAs} = $attribute->signature->name;
- $stringifier->signature->extendedAttributes($extendedAttributeList);
- $stringifier->signature->name("toString");
- die "stringifier can only be used on attributes of String types" unless $codeGenerator->IsStringType($attribute->signature->type);
</del><ins>+ $extendedAttributeList->{ImplementedAs} = $attribute->name;
+ $stringifier->extendedAttributes($extendedAttributeList);
+ die "stringifier can only be used on attributes of String types" unless $codeGenerator->IsStringType($attribute->type);
</ins><span class="cx">
</span><span class="cx"> # FIXME: This should use IDLParser's cloneType.
</span><del>- my $type = domType->new();
- $type->name($attribute->signature->type->name);
</del><ins>+ my $type = IDLType->new();
+ $type->name($attribute->type->name);
</ins><span class="cx">
</span><del>- $stringifier->signature->type($type);
</del><ins>+ $stringifier->type($type);
</ins><span class="cx">
</span><span class="cx"> push(@{$interface->functions}, $stringifier);
</span><span class="cx"> last;
</span><span class="lines">@@ -195,7 +195,7 @@
</span><span class="cx"> sub EventHandlerAttributeEventName
</span><span class="cx"> {
</span><span class="cx"> my $attribute = shift;
</span><del>- my $eventType = $attribute->signature->extendedAttributes->{ImplementedAs} || $attribute->signature->name;
</del><ins>+ my $eventType = $attribute->extendedAttributes->{ImplementedAs} || $attribute->name;
</ins><span class="cx">
</span><span class="cx"> # Remove the "on" prefix.
</span><span class="cx"> $eventType = substr($eventType, 2);
</span><span class="lines">@@ -308,7 +308,7 @@
</span><span class="cx"> sub IsReadonly
</span><span class="cx"> {
</span><span class="cx"> my $attribute = shift;
</span><del>- return $attribute->isReadOnly && !$attribute->signature->extendedAttributes->{Replaceable} && !$attribute->signature->extendedAttributes->{PutForwards};
</del><ins>+ return $attribute->isReadOnly && !$attribute->extendedAttributes->{Replaceable} && !$attribute->extendedAttributes->{PutForwards};
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> sub AddClassForwardIfNeeded
</span><span class="lines">@@ -382,7 +382,7 @@
</span><span class="cx"> # where the index is out of range.
</span><span class="cx">
</span><span class="cx"> # FIXME: Should this work for all string types?
</span><del>- if ($indexedGetterFunction->signature->type->name eq "DOMString") {
</del><ins>+ if ($indexedGetterFunction->type->name eq "DOMString") {
</ins><span class="cx"> push(@getOwnPropertySlotImpl, " if (optionalIndex) {\n");
</span><span class="cx"> } else {
</span><span class="cx"> push(@getOwnPropertySlotImpl, " if (optionalIndex && optionalIndex.value() < thisObject->wrapped().length()) {\n");
</span><span class="lines">@@ -537,9 +537,9 @@
</span><span class="cx"> {
</span><span class="cx"> my ($interface, $className, $attribute) = @_;
</span><span class="cx">
</span><del>- return $codeGenerator->WK_lcfirst($className) . "Constructor" . $codeGenerator->WK_ucfirst($attribute->signature->name) if $attribute->isStatic;
</del><ins>+ return $codeGenerator->WK_lcfirst($className) . "Constructor" . $codeGenerator->WK_ucfirst($attribute->name) if $attribute->isStatic;
</ins><span class="cx"> return GetJSBuiltinFunctionName($className, $attribute) if IsJSBuiltin($interface, $attribute);
</span><del>- return "js" . $interface->type->name . $codeGenerator->WK_ucfirst($attribute->signature->name) . ($codeGenerator->IsConstructorType($attribute->signature->type) ? "Constructor" : "");
</del><ins>+ return "js" . $interface->type->name . $codeGenerator->WK_ucfirst($attribute->name) . ($codeGenerator->IsConstructorType($attribute->type) ? "Constructor" : "");
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> sub GetAttributeSetterName
</span><span class="lines">@@ -546,9 +546,9 @@
</span><span class="cx"> {
</span><span class="cx"> my ($interface, $className, $attribute) = @_;
</span><span class="cx">
</span><del>- return "set" . $codeGenerator->WK_ucfirst($className) . "Constructor" . $codeGenerator->WK_ucfirst($attribute->signature->name) if $attribute->isStatic;
</del><ins>+ return "set" . $codeGenerator->WK_ucfirst($className) . "Constructor" . $codeGenerator->WK_ucfirst($attribute->name) if $attribute->isStatic;
</ins><span class="cx"> return "set" . $codeGenerator->WK_ucfirst(GetJSBuiltinFunctionName($className, $attribute)) if IsJSBuiltin($interface, $attribute);
</span><del>- return "setJS" . $interface->type->name . $codeGenerator->WK_ucfirst($attribute->signature->name) . ($codeGenerator->IsConstructorType($attribute->signature->type) ? "Constructor" : "");
</del><ins>+ return "setJS" . $interface->type->name . $codeGenerator->WK_ucfirst($attribute->name) . ($codeGenerator->IsConstructorType($attribute->type) ? "Constructor" : "");
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> sub GetFunctionName
</span><span class="lines">@@ -557,7 +557,7 @@
</span><span class="cx">
</span><span class="cx"> return GetJSBuiltinFunctionName($className, $function) if IsJSBuiltin($interface, $function);
</span><span class="cx">
</span><del>- my $functionName = $function->signature->name;
</del><ins>+ my $functionName = $function->name;
</ins><span class="cx"> $functionName = "SymbolIterator" if $functionName eq "[Symbol.Iterator]";
</span><span class="cx">
</span><span class="cx"> my $kind = $function->isStatic ? "Constructor" : (OperationShouldBeOnInstance($interface, $function) ? "Instance" : "Prototype");
</span><span class="lines">@@ -572,10 +572,10 @@
</span><span class="cx"> my $numberOfParameters = shift;
</span><span class="cx">
</span><span class="cx"> foreach my $function (@{$interface->functions}, @{$interface->anonymousFunctions}) {
</span><del>- my $specials = $function->signature->specials;
</del><ins>+ my $specials = $function->specials;
</ins><span class="cx"> my $specialExists = grep { $_ eq $special } @$specials;
</span><del>- my $parameters = $function->parameters;
- if ($specialExists and scalar(@$parameters) == $numberOfParameters and $parameters->[0]->type->name eq $firstParameterType) {
</del><ins>+ my $arguments = $function->arguments;
+ if ($specialExists and scalar(@$arguments) == $numberOfParameters and $arguments->[0]->type->name eq $firstParameterType) {
</ins><span class="cx"> return $function;
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -615,10 +615,10 @@
</span><span class="cx"> my $attribute = shift;
</span><span class="cx">
</span><span class="cx"> # FIXME: The bindings generator does not support putting runtime-enabled attributes on the instance yet (except for global objects).
</span><del>- return 0 if $attribute->signature->extendedAttributes->{EnabledAtRuntime} && !IsDOMGlobalObject($interface);
</del><ins>+ return 0 if $attribute->extendedAttributes->{EnabledAtRuntime} && !IsDOMGlobalObject($interface);
</ins><span class="cx">
</span><span class="cx"> return 1 if InterfaceRequiresAttributesOnInstance($interface);
</span><del>- return 1 if $codeGenerator->IsConstructorType($attribute->signature->type);
</del><ins>+ return 1 if $codeGenerator->IsConstructorType($attribute->type);
</ins><span class="cx">
</span><span class="cx"> # [Unforgeable] attributes should be on the instance.
</span><span class="cx"> # https://heycam.github.io/webidl/#Unforgeable
</span><span class="lines">@@ -625,8 +625,8 @@
</span><span class="cx"> return 1 if IsUnforgeable($interface, $attribute);
</span><span class="cx">
</span><span class="cx"> if ($interface->extendedAttributes->{CheckSecurity}) {
</span><del>- return 0 if $attribute->signature->extendedAttributes->{DoNotCheckSecurity};
- return 0 if $attribute->signature->extendedAttributes->{DoNotCheckSecurityOnGetter};
</del><ins>+ return 0 if $attribute->extendedAttributes->{DoNotCheckSecurity};
+ return 0 if $attribute->extendedAttributes->{DoNotCheckSecurityOnGetter};
</ins><span class="cx"> return 1;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -643,7 +643,7 @@
</span><span class="cx"> return 1 if IsDOMGlobalObject($interface) && $interface->type->name ne "WorkerGlobalScope";
</span><span class="cx">
</span><span class="cx"> # FIXME: The bindings generator does not support putting runtime-enabled operations on the instance yet (except for global objects).
</span><del>- return 0 if $function->signature->extendedAttributes->{EnabledAtRuntime};
</del><ins>+ return 0 if $function->extendedAttributes->{EnabledAtRuntime};
</ins><span class="cx">
</span><span class="cx"> # [Unforgeable] operations should be on the instance. https://heycam.github.io/webidl/#Unforgeable
</span><span class="cx"> return 1 if IsUnforgeable($interface, $function);
</span><span class="lines">@@ -660,11 +660,11 @@
</span><span class="cx"> push(@specials, "DontDelete") if IsUnforgeable($interface, $attribute);
</span><span class="cx">
</span><span class="cx"> # As per Web IDL specification, constructor properties on the ECMAScript global object should not be enumerable.
</span><del>- my $isGlobalConstructor = $codeGenerator->IsConstructorType($attribute->signature->type);
- push(@specials, "DontEnum") if ($attribute->signature->extendedAttributes->{NotEnumerable} || $isGlobalConstructor);
</del><ins>+ my $isGlobalConstructor = $codeGenerator->IsConstructorType($attribute->type);
+ push(@specials, "DontEnum") if ($attribute->extendedAttributes->{NotEnumerable} || $isGlobalConstructor);
</ins><span class="cx"> push(@specials, "ReadOnly") if IsReadonly($attribute);
</span><span class="cx"> push(@specials, "CustomAccessor") unless $isGlobalConstructor or IsJSBuiltin($interface, $attribute);
</span><del>- push(@specials, "DOMJITAttribute") if $attribute->signature->extendedAttributes->{"DOMJIT"};
</del><ins>+ push(@specials, "DOMJITAttribute") if $attribute->extendedAttributes->{"DOMJIT"};
</ins><span class="cx"> push(@specials, "Accessor | Builtin") if IsJSBuiltin($interface, $attribute);
</span><span class="cx"> return (@specials > 0) ? join(" | ", @specials) : "0";
</span><span class="cx"> }
</span><span class="lines">@@ -840,7 +840,7 @@
</span><span class="cx"> {
</span><span class="cx"> my ($type, $interface) = @_;
</span><span class="cx">
</span><del>- assert("Not a type") if ref($type) ne "domType";
</del><ins>+ assert("Not a type") if ref($type) ne "IDLType";
</ins><span class="cx">
</span><span class="cx"> if ($codeGenerator->HasEnumImplementationNameOverride($type)) {
</span><span class="cx"> return $codeGenerator->GetEnumImplementationNameOverride($type);
</span><span class="lines">@@ -1044,31 +1044,29 @@
</span><span class="cx">
</span><span class="cx"> sub GenerateDefaultValue
</span><span class="cx"> {
</span><del>- my ($interface, $signature) = @_;
</del><ins>+ my ($interface, $type, $defaultValue) = @_;
</ins><span class="cx">
</span><del>- my $defaultValue = $signature->default;
-
- if ($codeGenerator->IsEnumType($signature->type)) {
</del><ins>+ if ($codeGenerator->IsEnumType($type)) {
</ins><span class="cx"> # FIXME: Would be nice to report an error if the value does not have quote marks around it.
</span><span class="cx"> # FIXME: Would be nice to report an error if the value is not one of the enumeration values.
</span><del>- my $className = GetEnumerationClassName($signature->type, $interface);
</del><ins>+ my $className = GetEnumerationClassName($type, $interface);
</ins><span class="cx"> my $enumerationValueName = GetEnumerationValueName(substr($defaultValue, 1, -1));
</span><span class="cx"> return $className . "::" . $enumerationValueName;
</span><span class="cx"> }
</span><span class="cx"> if ($defaultValue eq "null") {
</span><del>- if ($signature->type->isUnion) {
- return "Nullopt" if $signature->type->isNullable;
</del><ins>+ if ($type->isUnion) {
+ return "Nullopt" if $type->isNullable;
</ins><span class="cx">
</span><del>- my $IDLType = GetIDLType($interface, $signature->type);
</del><ins>+ my $IDLType = GetIDLType($interface, $type);
</ins><span class="cx"> return "convert<${IDLType}>(state, jsNull());";
</span><span class="cx"> }
</span><del>- return "jsNull()" if $signature->type->name eq "any";
- return "nullptr" if $codeGenerator->IsWrapperType($signature->type) || $codeGenerator->IsTypedArrayType($signature->type);
- return "String()" if $codeGenerator->IsStringType($signature->type);
</del><ins>+ return "jsNull()" if $type->name eq "any";
+ return "nullptr" if $codeGenerator->IsWrapperType($type) || $codeGenerator->IsTypedArrayType($type);
+ return "String()" if $codeGenerator->IsStringType($type);
</ins><span class="cx"> return "Nullopt";
</span><span class="cx"> }
</span><span class="cx"> if ($defaultValue eq "[]") {
</span><del>- my $nativeType = GetNativeTypeFromSignature($interface, $signature);
</del><ins>+ my $nativeType = GetNativeType($interface, $type);
</ins><span class="cx"> return "$nativeType()"
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1183,10 +1181,10 @@
</span><span class="cx">
</span><span class="cx"> # Value is undefined.
</span><span class="cx"> # 5.4. Otherwise, if value is undefined but the dictionary member has a default value, then:
</span><del>- if ($member->isOptional && defined $member->default) {
</del><ins>+ if (!$member->isRequired && defined $member->default) {
</ins><span class="cx"> $result .= " } else\n";
</span><del>- $result .= " result.$key = " . GenerateDefaultValue($interface, $member) . ";\n";
- } elsif (!$member->isOptional) {
</del><ins>+ $result .= " result.$key = " . GenerateDefaultValue($interface, $member->type, $member->default) . ";\n";
+ } elsif ($member->isRequired) {
</ins><span class="cx"> # 5.5. Otherwise, if value is undefined and the dictionary member is a required dictionary member, then throw a TypeError.
</span><span class="cx"> $result .= " } else {\n";
</span><span class="cx"> $result .= " throwRequiredMemberTypeError(state, throwScope, \"". $member->name ."\", \"$name\", \"". $type->name ."\");\n";
</span><span class="lines">@@ -1514,19 +1512,19 @@
</span><span class="cx"> if ($numAttributes > 0) {
</span><span class="cx"> foreach (@{$interface->attributes}) {
</span><span class="cx"> my $attribute = $_;
</span><del>- $numCustomAttributes++ if HasCustomGetter($attribute->signature->extendedAttributes);
- $numCustomAttributes++ if HasCustomSetter($attribute->signature->extendedAttributes);
- if ($attribute->signature->extendedAttributes->{CachedAttribute}) {
- my $conditionalString = $codeGenerator->GenerateConditionalString($attribute->signature);
</del><ins>+ $numCustomAttributes++ if HasCustomGetter($attribute->extendedAttributes);
+ $numCustomAttributes++ if HasCustomSetter($attribute->extendedAttributes);
+ if ($attribute->extendedAttributes->{CachedAttribute}) {
+ my $conditionalString = $codeGenerator->GenerateConditionalString($attribute);
</ins><span class="cx"> push(@headerContent, "#if ${conditionalString}\n") if $conditionalString;
</span><del>- push(@headerContent, " mutable JSC::WriteBarrier<JSC::Unknown> m_" . $attribute->signature->name . ";\n");
</del><ins>+ push(@headerContent, " mutable JSC::WriteBarrier<JSC::Unknown> m_" . $attribute->name . ";\n");
</ins><span class="cx"> $numCachedAttributes++;
</span><span class="cx"> $needsVisitChildren = 1;
</span><span class="cx"> push(@headerContent, "#endif\n") if $conditionalString;
</span><span class="cx"> }
</span><del>- $hasDOMJITAttributes = 1 if $attribute->signature->extendedAttributes->{"DOMJIT"};
</del><ins>+ $hasDOMJITAttributes = 1 if $attribute->extendedAttributes->{"DOMJIT"};
</ins><span class="cx">
</span><del>- $hasForwardDeclaringAttributes = 1 if $attribute->signature->extendedAttributes->{ForwardDeclareInHeader};
</del><ins>+ $hasForwardDeclaringAttributes = 1 if $attribute->extendedAttributes->{ForwardDeclareInHeader};
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1545,16 +1543,16 @@
</span><span class="cx"> push(@headerContent, "\n // Custom attributes\n");
</span><span class="cx">
</span><span class="cx"> foreach my $attribute (@{$interface->attributes}) {
</span><del>- my $conditionalString = $codeGenerator->GenerateConditionalString($attribute->signature);
- if (HasCustomGetter($attribute->signature->extendedAttributes)) {
</del><ins>+ my $conditionalString = $codeGenerator->GenerateConditionalString($attribute);
+ if (HasCustomGetter($attribute->extendedAttributes)) {
</ins><span class="cx"> push(@headerContent, "#if ${conditionalString}\n") if $conditionalString;
</span><del>- my $methodName = $codeGenerator->WK_lcfirst($attribute->signature->name);
</del><ins>+ my $methodName = $codeGenerator->WK_lcfirst($attribute->name);
</ins><span class="cx"> push(@headerContent, " JSC::JSValue " . $methodName . "(JSC::ExecState&) const;\n");
</span><span class="cx"> push(@headerContent, "#endif\n") if $conditionalString;
</span><span class="cx"> }
</span><del>- if (HasCustomSetter($attribute->signature->extendedAttributes) && !IsReadonly($attribute)) {
</del><ins>+ if (HasCustomSetter($attribute->extendedAttributes) && !IsReadonly($attribute)) {
</ins><span class="cx"> push(@headerContent, "#if ${conditionalString}\n") if $conditionalString;
</span><del>- push(@headerContent, " void set" . $codeGenerator->WK_ucfirst($attribute->signature->name) . "(JSC::ExecState&, JSC::JSValue);\n");
</del><ins>+ push(@headerContent, " void set" . $codeGenerator->WK_ucfirst($attribute->name) . "(JSC::ExecState&, JSC::JSValue);\n");
</ins><span class="cx"> push(@headerContent, "#endif\n") if $conditionalString;
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -1561,8 +1559,8 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> foreach my $function (@{$interface->functions}) {
</span><del>- $numCustomFunctions++ if HasCustomMethod($function->signature->extendedAttributes);
- $hasForwardDeclaringFunctions = 1 if $function->signature->extendedAttributes->{ForwardDeclareInHeader};
</del><ins>+ $numCustomFunctions++ if HasCustomMethod($function->extendedAttributes);
+ $hasForwardDeclaringFunctions = 1 if $function->extendedAttributes->{ForwardDeclareInHeader};
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if ($numCustomFunctions > 0) {
</span><span class="lines">@@ -1569,7 +1567,7 @@
</span><span class="cx"> my $inAppleCopyright = 0;
</span><span class="cx"> push(@headerContent, "\n // Custom functions\n");
</span><span class="cx"> foreach my $function (@{$interface->functions}) {
</span><del>- if ($function->signature->extendedAttributes->{AppleCopyright}) {
</del><ins>+ if ($function->extendedAttributes->{AppleCopyright}) {
</ins><span class="cx"> if (!$inAppleCopyright) {
</span><span class="cx"> push(@headerContent, $beginAppleCopyrightForHeaderFiles);
</span><span class="cx"> $inAppleCopyright = 1;
</span><span class="lines">@@ -1578,11 +1576,11 @@
</span><span class="cx"> push(@headerContent, $endAppleCopyright);
</span><span class="cx"> $inAppleCopyright = 0;
</span><span class="cx"> }
</span><del>- next unless HasCustomMethod($function->signature->extendedAttributes);
</del><ins>+ next unless HasCustomMethod($function->extendedAttributes);
</ins><span class="cx"> next if $function->{overloads} && $function->{overloadIndex} != 1;
</span><del>- my $conditionalString = $codeGenerator->GenerateConditionalString($function->signature);
</del><ins>+ my $conditionalString = $codeGenerator->GenerateConditionalString($function);
</ins><span class="cx"> push(@headerContent, "#if ${conditionalString}\n") if $conditionalString;
</span><del>- my $functionImplementationName = $function->signature->extendedAttributes->{ImplementedAs} || $codeGenerator->WK_lcfirst($function->signature->name);
</del><ins>+ my $functionImplementationName = $function->extendedAttributes->{ImplementedAs} || $codeGenerator->WK_lcfirst($function->name);
</ins><span class="cx"> push(@headerContent, " " . ($function->isStatic ? "static " : "") . "JSC::JSValue " . $functionImplementationName . "(JSC::ExecState&);\n");
</span><span class="cx"> push(@headerContent, "#endif\n") if $conditionalString;
</span><span class="cx"> }
</span><span class="lines">@@ -1691,9 +1689,9 @@
</span><span class="cx"> push(@headerContent,"// Functions\n\n");
</span><span class="cx"> foreach my $function (@{$interface->functions}) {
</span><span class="cx"> next if $function->{overloadIndex} && $function->{overloadIndex} > 1;
</span><del>- next unless $function->signature->extendedAttributes->{ForwardDeclareInHeader};
</del><ins>+ next unless $function->extendedAttributes->{ForwardDeclareInHeader};
</ins><span class="cx">
</span><del>- if ($function->signature->extendedAttributes->{AppleCopyright}) {
</del><ins>+ if ($function->extendedAttributes->{AppleCopyright}) {
</ins><span class="cx"> if (!$inAppleCopyright) {
</span><span class="cx"> push(@headerContent, $beginAppleCopyrightForHeaderFiles);
</span><span class="cx"> $inAppleCopyright = 1;
</span><span class="lines">@@ -1718,9 +1716,9 @@
</span><span class="cx"> if ($hasForwardDeclaringAttributes) {
</span><span class="cx"> push(@headerContent,"// Attributes\n\n");
</span><span class="cx"> foreach my $attribute (@{$interface->attributes}) {
</span><del>- next unless $attribute->signature->extendedAttributes->{ForwardDeclareInHeader};
</del><ins>+ next unless $attribute->extendedAttributes->{ForwardDeclareInHeader};
</ins><span class="cx">
</span><del>- my $conditionalString = $codeGenerator->GenerateConditionalString($attribute->signature);
</del><ins>+ my $conditionalString = $codeGenerator->GenerateConditionalString($attribute);
</ins><span class="cx"> push(@headerContent, "#if ${conditionalString}\n") if $conditionalString;
</span><span class="cx"> my $getter = GetAttributeGetterName($interface, $className, $attribute);
</span><span class="cx"> push(@headerContent, "JSC::EncodedJSValue ${getter}(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);\n");
</span><span class="lines">@@ -1736,10 +1734,10 @@
</span><span class="cx"> $headerIncludes{"<domjit/DOMJITGetterSetter.h>"} = 1;
</span><span class="cx"> push(@headerContent,"// DOMJIT emitters for attributes\n\n");
</span><span class="cx"> foreach my $attribute (@{$interface->attributes}) {
</span><del>- next unless $attribute->signature->extendedAttributes->{"DOMJIT"};
</del><ins>+ next unless $attribute->extendedAttributes->{"DOMJIT"};
</ins><span class="cx">
</span><span class="cx"> my $interfaceName = $interface->type->name;
</span><del>- my $className = $interfaceName . $codeGenerator->WK_ucfirst($attribute->signature->name);
</del><ins>+ my $className = $interfaceName . $codeGenerator->WK_ucfirst($attribute->name);
</ins><span class="cx"> my $domJITClassName = $className . "DOMJIT";
</span><span class="cx">
</span><span class="cx"> push(@headerContent, "JSC::DOMJIT::GetterSetter* domJITGetterSetterFor$className(void);\n");
</span><span class="lines">@@ -1829,19 +1827,19 @@
</span><span class="cx"> next if AttributeShouldBeOnInstance($interface, $attribute) != $isInstance;
</span><span class="cx">
</span><span class="cx"> # Global objects add RuntimeEnabled attributes after creation so do not add them to the static table.
</span><del>- if (IsDOMGlobalObject($interface) && $attribute->signature->extendedAttributes->{EnabledAtRuntime}) {
</del><ins>+ if (IsDOMGlobalObject($interface) && $attribute->extendedAttributes->{EnabledAtRuntime}) {
</ins><span class="cx"> $propertyCount -= 1;
</span><span class="cx"> next;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- my $name = $attribute->signature->name;
</del><ins>+ my $name = $attribute->name;
</ins><span class="cx"> push(@$hashKeys, $name);
</span><span class="cx">
</span><span class="cx"> my $special = GetJSCAttributesForAttribute($interface, $attribute);
</span><span class="cx"> push(@$hashSpecials, $special);
</span><span class="cx">
</span><del>- if ($attribute->signature->extendedAttributes->{"DOMJIT"}) {
- push(@$hashValue1, "domJITGetterSetterFor" . $interface->type->name . $codeGenerator->WK_ucfirst($attribute->signature->name));
</del><ins>+ if ($attribute->extendedAttributes->{"DOMJIT"}) {
+ push(@$hashValue1, "domJITGetterSetterFor" . $interface->type->name . $codeGenerator->WK_ucfirst($attribute->name));
</ins><span class="cx"> push(@$hashValue2, "0");
</span><span class="cx"> } else {
</span><span class="cx"> my $getter = GetAttributeGetterName($interface, $className, $attribute);
</span><span class="lines">@@ -1855,10 +1853,10 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- my $conditional = $attribute->signature->extendedAttributes->{Conditional};
</del><ins>+ my $conditional = $attribute->extendedAttributes->{Conditional};
</ins><span class="cx"> $conditionals->{$name} = $conditional if $conditional;
</span><span class="cx">
</span><del>- if ($attribute->signature->extendedAttributes->{EnabledAtRuntime}) {
</del><ins>+ if ($attribute->extendedAttributes->{EnabledAtRuntime}) {
</ins><span class="cx"> die "We currently do not support [EnabledAtRuntime] attributes on the instance (except for global objects)." if $isInstance;
</span><span class="cx"> push(@$runtimeEnabledAttributes, $attribute);
</span><span class="cx"> }
</span><span class="lines">@@ -1868,19 +1866,19 @@
</span><span class="cx"> push(@functions, @{$interface->iterable->functions}) if IsKeyValueIterableInterface($interface);
</span><span class="cx"> push(@functions, @{$interface->serializable->functions}) if $interface->serializable;
</span><span class="cx"> foreach my $function (@functions) {
</span><del>- next if ($function->signature->extendedAttributes->{PrivateIdentifier} and not $function->signature->extendedAttributes->{PublicIdentifier});
</del><ins>+ next if ($function->extendedAttributes->{PrivateIdentifier} and not $function->extendedAttributes->{PublicIdentifier});
</ins><span class="cx"> next if ($function->isStatic);
</span><span class="cx"> next if $function->{overloadIndex} && $function->{overloadIndex} > 1;
</span><span class="cx"> next if OperationShouldBeOnInstance($interface, $function) != $isInstance;
</span><del>- next if $function->signature->name eq "[Symbol.Iterator]";
</del><ins>+ next if $function->name eq "[Symbol.Iterator]";
</ins><span class="cx">
</span><span class="cx"> # Global objects add RuntimeEnabled operations after creation so do not add them to the static table.
</span><del>- if (IsDOMGlobalObject($interface) && $function->signature->extendedAttributes->{EnabledAtRuntime}) {
</del><ins>+ if (IsDOMGlobalObject($interface) && $function->extendedAttributes->{EnabledAtRuntime}) {
</ins><span class="cx"> $propertyCount -= 1;
</span><span class="cx"> next;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- my $name = $function->signature->name;
</del><ins>+ my $name = $function->name;
</ins><span class="cx"> push(@$hashKeys, $name);
</span><span class="cx">
</span><span class="cx"> my $functionName = GetFunctionName($interface, $className, $function);
</span><span class="lines">@@ -1889,7 +1887,7 @@
</span><span class="cx"> my $functionLength = GetFunctionLength($function);
</span><span class="cx">
</span><span class="cx"> # FIXME: Remove this once we can get rid of the quirk introduced in https://bugs.webkit.org/show_bug.cgi?id=163967.
</span><del>- $functionLength = 3 if $interfaceName eq "Event" and $function->signature->name eq "initEvent";
</del><ins>+ $functionLength = 3 if $interfaceName eq "Event" and $function->name eq "initEvent";
</ins><span class="cx">
</span><span class="cx"> push(@$hashValue2, $functionLength);
</span><span class="cx">
</span><span class="lines">@@ -1898,7 +1896,7 @@
</span><span class="cx"> my $conditional = getConditionalForFunctionConsideringOverloads($function);
</span><span class="cx"> $conditionals->{$name} = $conditional if $conditional;
</span><span class="cx">
</span><del>- if ($function->signature->extendedAttributes->{EnabledAtRuntime}) {
</del><ins>+ if ($function->extendedAttributes->{EnabledAtRuntime}) {
</ins><span class="cx"> die "We currently do not support [EnabledAtRuntime] operations on the instance (except for global objects)." if $isInstance;
</span><span class="cx"> push(@$runtimeEnabledFunctions, $function);
</span><span class="cx"> }
</span><span class="lines">@@ -1930,15 +1928,15 @@
</span><span class="cx">
</span><span class="cx"> my $m = LengthOfLongestFunctionParameterList($overloads);
</span><span class="cx"> foreach my $overload (@{$overloads}) {
</span><del>- my $n = @{$overload->parameters};
</del><ins>+ my $n = @{$overload->arguments};
</ins><span class="cx"> my @t;
</span><span class="cx"> my @o;
</span><span class="cx"> my $isVariadic = 0;
</span><del>- foreach my $parameter (@{$overload->parameters}) {
- push(@t, $parameter->type);
- if ($parameter->isOptional) {
</del><ins>+ foreach my $argument (@{$overload->arguments}) {
+ push(@t, $argument->type);
+ if ($argument->isOptional) {
</ins><span class="cx"> push(@o, "optional");
</span><del>- } elsif ($parameter->isVariadic) {
</del><ins>+ } elsif ($argument->isVariadic) {
</ins><span class="cx"> push(@o, "variadic");
</span><span class="cx"> $isVariadic = 1;
</span><span class="cx"> } else {
</span><span class="lines">@@ -1956,8 +1954,8 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> for (my $i = $n - 1; $i >= 0; $i--) {
</span><del>- my $parameter = @{$overload->parameters}[$i];
- last unless ($parameter->isOptional || $parameter->isVariadic);
</del><ins>+ my $argument = @{$overload->arguments}[$i];
+ last unless ($argument->isOptional || $argument->isVariadic);
</ins><span class="cx"> pop(@t);
</span><span class="cx"> pop(@o);
</span><span class="cx"> &$addTuple([$overload, [@t], [@o]]);
</span><span class="lines">@@ -2038,7 +2036,7 @@
</span><span class="cx"> for (my $index = 0; $index < scalar(@$firstTupleTypes); $index++) {
</span><span class="cx"> return $index if AreTypesDistinguishableForOverloadResolution(@{$firstTupleTypes}[$index], @{$secondTupleTypes}[$index]);
</span><span class="cx"> }
</span><del>- die "Undistinguishable overloads for operation " . $function->signature->name . " with length: " . scalar(@$firstTupleTypes);
</del><ins>+ die "Undistinguishable overloads for operation " . $function->name . " with length: " . scalar(@$firstTupleTypes);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> sub GetOverloadThatMatches
</span><span class="lines">@@ -2073,11 +2071,11 @@
</span><span class="cx"> {
</span><span class="cx"> my $function = shift;
</span><span class="cx">
</span><del>- return $function->signature->extendedAttributes->{Conditional} unless $function->{overloads};
</del><ins>+ return $function->extendedAttributes->{Conditional} unless $function->{overloads};
</ins><span class="cx">
</span><span class="cx"> my %conditions;
</span><span class="cx"> foreach my $overload (@{$function->{overloads}}) {
</span><del>- my $conditional = $overload->signature->extendedAttributes->{Conditional};
</del><ins>+ my $conditional = $overload->extendedAttributes->{Conditional};
</ins><span class="cx"> return unless $conditional;
</span><span class="cx"> $conditions{$conditional} = 1;
</span><span class="cx"> }
</span><span class="lines">@@ -2098,13 +2096,13 @@
</span><span class="cx"> $functionName = "construct${className}";
</span><span class="cx"> } else {
</span><span class="cx"> my $kind = $function->isStatic ? "Constructor" : (OperationShouldBeOnInstance($interface, $function) ? "Instance" : "Prototype");
</span><del>- $functionName = "js${interfaceName}${kind}Function" . $codeGenerator->WK_ucfirst($function->signature->name);
</del><ins>+ $functionName = "js${interfaceName}${kind}Function" . $codeGenerator->WK_ucfirst($function->name);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> my $generateOverloadCallIfNecessary = sub {
</span><span class="cx"> my ($overload, $condition) = @_;
</span><span class="cx"> return unless $overload;
</span><del>- my $conditionalString = $codeGenerator->GenerateConditionalString($overload->signature);
</del><ins>+ my $conditionalString = $codeGenerator->GenerateConditionalString($overload);
</ins><span class="cx"> push(@implContent, "#if ${conditionalString}\n") if $conditionalString;
</span><span class="cx"> push(@implContent, " if ($condition)\n ") if $condition;
</span><span class="cx"> push(@implContent, " return ${functionName}$overload->{overloadIndex}(state);\n");
</span><span class="lines">@@ -2291,8 +2289,8 @@
</span><span class="cx"> my $function = shift;
</span><span class="cx">
</span><span class="cx"> my $length = 0;
</span><del>- foreach my $parameter (@{$function->parameters}) {
- last if $parameter->isOptional || $parameter->isVariadic;
</del><ins>+ foreach my $argument (@{$function->arguments}) {
+ last if $argument->isOptional || $argument->isVariadic;
</ins><span class="cx"> $length++;
</span><span class="cx"> }
</span><span class="cx"> return $length;
</span><span class="lines">@@ -2311,8 +2309,8 @@
</span><span class="cx"> my ($overloads) = @_;
</span><span class="cx"> my $result = 0;
</span><span class="cx"> foreach my $overload (@{$overloads}) {
</span><del>- my @parameters = @{$overload->parameters};
- $result = @parameters if $result < @parameters;
</del><ins>+ my @arguments = @{$overload->arguments};
+ $result = @arguments if $result < @arguments;
</ins><span class="cx"> }
</span><span class="cx"> return $result;
</span><span class="cx"> }
</span><span class="lines">@@ -2459,15 +2457,17 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> # Returns the RuntimeEnabledFeatures function name that is hooked up to check if a method/attribute is enabled.
</span><ins>+# NOTE: Parameter passed in must have both an 'extendedAttributes' property.
+# (e.g. DOMInterface, DOMAttribute, DOMOperation, DOMIterable, etc.)
</ins><span class="cx"> sub GetRuntimeEnableFunctionName
</span><span class="cx"> {
</span><del>- my $signature = shift;
</del><ins>+ my $context = shift;
</ins><span class="cx">
</span><span class="cx"> # If a parameter is given (e.g. "EnabledAtRuntime=FeatureName") return the RuntimeEnabledFeatures::sharedFeatures().{FeatureName}Enabled() method.
</span><del>- return "RuntimeEnabledFeatures::sharedFeatures()." . ToMethodName($signature->extendedAttributes->{EnabledAtRuntime}) . "Enabled" if ($signature->extendedAttributes->{EnabledAtRuntime} && $signature->extendedAttributes->{EnabledAtRuntime} ne "VALUE_IS_MISSING");
</del><ins>+ return "RuntimeEnabledFeatures::sharedFeatures()." . ToMethodName($context->extendedAttributes->{EnabledAtRuntime}) . "Enabled" if ($context->extendedAttributes->{EnabledAtRuntime} && $context->extendedAttributes->{EnabledAtRuntime} ne "VALUE_IS_MISSING");
</ins><span class="cx">
</span><span class="cx"> # Otherwise return a function named RuntimeEnabledFeatures::sharedFeatures().{methodName}Enabled().
</span><del>- return "RuntimeEnabledFeatures::sharedFeatures()." . ToMethodName($signature->name) . "Enabled";
</del><ins>+ return "RuntimeEnabledFeatures::sharedFeatures()." . ToMethodName($context->name) . "Enabled";
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> sub GetCastingHelperForThisObject
</span><span class="lines">@@ -2482,7 +2482,7 @@
</span><span class="cx"> my $indexedGetterFunction = shift;
</span><span class="cx">
</span><span class="cx"> # FIXME: Should this work for all string types?
</span><del>- return "jsStringOrUndefined(state, thisObject->wrapped().item(index))" if $indexedGetterFunction->signature->type->name eq "DOMString";
</del><ins>+ return "jsStringOrUndefined(state, thisObject->wrapped().item(index))" if $indexedGetterFunction->type->name eq "DOMString";
</ins><span class="cx"> return "toJS(state, thisObject->globalObject(), thisObject->wrapped().item(index))";
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -2493,7 +2493,7 @@
</span><span class="cx">
</span><span class="cx"> my @unscopables;
</span><span class="cx"> foreach my $functionOrAttribute (@{$interface->functions}, @{$interface->attributes}) {
</span><del>- push(@unscopables, $functionOrAttribute->signature->name) if $functionOrAttribute->signature->extendedAttributes->{Unscopable};
</del><ins>+ push(@unscopables, $functionOrAttribute->name) if $functionOrAttribute->extendedAttributes->{Unscopable};
</ins><span class="cx"> }
</span><span class="cx"> return if scalar(@unscopables) == 0;
</span><span class="cx">
</span><span class="lines">@@ -2507,10 +2507,8 @@
</span><span class="cx">
</span><span class="cx"> sub GetResultTypeFilter
</span><span class="cx"> {
</span><del>- my ($signature) = @_;
</del><ins>+ my ($type) = @_;
</ins><span class="cx">
</span><del>- my $type = $signature->type;
-
</del><span class="cx"> my %TypeFilters = (
</span><span class="cx"> "any" => "SpecHeapTop",
</span><span class="cx"> "boolean" => "SpecBoolean",
</span><span class="lines">@@ -2592,10 +2590,10 @@
</span><span class="cx"> push(@implContent,"// Functions\n\n");
</span><span class="cx"> foreach my $function (@functions) {
</span><span class="cx"> next if $function->{overloadIndex} && $function->{overloadIndex} > 1;
</span><del>- next if $function->signature->extendedAttributes->{ForwardDeclareInHeader};
</del><ins>+ next if $function->extendedAttributes->{ForwardDeclareInHeader};
</ins><span class="cx"> next if IsJSBuiltin($interface, $function);
</span><span class="cx">
</span><del>- if ($function->signature->extendedAttributes->{AppleCopyright}) {
</del><ins>+ if ($function->extendedAttributes->{AppleCopyright}) {
</ins><span class="cx"> if (!$inAppleCopyright) {
</span><span class="cx"> push(@implContent, $beginAppleCopyrightForHeaderFiles);
</span><span class="cx"> $inAppleCopyright = 1;
</span><span class="lines">@@ -2621,10 +2619,10 @@
</span><span class="cx"> push(@implContent, "// Attributes\n\n");
</span><span class="cx">
</span><span class="cx"> foreach my $attribute (@{$interface->attributes}) {
</span><del>- next if $attribute->signature->extendedAttributes->{ForwardDeclareInHeader};
</del><ins>+ next if $attribute->extendedAttributes->{ForwardDeclareInHeader};
</ins><span class="cx"> next if IsJSBuiltin($interface, $attribute);
</span><span class="cx">
</span><del>- my $conditionalString = $codeGenerator->GenerateConditionalString($attribute->signature);
</del><ins>+ my $conditionalString = $codeGenerator->GenerateConditionalString($attribute);
</ins><span class="cx"> push(@implContent, "#if ${conditionalString}\n") if $conditionalString;
</span><span class="cx"> my $getter = GetAttributeGetterName($interface, $className, $attribute);
</span><span class="cx"> push(@implContent, "JSC::EncodedJSValue ${getter}(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);\n");
</span><span class="lines">@@ -2701,18 +2699,18 @@
</span><span class="cx">
</span><span class="cx"> foreach my $attribute (@{$interface->attributes}) {
</span><span class="cx"> next unless ($attribute->isStatic);
</span><del>- my $name = $attribute->signature->name;
</del><ins>+ my $name = $attribute->name;
</ins><span class="cx"> push(@hashKeys, $name);
</span><span class="cx">
</span><span class="cx"> my @specials = ();
</span><span class="cx"> push(@specials, "DontDelete") if IsUnforgeable($interface, $attribute);
</span><span class="cx"> push(@specials, "ReadOnly") if IsReadonly($attribute);
</span><del>- push(@specials, "DOMJITAttribute") if $attribute->signature->extendedAttributes->{"DOMJIT"};
</del><ins>+ push(@specials, "DOMJITAttribute") if $attribute->extendedAttributes->{"DOMJIT"};
</ins><span class="cx"> my $special = (@specials > 0) ? join(" | ", @specials) : "0";
</span><span class="cx"> push(@hashSpecials, $special);
</span><span class="cx">
</span><del>- if ($attribute->signature->extendedAttributes->{"DOMJIT"}) {
- push(@hashValue1, "domJITGetterSetterFor" . $interface->type->name . $codeGenerator->WK_ucfirst($attribute->signature->name));
</del><ins>+ if ($attribute->extendedAttributes->{"DOMJIT"}) {
+ push(@hashValue1, "domJITGetterSetterFor" . $interface->type->name . $codeGenerator->WK_ucfirst($attribute->name));
</ins><span class="cx"> push(@hashValue2, "0");
</span><span class="cx"> } else {
</span><span class="cx"> my $getter = GetAttributeGetterName($interface, $className, $attribute);
</span><span class="lines">@@ -2726,7 +2724,7 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- my $conditional = $attribute->signature->extendedAttributes->{Conditional};
</del><ins>+ my $conditional = $attribute->extendedAttributes->{Conditional};
</ins><span class="cx"> $conditionals{$name} = $conditional if $conditional;
</span><span class="cx">
</span><span class="cx"> $hashSize++;
</span><span class="lines">@@ -2735,7 +2733,7 @@
</span><span class="cx"> foreach my $function (@{$interface->functions}) {
</span><span class="cx"> next unless ($function->isStatic);
</span><span class="cx"> next if $function->{overloadIndex} && $function->{overloadIndex} > 1;
</span><del>- my $name = $function->signature->name;
</del><ins>+ my $name = $function->name;
</ins><span class="cx"> push(@hashKeys, $name);
</span><span class="cx">
</span><span class="cx"> my $functionName = GetFunctionName($interface, $className, $function);
</span><span class="lines">@@ -2746,7 +2744,7 @@
</span><span class="cx">
</span><span class="cx"> push(@hashSpecials, ComputeFunctionSpecial($interface, $function));
</span><span class="cx">
</span><del>- my $conditional = $function->signature->extendedAttributes->{Conditional};
</del><ins>+ my $conditional = $function->extendedAttributes->{Conditional};
</ins><span class="cx"> $conditionals{$name} = $conditional if $conditional;
</span><span class="cx">
</span><span class="cx"> $hashSize++;
</span><span class="lines">@@ -2821,12 +2819,11 @@
</span><span class="cx"> my @runtimeEnabledProperties = @runtimeEnabledFunctions;
</span><span class="cx"> push(@runtimeEnabledProperties, @runtimeEnabledAttributes);
</span><span class="cx"> foreach my $functionOrAttribute (@runtimeEnabledProperties) {
</span><del>- my $signature = $functionOrAttribute->signature;
- my $conditionalString = $codeGenerator->GenerateConditionalString($signature);
</del><ins>+ my $conditionalString = $codeGenerator->GenerateConditionalString($functionOrAttribute);
</ins><span class="cx"> push(@implContent, "#if ${conditionalString}\n") if $conditionalString;
</span><span class="cx"> AddToImplIncludes("RuntimeEnabledFeatures.h");
</span><del>- my $enable_function = GetRuntimeEnableFunctionName($signature);
- my $name = $signature->name;
</del><ins>+ my $enable_function = GetRuntimeEnableFunctionName($functionOrAttribute);
+ my $name = $functionOrAttribute->name;
</ins><span class="cx"> push(@implContent, " if (!${enable_function}()) {\n");
</span><span class="cx"> push(@implContent, " Identifier propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>(\"$name\"), strlen(\"$name\"));\n");
</span><span class="cx"> push(@implContent, " VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable);\n");
</span><span class="lines">@@ -2837,11 +2834,11 @@
</span><span class="cx">
</span><span class="cx"> my $firstPrivateFunction = 1;
</span><span class="cx"> foreach my $function (@{$interface->functions}) {
</span><del>- next unless ($function->signature->extendedAttributes->{PrivateIdentifier});
</del><ins>+ next unless ($function->extendedAttributes->{PrivateIdentifier});
</ins><span class="cx"> AddToImplIncludes("WebCoreJSClientData.h");
</span><span class="cx"> push(@implContent, " JSVMClientData& clientData = *static_cast<JSVMClientData*>(vm.clientData);\n") if $firstPrivateFunction;
</span><span class="cx"> $firstPrivateFunction = 0;
</span><del>- push(@implContent, " putDirect(vm, clientData.builtinNames()." . $function->signature->name . "PrivateName(), JSFunction::create(vm, globalObject(), 0, String(), " . GetFunctionName($interface, $className, $function) . "), ReadOnly | DontEnum);\n");
</del><ins>+ push(@implContent, " putDirect(vm, clientData.builtinNames()." . $function->name . "PrivateName(), JSFunction::create(vm, globalObject(), 0, String(), " . GetFunctionName($interface, $className, $function) . "), ReadOnly | DontEnum);\n");
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if ($interface->iterable) {
</span><span class="lines">@@ -2914,13 +2911,13 @@
</span><span class="cx"> }
</span><span class="cx"> # Support for RuntimeEnabled attributes on global objects.
</span><span class="cx"> foreach my $attribute (@{$interface->attributes}) {
</span><del>- next unless $attribute->signature->extendedAttributes->{EnabledAtRuntime};
</del><ins>+ next unless $attribute->extendedAttributes->{EnabledAtRuntime};
</ins><span class="cx">
</span><span class="cx"> AddToImplIncludes("RuntimeEnabledFeatures.h");
</span><del>- my $conditionalString = $codeGenerator->GenerateConditionalString($attribute->signature);
</del><ins>+ my $conditionalString = $codeGenerator->GenerateConditionalString($attribute);
</ins><span class="cx"> push(@implContent, "#if ${conditionalString}\n") if $conditionalString;
</span><del>- my $enable_function = GetRuntimeEnableFunctionName($attribute->signature);
- my $attributeName = $attribute->signature->name;
</del><ins>+ my $enable_function = GetRuntimeEnableFunctionName($attribute);
+ my $attributeName = $attribute->name;
</ins><span class="cx"> push(@implContent, " if (${enable_function}()) {\n");
</span><span class="cx"> my $getter = GetAttributeGetterName($interface, $className, $attribute);
</span><span class="cx"> my $setter = IsReadonly($attribute) ? "nullptr" : GetAttributeSetterName($interface, $className, $attribute);
</span><span class="lines">@@ -2933,11 +2930,11 @@
</span><span class="cx">
</span><span class="cx"> # Support PrivateIdentifier attributes on global objects
</span><span class="cx"> foreach my $attribute (@{$interface->attributes}) {
</span><del>- next unless $attribute->signature->extendedAttributes->{PrivateIdentifier};
</del><ins>+ next unless $attribute->extendedAttributes->{PrivateIdentifier};
</ins><span class="cx">
</span><span class="cx"> AddToImplIncludes("WebCoreJSClientData.h");
</span><del>- my $conditionalString = $codeGenerator->GenerateConditionalString($attribute->signature);
- my $attributeName = $attribute->signature->name;
</del><ins>+ my $conditionalString = $codeGenerator->GenerateConditionalString($attribute);
+ my $attributeName = $attribute->name;
</ins><span class="cx"> my $getter = GetAttributeGetterName($interface, $className, $attribute);
</span><span class="cx">
</span><span class="cx"> push(@implContent, "#if ${conditionalString}\n") if $conditionalString;
</span><span class="lines">@@ -2947,14 +2944,14 @@
</span><span class="cx">
</span><span class="cx"> # Support for RuntimeEnabled operations on global objects.
</span><span class="cx"> foreach my $function (@{$interface->functions}) {
</span><del>- next unless $function->signature->extendedAttributes->{EnabledAtRuntime};
</del><ins>+ next unless $function->extendedAttributes->{EnabledAtRuntime};
</ins><span class="cx"> next if $function->{overloadIndex} && $function->{overloadIndex} > 1;
</span><span class="cx">
</span><span class="cx"> AddToImplIncludes("RuntimeEnabledFeatures.h");
</span><del>- my $conditionalString = $codeGenerator->GenerateConditionalString($function->signature);
</del><ins>+ my $conditionalString = $codeGenerator->GenerateConditionalString($function);
</ins><span class="cx"> push(@implContent, "#if ${conditionalString}\n") if $conditionalString;
</span><del>- my $enable_function = GetRuntimeEnableFunctionName($function->signature);
- my $functionName = $function->signature->name;
</del><ins>+ my $enable_function = GetRuntimeEnableFunctionName($function);
+ my $functionName = $function->name;
</ins><span class="cx"> my $implementationFunction = GetFunctionName($interface, $className, $function);
</span><span class="cx"> my $functionLength = GetFunctionLength($function);
</span><span class="cx"> my $jsAttributes = ComputeFunctionSpecial($interface, $function);
</span><span class="lines">@@ -2961,7 +2958,7 @@
</span><span class="cx"> push(@implContent, " if (${enable_function}())\n");
</span><span class="cx">
</span><span class="cx"> my $propertyName = "vm.propertyNames->$functionName";
</span><del>- $propertyName = "static_cast<JSVMClientData*>(vm.clientData)->builtinNames()." . $functionName . "PrivateName()" if $function->signature->extendedAttributes->{PrivateIdentifier};
</del><ins>+ $propertyName = "static_cast<JSVMClientData*>(vm.clientData)->builtinNames()." . $functionName . "PrivateName()" if $function->extendedAttributes->{PrivateIdentifier};
</ins><span class="cx"> if (IsJSBuiltin($interface, $function)) {
</span><span class="cx"> push(@implContent, " putDirectBuiltinFunction(vm, this, $propertyName, $implementationFunction(vm), attributesForStructure($jsAttributes));\n");
</span><span class="cx"> } else {
</span><span class="lines">@@ -3032,7 +3029,7 @@
</span><span class="cx">
</span><span class="cx"> if ($indexedGetterFunction) {
</span><span class="cx"> # FIXME: Should this work for all string types?
</span><del>- if ($indexedGetterFunction->signature->type->name eq "DOMString") {
</del><ins>+ if ($indexedGetterFunction->type->name eq "DOMString") {
</ins><span class="cx"> push(@implContent, " if (LIKELY(index <= MAX_ARRAY_INDEX)) {\n");
</span><span class="cx"> } else {
</span><span class="cx"> push(@implContent, " if (LIKELY(index < thisObject->wrapped().length())) {\n");
</span><span class="lines">@@ -3110,20 +3107,20 @@
</span><span class="cx"> foreach my $attribute (@{$interface->attributes}) {
</span><span class="cx"> next if IsJSBuiltin($interface, $attribute);
</span><span class="cx">
</span><del>- my $name = $attribute->signature->name;
- my $type = $attribute->signature->type;
</del><ins>+ my $name = $attribute->name;
+ my $type = $attribute->type;
</ins><span class="cx"> my $getFunctionName = GetAttributeGetterName($interface, $className, $attribute);
</span><del>- my $implGetterFunctionName = $codeGenerator->WK_lcfirst($attribute->signature->extendedAttributes->{ImplementedAs} || $name);
- my $getterMayThrowLegacyException = $attribute->signature->extendedAttributes->{GetterMayThrowLegacyException};
</del><ins>+ my $implGetterFunctionName = $codeGenerator->WK_lcfirst($attribute->extendedAttributes->{ImplementedAs} || $name);
+ my $getterMayThrowLegacyException = $attribute->extendedAttributes->{GetterMayThrowLegacyException};
</ins><span class="cx">
</span><span class="cx"> $implIncludes{"ExceptionCode.h"} = 1 if $getterMayThrowLegacyException;
</span><span class="cx">
</span><del>- my $attributeConditionalString = $codeGenerator->GenerateConditionalString($attribute->signature);
</del><ins>+ my $attributeConditionalString = $codeGenerator->GenerateConditionalString($attribute);
</ins><span class="cx"> push(@implContent, "#if ${attributeConditionalString}\n") if $attributeConditionalString;
</span><span class="cx">
</span><span class="cx"> if (!$attribute->isStatic || $codeGenerator->IsConstructorType($type)) {
</span><span class="cx"> my $templateParameters = "${getFunctionName}Getter";
</span><del>- if ($attribute->signature->extendedAttributes->{LenientThis}) {
</del><ins>+ if ($attribute->extendedAttributes->{LenientThis}) {
</ins><span class="cx"> $templateParameters .= ", CastedThisErrorBehavior::ReturnEarly";
</span><span class="cx"> } elsif (IsReturningPromise($attribute)) {
</span><span class="cx"> $templateParameters .= ", CastedThisErrorBehavior::RejectPromise";
</span><span class="lines">@@ -3154,7 +3151,7 @@
</span><span class="cx"> push(@implContent, " UNUSED_PARAM(state);\n");
</span><span class="cx">
</span><span class="cx"> my @arguments = ();
</span><del>- if ($getterMayThrowLegacyException && !HasCustomGetter($attribute->signature->extendedAttributes)) {
</del><ins>+ if ($getterMayThrowLegacyException && !HasCustomGetter($attribute->extendedAttributes)) {
</ins><span class="cx"> push(@arguments, "ec");
</span><span class="cx"> push(@implContent, " ExceptionCode ec = 0;\n");
</span><span class="cx"> }
</span><span class="lines">@@ -3161,10 +3158,10 @@
</span><span class="cx">
</span><span class="cx"> # Global constructors can be disabled at runtime.
</span><span class="cx"> if ($codeGenerator->IsConstructorType($type)) {
</span><del>- if ($attribute->signature->extendedAttributes->{EnabledBySetting}) {
</del><ins>+ if ($attribute->extendedAttributes->{EnabledBySetting}) {
</ins><span class="cx"> AddToImplIncludes("Frame.h");
</span><span class="cx"> AddToImplIncludes("Settings.h");
</span><del>- my $enable_function = ToMethodName($attribute->signature->extendedAttributes->{EnabledBySetting}) . "Enabled";
</del><ins>+ my $enable_function = ToMethodName($attribute->extendedAttributes->{EnabledBySetting}) . "Enabled";
</ins><span class="cx"> push(@implContent, " if (UNLIKELY(!thisObject.wrapped().frame()))\n");
</span><span class="cx"> push(@implContent, " return jsUndefined();\n");
</span><span class="cx"> push(@implContent, " Settings& settings = thisObject.wrapped().frame()->settings();\n");
</span><span class="lines">@@ -3173,11 +3170,11 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- $needsVisitChildren = 1 if $attribute->signature->extendedAttributes->{CachedAttribute};
</del><ins>+ $needsVisitChildren = 1 if $attribute->extendedAttributes->{CachedAttribute};
</ins><span class="cx">
</span><span class="cx"> if ($interface->extendedAttributes->{CheckSecurity} &&
</span><del>- !$attribute->signature->extendedAttributes->{DoNotCheckSecurity} &&
- !$attribute->signature->extendedAttributes->{DoNotCheckSecurityOnGetter}) {
</del><ins>+ !$attribute->extendedAttributes->{DoNotCheckSecurity} &&
+ !$attribute->extendedAttributes->{DoNotCheckSecurityOnGetter}) {
</ins><span class="cx"> if ($interfaceName eq "DOMWindow") {
</span><span class="cx"> push(@implContent, " if (!BindingSecurity::shouldAllowAccessToDOMWindow(&state, thisObject.wrapped(), ThrowSecurityError))\n");
</span><span class="cx"> } else {
</span><span class="lines">@@ -3186,7 +3183,7 @@
</span><span class="cx"> push(@implContent, " return jsUndefined();\n");
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if ($attribute->signature->extendedAttributes->{Nondeterministic}) {
</del><ins>+ if ($attribute->extendedAttributes->{Nondeterministic}) {
</ins><span class="cx"> AddToImplIncludes("MemoizedDOMResult.h", "WEB_REPLAY");
</span><span class="cx"> AddToImplIncludes("<replay/InputCursor.h>", "WEB_REPLAY");
</span><span class="cx"> AddToImplIncludes("<wtf/NeverDestroyed.h>", "WEB_REPLAY");
</span><span class="lines">@@ -3202,7 +3199,7 @@
</span><span class="cx"> push(@implContent, " if (cursor.isCapturing()) {\n");
</span><span class="cx"> push(@implContent, " $memoizedType memoizedResult = thisObject.wrapped().$implGetterFunctionName(" . join(", ", @arguments) . ");\n");
</span><span class="cx"> push(@implContent, " cursor.appendInput<MemoizedDOMResult<$memoizedType>>(bindingName.get().string(), memoizedResult, $exceptionCode);\n");
</span><del>- push(@implContent, " JSValue result = " . NativeToJSValueUsingReferences($attribute->signature, 0, $interface, "memoizedResult", "thisObject") . ";\n");
</del><ins>+ push(@implContent, " JSValue result = " . NativeToJSValueUsingReferences($attribute, 0, $interface, "memoizedResult", "thisObject") . ";\n");
</ins><span class="cx"> push(@implContent, " setDOMException(&state, throwScope, ec);\n") if $getterMayThrowLegacyException;
</span><span class="cx"> push(@implContent, " return result;\n");
</span><span class="cx"> push(@implContent, " }\n");
</span><span class="lines">@@ -3212,7 +3209,7 @@
</span><span class="cx"> push(@implContent, " MemoizedDOMResultBase* input = cursor.fetchInput<MemoizedDOMResultBase>();\n");
</span><span class="cx"> push(@implContent, " if (input && input->convertTo<$memoizedType>(memoizedResult)) {\n");
</span><span class="cx"> # FIXME: the generated code should report an error if an input cannot be fetched or converted.
</span><del>- push(@implContent, " JSValue result = " . NativeToJSValueUsingReferences($attribute->signature, 0, $interface, "memoizedResult", "thisObject") . ";\n");
</del><ins>+ push(@implContent, " JSValue result = " . NativeToJSValueUsingReferences($attribute, 0, $interface, "memoizedResult", "thisObject") . ";\n");
</ins><span class="cx"> push(@implContent, " setDOMException(&state, throwScope, input->exceptionCode());\n") if $getterMayThrowLegacyException;
</span><span class="cx"> push(@implContent, " return result;\n");
</span><span class="cx"> push(@implContent, " }\n");
</span><span class="lines">@@ -3220,17 +3217,17 @@
</span><span class="cx"> push(@implContent, "#endif\n");
</span><span class="cx"> } # attribute Nondeterministic
</span><span class="cx">
</span><del>- if (HasCustomGetter($attribute->signature->extendedAttributes)) {
</del><ins>+ if (HasCustomGetter($attribute->extendedAttributes)) {
</ins><span class="cx"> push(@implContent, " return thisObject.$implGetterFunctionName(state);\n");
</span><span class="cx"> } elsif ($type->name eq "EventHandler") {
</span><span class="cx"> $implIncludes{"EventNames.h"} = 1;
</span><del>- my $getter = $attribute->signature->extendedAttributes->{WindowEventHandler} ? "windowEventHandlerAttribute"
- : $attribute->signature->extendedAttributes->{DocumentEventHandler} ? "documentEventHandlerAttribute"
</del><ins>+ my $getter = $attribute->extendedAttributes->{WindowEventHandler} ? "windowEventHandlerAttribute"
+ : $attribute->extendedAttributes->{DocumentEventHandler} ? "documentEventHandlerAttribute"
</ins><span class="cx"> : "eventHandlerAttribute";
</span><span class="cx"> my $eventName = EventHandlerAttributeEventName($attribute);
</span><span class="cx"> push(@implContent, " return $getter(thisObject.wrapped(), $eventName);\n");
</span><del>- } elsif ($codeGenerator->IsConstructorType($attribute->signature->type)) {
- my $constructorType = $attribute->signature->type->name;
</del><ins>+ } elsif ($codeGenerator->IsConstructorType($attribute->type)) {
+ my $constructorType = $attribute->type->name;
</ins><span class="cx"> $constructorType =~ s/Constructor$//;
</span><span class="cx"> # When Constructor attribute is used by DOMWindow.idl, it's correct to pass thisObject as the global object
</span><span class="cx"> # When JSDOMWrappers have a back-pointer to the globalObject we can pass thisObject->globalObject()
</span><span class="lines">@@ -3239,33 +3236,33 @@
</span><span class="cx"> $constructorType =~ s/Named$//;
</span><span class="cx"> push(@implContent, " return JS" . $constructorType . "::get${named}Constructor(state.vm(), &thisObject);\n");
</span><span class="cx"> } else {
</span><del>- AddToImplIncludes("JS" . $constructorType . ".h", $attribute->signature->extendedAttributes->{Conditional});
</del><ins>+ AddToImplIncludes("JS" . $constructorType . ".h", $attribute->extendedAttributes->{Conditional});
</ins><span class="cx"> push(@implContent, " return JS" . $constructorType . "::getConstructor(state.vm(), thisObject.globalObject());\n");
</span><span class="cx"> }
</span><del>- } elsif (!$attribute->signature->extendedAttributes->{GetterMayThrowLegacyException}) {
</del><ins>+ } elsif (!$attribute->extendedAttributes->{GetterMayThrowLegacyException}) {
</ins><span class="cx"> my $cacheIndex = 0;
</span><del>- if ($attribute->signature->extendedAttributes->{CachedAttribute}) {
</del><ins>+ if ($attribute->extendedAttributes->{CachedAttribute}) {
</ins><span class="cx"> $cacheIndex = $currentCachedAttribute;
</span><span class="cx"> $currentCachedAttribute++;
</span><del>- push(@implContent, " if (JSValue cachedValue = thisObject.m_" . $attribute->signature->name . ".get())\n");
</del><ins>+ push(@implContent, " if (JSValue cachedValue = thisObject.m_" . $attribute->name . ".get())\n");
</ins><span class="cx"> push(@implContent, " return cachedValue;\n");
</span><span class="cx"> }
</span><span class="cx">
</span><del>- my @callWithArgs = GenerateCallWithUsingReferences($attribute->signature->extendedAttributes->{CallWith}, \@implContent, "jsUndefined()");
</del><ins>+ my @callWithArgs = GenerateCallWithUsingReferences($attribute->extendedAttributes->{CallWith}, \@implContent, "jsUndefined()");
</ins><span class="cx">
</span><span class="cx"> if ($svgListPropertyType) {
</span><del>- push(@implContent, " JSValue result = " . NativeToJSValueUsingReferences($attribute->signature, 0, $interface, "thisObject.wrapped().$implGetterFunctionName(" . (join ", ", @callWithArgs) . ")", "thisObject") . ";\n");
</del><ins>+ push(@implContent, " JSValue result = " . NativeToJSValueUsingReferences($attribute, 0, $interface, "thisObject.wrapped().$implGetterFunctionName(" . (join ", ", @callWithArgs) . ")", "thisObject") . ";\n");
</ins><span class="cx"> } elsif ($svgPropertyOrListPropertyType) {
</span><span class="cx"> push(@implContent, " $svgPropertyOrListPropertyType& impl = thisObject.wrapped().propertyReference();\n");
</span><span class="cx"> if ($svgPropertyOrListPropertyType eq "float") { # Special case for JSSVGNumber
</span><del>- push(@implContent, " JSValue result = " . NativeToJSValueUsingReferences($attribute->signature, 0, $interface, "impl", "thisObject") . ";\n");
</del><ins>+ push(@implContent, " JSValue result = " . NativeToJSValueUsingReferences($attribute, 0, $interface, "impl", "thisObject") . ";\n");
</ins><span class="cx"> } else {
</span><del>- push(@implContent, " JSValue result = " . NativeToJSValueUsingReferences($attribute->signature, 0, $interface, "impl.$implGetterFunctionName(" . (join ", ", @callWithArgs) . ")", "thisObject") . ";\n");
</del><ins>+ push(@implContent, " JSValue result = " . NativeToJSValueUsingReferences($attribute, 0, $interface, "impl.$implGetterFunctionName(" . (join ", ", @callWithArgs) . ")", "thisObject") . ";\n");
</ins><span class="cx">
</span><span class="cx"> }
</span><span class="cx"> } else {
</span><span class="cx"> my ($functionName, @arguments) = $codeGenerator->GetterExpression(\%implIncludes, $interfaceName, $attribute);
</span><del>- my $implementedBy = $attribute->signature->extendedAttributes->{ImplementedBy};
</del><ins>+ my $implementedBy = $attribute->extendedAttributes->{ImplementedBy};
</ins><span class="cx"> if ($implementedBy) {
</span><span class="cx"> $implIncludes{"${implementedBy}.h"} = 1;
</span><span class="cx"> $functionName = "WebCore::${implementedBy}::${functionName}";
</span><span class="lines">@@ -3277,7 +3274,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> unshift(@arguments, @callWithArgs);
</span><del>- my $jsType = NativeToJSValueUsingReferences($attribute->signature, 0, $interface, "${functionName}(" . join(", ", @arguments) . ")", "thisObject");
</del><ins>+ my $jsType = NativeToJSValueUsingReferences($attribute, 0, $interface, "${functionName}(" . join(", ", @arguments) . ")", "thisObject");
</ins><span class="cx"> push(@implContent, " auto& impl = thisObject.wrapped();\n") if !$attribute->isStatic;
</span><span class="cx"> if ($codeGenerator->IsSVGAnimatedType($type)) {
</span><span class="cx"> push(@implContent, " auto obj = $jsType;\n");
</span><span class="lines">@@ -3287,18 +3284,18 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- push(@implContent, " thisObject.m_" . $attribute->signature->name . ".set(state.vm(), &thisObject, result);\n") if $attribute->signature->extendedAttributes->{CachedAttribute};
</del><ins>+ push(@implContent, " thisObject.m_" . $attribute->name . ".set(state.vm(), &thisObject, result);\n") if $attribute->extendedAttributes->{CachedAttribute};
</ins><span class="cx"> push(@implContent, " return result;\n");
</span><span class="cx">
</span><span class="cx"> } else {
</span><del>- unshift(@arguments, GenerateCallWithUsingReferences($attribute->signature->extendedAttributes->{CallWith}, \@implContent, "jsUndefined()", 0));
</del><ins>+ unshift(@arguments, GenerateCallWithUsingReferences($attribute->extendedAttributes->{CallWith}, \@implContent, "jsUndefined()", 0));
</ins><span class="cx">
</span><span class="cx"> if ($svgPropertyOrListPropertyType) {
</span><span class="cx"> push(@implContent, " $svgPropertyOrListPropertyType impl(*thisObject.wrapped());\n");
</span><del>- push(@implContent, " JSValue result = " . NativeToJSValueUsingReferences($attribute->signature, 0, $interface, "impl.$implGetterFunctionName(" . join(", ", @arguments) . ")", "thisObject") . ";\n");
</del><ins>+ push(@implContent, " JSValue result = " . NativeToJSValueUsingReferences($attribute, 0, $interface, "impl.$implGetterFunctionName(" . join(", ", @arguments) . ")", "thisObject") . ";\n");
</ins><span class="cx"> } else {
</span><span class="cx"> push(@implContent, " auto& impl = thisObject.wrapped();\n");
</span><del>- push(@implContent, " JSValue result = " . NativeToJSValueUsingReferences($attribute->signature, 0, $interface, "impl.$implGetterFunctionName(" . join(", ", @arguments) . ")", "thisObject") . ";\n");
</del><ins>+ push(@implContent, " JSValue result = " . NativeToJSValueUsingReferences($attribute, 0, $interface, "impl.$implGetterFunctionName(" . join(", ", @arguments) . ")", "thisObject") . ";\n");
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> push(@implContent, " setDOMException(&state, throwScope, ec);\n");
</span><span class="lines">@@ -3308,15 +3305,15 @@
</span><span class="cx">
</span><span class="cx"> push(@implContent, "}\n\n");
</span><span class="cx">
</span><del>- if ($attribute->signature->extendedAttributes->{"DOMJIT"}) {
</del><ins>+ if ($attribute->extendedAttributes->{"DOMJIT"}) {
</ins><span class="cx"> $implIncludes{"<wtf/NeverDestroyed.h>"} = 1;
</span><span class="cx"> my $interfaceName = $interface->type->name;
</span><del>- my $attributeName = $attribute->signature->name;
- my $generatorName = $interfaceName . $codeGenerator->WK_ucfirst($attribute->signature->name);
</del><ins>+ my $attributeName = $attribute->name;
+ my $generatorName = $interfaceName . $codeGenerator->WK_ucfirst($attribute->name);
</ins><span class="cx"> my $domJITClassName = $generatorName . "DOMJIT";
</span><span class="cx"> my $getter = GetAttributeGetterName($interface, $generatorName, $attribute);
</span><span class="cx"> my $setter = IsReadonly($attribute) ? "nullptr" : GetAttributeSetterName($interface, $generatorName, $attribute);
</span><del>- my $resultType = GetResultTypeFilter($attribute->signature);
</del><ins>+ my $resultType = GetResultTypeFilter($attribute->type);
</ins><span class="cx"> push(@implContent, "$domJITClassName::$domJITClassName()\n");
</span><span class="cx"> push(@implContent, " : JSC::DOMJIT::GetterSetter($getter, $setter, ${className}::info(), $resultType)\n");
</span><span class="cx"> push(@implContent, "{\n");
</span><span class="lines">@@ -3426,21 +3423,21 @@
</span><span class="cx"> if (!IsReadonly($attribute)) {
</span><span class="cx"> next if IsJSBuiltin($interface, $attribute);
</span><span class="cx">
</span><del>- my $name = $attribute->signature->name;
- my $type = $attribute->signature->type;
</del><ins>+ my $name = $attribute->name;
+ my $type = $attribute->type;
</ins><span class="cx"> my $putFunctionName = GetAttributeSetterName($interface, $className, $attribute);
</span><span class="cx"> my $implSetterFunctionName = $codeGenerator->WK_ucfirst($name);
</span><del>- my $setterMayThrowLegacyException = $attribute->signature->extendedAttributes->{SetterMayThrowLegacyException};
</del><ins>+ my $setterMayThrowLegacyException = $attribute->extendedAttributes->{SetterMayThrowLegacyException};
</ins><span class="cx">
</span><span class="cx"> $implIncludes{"ExceptionCode.h"} = 1 if $setterMayThrowLegacyException;
</span><span class="cx">
</span><del>- my $attributeConditionalString = $codeGenerator->GenerateConditionalString($attribute->signature);
</del><ins>+ my $attributeConditionalString = $codeGenerator->GenerateConditionalString($attribute);
</ins><span class="cx"> push(@implContent, "#if ${attributeConditionalString}\n") if $attributeConditionalString;
</span><span class="cx">
</span><span class="cx"> if (!$attribute->isStatic) {
</span><span class="cx"> my $setterFunction = "${putFunctionName}Function";
</span><span class="cx"> my $templateParameters = $setterFunction;
</span><del>- $templateParameters .= ", CastedThisErrorBehavior::ReturnEarly" if $attribute->signature->extendedAttributes->{LenientThis};
</del><ins>+ $templateParameters .= ", CastedThisErrorBehavior::ReturnEarly" if $attribute->extendedAttributes->{LenientThis};
</ins><span class="cx">
</span><span class="cx"> push(@implContent, "static inline bool ${setterFunction}(ExecState&, ${className}&, JSValue, ThrowScope&);\n\n");
</span><span class="cx">
</span><span class="lines">@@ -3462,7 +3459,7 @@
</span><span class="cx"> push(@implContent, " auto value = JSValue::decode(encodedValue);\n");
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if ($attribute->signature->extendedAttributes->{CEReactions}) {
</del><ins>+ if ($attribute->extendedAttributes->{CEReactions}) {
</ins><span class="cx"> push(@implContent, "#if ENABLE(CUSTOM_ELEMENTS)\n");
</span><span class="cx"> push(@implContent, " CustomElementReactionStack customElementReactionStack;\n");
</span><span class="cx"> push(@implContent, "#endif\n");
</span><span class="lines">@@ -3469,7 +3466,7 @@
</span><span class="cx"> $implIncludes{"CustomElementReactionQueue.h"} = 1;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if ($interface->extendedAttributes->{CheckSecurity} && !$attribute->signature->extendedAttributes->{DoNotCheckSecurity} && !$attribute->signature->extendedAttributes->{DoNotCheckSecurityOnSetter}) {
</del><ins>+ if ($interface->extendedAttributes->{CheckSecurity} && !$attribute->extendedAttributes->{DoNotCheckSecurity} && !$attribute->extendedAttributes->{DoNotCheckSecurityOnSetter}) {
</ins><span class="cx"> if ($interfaceName eq "DOMWindow") {
</span><span class="cx"> push(@implContent, " if (!BindingSecurity::shouldAllowAccessToDOMWindow(&state, thisObject.wrapped(), ThrowSecurityError))\n");
</span><span class="cx"> } else {
</span><span class="lines">@@ -3478,7 +3475,7 @@
</span><span class="cx"> push(@implContent, " return false;\n");
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (HasCustomSetter($attribute->signature->extendedAttributes)) {
</del><ins>+ if (HasCustomSetter($attribute->extendedAttributes)) {
</ins><span class="cx"> push(@implContent, " thisObject.set$implSetterFunctionName(state, value);\n");
</span><span class="cx"> push(@implContent, " return true;\n");
</span><span class="cx"> } elsif ($type->name eq "EventHandler") {
</span><span class="lines">@@ -3490,8 +3487,8 @@
</span><span class="cx"> push(@implContent, " thisObject.wrapped().setAttributeEventListener($eventName, createJSErrorHandler(&state, value, &thisObject));\n");
</span><span class="cx"> } else {
</span><span class="cx"> $implIncludes{"JSEventListener.h"} = 1;
</span><del>- my $setter = $attribute->signature->extendedAttributes->{WindowEventHandler} ? "setWindowEventHandlerAttribute"
- : $attribute->signature->extendedAttributes->{DocumentEventHandler} ? "setDocumentEventHandlerAttribute"
</del><ins>+ my $setter = $attribute->extendedAttributes->{WindowEventHandler} ? "setWindowEventHandlerAttribute"
+ : $attribute->extendedAttributes->{DocumentEventHandler} ? "setDocumentEventHandlerAttribute"
</ins><span class="cx"> : "setEventHandlerAttribute";
</span><span class="cx"> push(@implContent, " $setter(state, thisObject, thisObject.wrapped(), $eventName, value);\n");
</span><span class="cx"> }
</span><span class="lines">@@ -3503,11 +3500,11 @@
</span><span class="cx"> # We do not generate the header file for NamedConstructor of class XXXX,
</span><span class="cx"> # since we generate the NamedConstructor declaration into the header file of class XXXX.
</span><span class="cx"> if ($constructorType ne "any" and $constructorType !~ /Named$/) {
</span><del>- AddToImplIncludes("JS" . $constructorType . ".h", $attribute->signature->extendedAttributes->{Conditional});
</del><ins>+ AddToImplIncludes("JS" . $constructorType . ".h", $attribute->extendedAttributes->{Conditional});
</ins><span class="cx"> }
</span><span class="cx"> push(@implContent, " // Shadowing a built-in constructor.\n");
</span><span class="cx"> push(@implContent, " return thisObject.putDirect(state.vm(), Identifier::fromString(&state, \"$name\"), value);\n");
</span><del>- } elsif ($attribute->signature->extendedAttributes->{Replaceable}) {
</del><ins>+ } elsif ($attribute->extendedAttributes->{Replaceable}) {
</ins><span class="cx"> push(@implContent, " // Shadowing a built-in property.\n");
</span><span class="cx"> if (AttributeShouldBeOnInstance($interface, $attribute)) {
</span><span class="cx"> push(@implContent, " return replaceStaticPropertySlot(state.vm(), &thisObject, Identifier::fromString(&state, \"$name\"), value);\n");
</span><span class="lines">@@ -3516,12 +3513,12 @@
</span><span class="cx"> }
</span><span class="cx"> } else {
</span><span class="cx"> if (!$attribute->isStatic) {
</span><del>- my $putForwards = $attribute->signature->extendedAttributes->{PutForwards};
</del><ins>+ my $putForwards = $attribute->extendedAttributes->{PutForwards};
</ins><span class="cx"> if ($putForwards) {
</span><del>- my $implGetterFunctionName = $codeGenerator->WK_lcfirst($attribute->signature->extendedAttributes->{ImplementedAs} || $name);
</del><ins>+ my $implGetterFunctionName = $codeGenerator->WK_lcfirst($attribute->extendedAttributes->{ImplementedAs} || $name);
</ins><span class="cx"> my $forwardedAttribute = $codeGenerator->GetAttributeFromInterface($interface, $type->name, $putForwards);
</span><span class="cx">
</span><del>- if ($forwardedAttribute->signature->extendedAttributes->{CEReactions}) {
</del><ins>+ if ($forwardedAttribute->extendedAttributes->{CEReactions}) {
</ins><span class="cx"> push(@implContent, "#if ENABLE(CUSTOM_ELEMENTS)\n");
</span><span class="cx"> push(@implContent, " CustomElementReactionStack customElementReactionStack;\n");
</span><span class="cx"> push(@implContent, "#endif\n");
</span><span class="lines">@@ -3539,7 +3536,7 @@
</span><span class="cx"> push(@implContent, " auto& impl = forwardedImpl.get();\n");
</span><span class="cx"> }
</span><span class="cx"> $attribute = $forwardedAttribute;
</span><del>- $type = $attribute->signature->type;
</del><ins>+ $type = $attribute->type;
</ins><span class="cx"> } else {
</span><span class="cx"> push(@implContent, " auto& impl = thisObject.wrapped();\n");
</span><span class="cx"> }
</span><span class="lines">@@ -3547,12 +3544,12 @@
</span><span class="cx">
</span><span class="cx"> push(@implContent, " ExceptionCode ec = 0;\n") if $setterMayThrowLegacyException;
</span><span class="cx">
</span><del>- my $shouldPassByReference = ShouldPassWrapperByReference($attribute->signature, $interface);
</del><ins>+ my $shouldPassByReference = ShouldPassWrapperByReference($attribute, $interface);
</ins><span class="cx">
</span><del>- my ($nativeValue, $mayThrowException) = JSValueToNative($interface, $attribute->signature, "value", $attribute->signature->extendedAttributes->{Conditional}, "&state", "state", "thisObject");
</del><ins>+ my ($nativeValue, $mayThrowException) = JSValueToNative($interface, $attribute, "value", $attribute->extendedAttributes->{Conditional}, "&state", "state", "thisObject");
</ins><span class="cx"> if (!$shouldPassByReference && ($codeGenerator->IsWrapperType($type) || $codeGenerator->IsTypedArrayType($type))) {
</span><span class="cx"> $implIncludes{"<runtime/Error.h>"} = 1;
</span><del>- push(@implContent, " " . GetNativeTypeFromSignature($interface, $attribute->signature) . " nativeValue = nullptr;\n");
</del><ins>+ push(@implContent, " " . GetNativeType($interface, $attribute->type) . " nativeValue = nullptr;\n");
</ins><span class="cx"> push(@implContent, " if (!value.isUndefinedOrNull()) {\n");
</span><span class="cx"> push(@implContent, " nativeValue = $nativeValue;\n");
</span><span class="cx"> push(@implContent, " RETURN_IF_EXCEPTION(throwScope, false);\n") if $mayThrowException;
</span><span class="lines">@@ -3593,7 +3590,7 @@
</span><span class="cx"> my $functionString = "podImpl.set$implSetterFunctionName(nativeValue";
</span><span class="cx"> $functionString .= ", ec" if $setterMayThrowLegacyException;
</span><span class="cx"> $functionString .= ")";
</span><del>- $functionString = "propagateException(state, throwScope, $functionString)" if $attribute->signature->extendedAttributes->{SetterMayThrowException};
</del><ins>+ $functionString = "propagateException(state, throwScope, $functionString)" if $attribute->extendedAttributes->{SetterMayThrowException};
</ins><span class="cx"> push(@implContent, " $functionString;\n");
</span><span class="cx"> push(@implContent, " setDOMException(&state, throwScope, ec);\n") if $setterMayThrowLegacyException;
</span><span class="cx"> }
</span><span class="lines">@@ -3616,9 +3613,9 @@
</span><span class="cx"> } else {
</span><span class="cx"> push(@arguments, $shouldPassByReference ? "*nativeValue" : "WTFMove(nativeValue)");
</span><span class="cx"> }
</span><del>- my $implementedBy = $attribute->signature->extendedAttributes->{ImplementedBy};
</del><ins>+ my $implementedBy = $attribute->extendedAttributes->{ImplementedBy};
</ins><span class="cx"> if ($implementedBy) {
</span><del>- AddToImplIncludes("${implementedBy}.h", $attribute->signature->extendedAttributes->{Conditional});
</del><ins>+ AddToImplIncludes("${implementedBy}.h", $attribute->extendedAttributes->{Conditional});
</ins><span class="cx"> unshift(@arguments, "impl") if !$attribute->isStatic;
</span><span class="cx"> $functionName = "WebCore::${implementedBy}::${functionName}";
</span><span class="cx"> } elsif ($attribute->isStatic) {
</span><span class="lines">@@ -3627,13 +3624,13 @@
</span><span class="cx"> $functionName = "impl.${functionName}";
</span><span class="cx"> }
</span><span class="cx">
</span><del>- unshift(@arguments, GenerateCallWithUsingReferences($attribute->signature->extendedAttributes->{SetterCallWith}, \@implContent, "false"));
- unshift(@arguments, GenerateCallWithUsingReferences($attribute->signature->extendedAttributes->{CallWith}, \@implContent, "false"));
</del><ins>+ unshift(@arguments, GenerateCallWithUsingReferences($attribute->extendedAttributes->{SetterCallWith}, \@implContent, "false"));
+ unshift(@arguments, GenerateCallWithUsingReferences($attribute->extendedAttributes->{CallWith}, \@implContent, "false"));
</ins><span class="cx">
</span><span class="cx"> push(@arguments, "ec") if $setterMayThrowLegacyException;
</span><span class="cx">
</span><span class="cx"> my $functionString = "$functionName(" . join(", ", @arguments) . ")";
</span><del>- $functionString = "propagateException(state, throwScope, $functionString)" if $attribute->signature->extendedAttributes->{SetterMayThrowException};
</del><ins>+ $functionString = "propagateException(state, throwScope, $functionString)" if $attribute->extendedAttributes->{SetterMayThrowException};
</ins><span class="cx">
</span><span class="cx"> push(@implContent, " $functionString;\n");
</span><span class="cx"> push(@implContent, " setDOMException(&state, throwScope, ec);\n") if $setterMayThrowLegacyException;
</span><span class="lines">@@ -3683,7 +3680,7 @@
</span><span class="cx"> my $inAppleCopyright = 0;
</span><span class="cx"> foreach my $function (@{$interface->functions}) {
</span><span class="cx"> next if IsJSBuiltin($interface, $function);
</span><del>- if ($function->signature->extendedAttributes->{AppleCopyright}) {
</del><ins>+ if ($function->extendedAttributes->{AppleCopyright}) {
</ins><span class="cx"> if (!$inAppleCopyright) {
</span><span class="cx"> push(@implContent, $beginAppleCopyrightForSourceFiles);
</span><span class="cx"> $inAppleCopyright = 1;
</span><span class="lines">@@ -3693,18 +3690,18 @@
</span><span class="cx"> $inAppleCopyright = 0;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- my $isCustom = HasCustomMethod($function->signature->extendedAttributes);
</del><ins>+ my $isCustom = HasCustomMethod($function->extendedAttributes);
</ins><span class="cx"> my $isOverloaded = $function->{overloads} && @{$function->{overloads}} > 1;
</span><span class="cx">
</span><del>- my $mayThrowLegacyException = $function->signature->extendedAttributes->{MayThrowLegacyException};
</del><ins>+ my $mayThrowLegacyException = $function->extendedAttributes->{MayThrowLegacyException};
</ins><span class="cx">
</span><span class="cx"> next if $isCustom && $isOverloaded && $function->{overloadIndex} > 1;
</span><span class="cx">
</span><del>- AddToImplIncludesForIDLType($function->signature->type) unless $isCustom or IsReturningPromise($function);
</del><ins>+ AddToImplIncludesForIDLType($function->type) unless $isCustom or IsReturningPromise($function);
</ins><span class="cx">
</span><span class="cx"> my $functionName = GetFunctionName($interface, $className, $function);
</span><span class="cx">
</span><del>- my $conditional = $function->signature->extendedAttributes->{Conditional};
</del><ins>+ my $conditional = $function->extendedAttributes->{Conditional};
</ins><span class="cx"> if ($conditional) {
</span><span class="cx"> my $conditionalString = $codeGenerator->GenerateConditionalStringFromAttributeValue($conditional);
</span><span class="cx"> push(@implContent, "#if ${conditionalString}\n");
</span><span class="lines">@@ -3718,7 +3715,7 @@
</span><span class="cx"> $functionReturn = "static inline EncodedJSValue";
</span><span class="cx"> }
</span><span class="cx">
</span><del>- my $functionImplementationName = $function->signature->extendedAttributes->{ImplementedAs} || $codeGenerator->WK_lcfirst($function->signature->name);
</del><ins>+ my $functionImplementationName = $function->extendedAttributes->{ImplementedAs} || $codeGenerator->WK_lcfirst($function->name);
</ins><span class="cx">
</span><span class="cx"> AddToImplIncludes("JSDOMPromise.h") if IsReturningPromise($function);
</span><span class="cx">
</span><span class="lines">@@ -3750,7 +3747,7 @@
</span><span class="cx">
</span><span class="cx"> $implIncludes{"<runtime/Error.h>"} = 1;
</span><span class="cx">
</span><del>- if ($function->signature->extendedAttributes->{CEReactions}) {
</del><ins>+ if ($function->extendedAttributes->{CEReactions}) {
</ins><span class="cx"> push(@implContent, "#if ENABLE(CUSTOM_ELEMENTS)\n");
</span><span class="cx"> push(@implContent, " CustomElementReactionStack customElementReactionStack;\n");
</span><span class="cx"> push(@implContent, "#endif\n");
</span><span class="lines">@@ -3774,10 +3771,10 @@
</span><span class="cx"> GenerateImplementationFunctionCall($function, $functionString, " ", $svgPropertyType, $interface);
</span><span class="cx"> }
</span><span class="cx"> } else {
</span><del>- my $methodName = $function->signature->name;
</del><ins>+ my $methodName = $function->name;
</ins><span class="cx"> if (IsReturningPromise($function) && !$isCustom) {
</span><span class="cx"> my $templateParameters = "${functionName}Caller";
</span><del>- $templateParameters .= ", CastedThisErrorBehavior::Assert" if ($function->signature->extendedAttributes->{PrivateIdentifier} and not $function->signature->extendedAttributes->{PublicIdentifier});
</del><ins>+ $templateParameters .= ", CastedThisErrorBehavior::Assert" if ($function->extendedAttributes->{PrivateIdentifier} and not $function->extendedAttributes->{PublicIdentifier});
</ins><span class="cx"> push(@implContent, " return BindingCaller<$className>::callPromiseOperation<${templateParameters}>(state, WTFMove(promise), \"${methodName}\");\n");
</span><span class="cx"> push(@implContent, "}\n");
</span><span class="cx"> push(@implContent, "\n");
</span><span class="lines">@@ -3785,7 +3782,7 @@
</span><span class="cx"> } else {
</span><span class="cx"> my $classParameterType = $className eq "JSEventTarget" ? "JSEventTargetWrapper*" : "${className}*";
</span><span class="cx"> my $templateParameters = "${functionName}Caller";
</span><del>- if ($function->signature->extendedAttributes->{PrivateIdentifier} and not $function->signature->extendedAttributes->{PublicIdentifier}) {
</del><ins>+ if ($function->extendedAttributes->{PrivateIdentifier} and not $function->extendedAttributes->{PublicIdentifier}) {
</ins><span class="cx"> $templateParameters .= ", CastedThisErrorBehavior::Assert";
</span><span class="cx"> } elsif (IsReturningPromise($function)) {
</span><span class="cx"> # FIXME: We need this specific handling for custom promise-returning functions.
</span><span class="lines">@@ -3803,7 +3800,7 @@
</span><span class="cx"> push(@implContent, " UNUSED_PARAM(state);\n");
</span><span class="cx"> push(@implContent, " UNUSED_PARAM(throwScope);\n");
</span><span class="cx">
</span><del>- if ($interface->extendedAttributes->{CheckSecurity} and !$function->signature->extendedAttributes->{DoNotCheckSecurity}) {
</del><ins>+ if ($interface->extendedAttributes->{CheckSecurity} and !$function->extendedAttributes->{DoNotCheckSecurity}) {
</ins><span class="cx"> if ($interfaceName eq "DOMWindow") {
</span><span class="cx"> push(@implContent, " if (!BindingSecurity::shouldAllowAccessToDOMWindow(state, castedThis->wrapped(), ThrowSecurityError))\n");
</span><span class="cx"> } else {
</span><span class="lines">@@ -3870,8 +3867,8 @@
</span><span class="cx"> if ($numCachedAttributes > 0) {
</span><span class="cx"> foreach (@{$interface->attributes}) {
</span><span class="cx"> my $attribute = $_;
</span><del>- if ($attribute->signature->extendedAttributes->{CachedAttribute}) {
- push(@implContent, " visitor.append(&thisObject->m_" . $attribute->signature->name . ");\n");
</del><ins>+ if ($attribute->extendedAttributes->{CachedAttribute}) {
+ push(@implContent, " visitor.append(&thisObject->m_" . $attribute->name . ");\n");
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -3893,7 +3890,7 @@
</span><span class="cx">
</span><span class="cx"> if ($indexedGetterFunction) {
</span><span class="cx"> # FIXME: Should this work for all string types.
</span><del>- $implIncludes{"URL.h"} = 1 if $indexedGetterFunction->signature->type->name eq "DOMString";
</del><ins>+ $implIncludes{"URL.h"} = 1 if $indexedGetterFunction->type->name eq "DOMString";
</ins><span class="cx"> if ($interfaceName =~ /^HTML\w*Collection$/ or $interfaceName eq "RadioNodeList") {
</span><span class="cx"> $implIncludes{"JSNode.h"} = 1;
</span><span class="cx"> $implIncludes{"Node.h"} = 1;
</span><span class="lines">@@ -4086,21 +4083,21 @@
</span><span class="cx"> push(@implContent, "\n");
</span><span class="cx">
</span><span class="cx"> my @serializedAttributes = ();
</span><del>- foreach my $attribute_name (@{$interface->serializable->attributes}) {
- my $found_attribute = 0;
</del><ins>+ foreach my $attributeName (@{$interface->serializable->attributes}) {
+ my $foundAttribute = 0;
</ins><span class="cx"> foreach my $attribute (@{$interface->attributes}) {
</span><del>- if ($attribute_name eq $attribute->signature->name) {
</del><ins>+ if ($attributeName eq $attribute->name) {
</ins><span class="cx"> push @serializedAttributes, $attribute;
</span><del>- $found_attribute = 1;
</del><ins>+ $foundAttribute = 1;
</ins><span class="cx"> last;
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- die "Failed to find \"serializer\" attribute \"$attribute_name\" in $interfaceName" if !$found_attribute;
</del><ins>+ die "Failed to find \"serializer\" attribute \"$attributeName\" in $interfaceName" if !$foundAttribute;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> foreach my $attribute (@serializedAttributes) {
</span><del>- my $name = $attribute->signature->name;
</del><ins>+ my $name = $attribute->name;
</ins><span class="cx">
</span><span class="cx"> my $getFunctionName = GetAttributeGetterName($interface, $className, $attribute);
</span><span class="cx"> push(@implContent, " auto ${name}Value = ${getFunctionName}Getter(*state, *thisObject, throwScope);\n");
</span><span class="lines">@@ -4178,7 +4175,7 @@
</span><span class="cx"> push(@callWithArgs, "*document");
</span><span class="cx"> }
</span><span class="cx"> if ($function and $codeGenerator->ExtendedAttributeContains($callWith, "ScriptArguments")) {
</span><del>- push(@$outputArray, " RefPtr<Inspector::ScriptArguments> scriptArguments(Inspector::createScriptArguments($statePointer, " . @{$function->parameters} . "));\n");
</del><ins>+ push(@$outputArray, " RefPtr<Inspector::ScriptArguments> scriptArguments(Inspector::createScriptArguments($statePointer, " . @{$function->arguments} . "));\n");
</ins><span class="cx"> $implIncludes{"<inspector/ScriptArguments.h>"} = 1;
</span><span class="cx"> $implIncludes{"<inspector/ScriptCallStackFactory.h>"} = 1;
</span><span class="cx"> push(@callWithArgs, "WTFMove(scriptArguments)");
</span><span class="lines">@@ -4196,17 +4193,16 @@
</span><span class="cx"> my $function = shift;
</span><span class="cx"> my $interface = shift;
</span><span class="cx">
</span><del>- my $numMandatoryParams = @{$function->parameters};
- foreach my $param (reverse(@{$function->parameters})) {
- if ($param->isOptional or $param->isVariadic) {
- $numMandatoryParams--;
</del><ins>+ my $numMandatoryArguments = @{$function->arguments};
+ foreach my $argument (reverse(@{$function->arguments})) {
+ if ($argument->isOptional or $argument->isVariadic) {
+ $numMandatoryArguments--;
</ins><span class="cx"> } else {
</span><span class="cx"> last;
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>- if ($numMandatoryParams >= 1)
- {
- push(@$outputArray, " if (UNLIKELY(state->argumentCount() < $numMandatoryParams))\n");
</del><ins>+ if ($numMandatoryArguments >= 1) {
+ push(@$outputArray, " if (UNLIKELY(state->argumentCount() < $numMandatoryArguments))\n");
</ins><span class="cx"> push(@$outputArray, " return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));\n");
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -4259,9 +4255,9 @@
</span><span class="cx"> {
</span><span class="cx"> my ($function) = @_;
</span><span class="cx">
</span><del>- return 0 unless $function->signature->extendedAttributes->{MayThrowException};
</del><ins>+ return 0 unless $function->extendedAttributes->{MayThrowException};
</ins><span class="cx">
</span><del>- return 1 if $function->signature->type && $function->signature->type->name eq "void";
</del><ins>+ return 1 if $function->type && $function->type->name eq "void";
</ins><span class="cx"> return 1 if IsReturningPromise($function);
</span><span class="cx">
</span><span class="cx"> return 0;
</span><span class="lines">@@ -4275,11 +4271,11 @@
</span><span class="cx"> my $visibleInterfaceName = $codeGenerator->GetVisibleInterfaceName($interface);
</span><span class="cx"> my @arguments;
</span><span class="cx"> my $functionName;
</span><del>- my $implementedBy = $function->signature->extendedAttributes->{ImplementedBy};
- my $numParameters = @{$function->parameters};
</del><ins>+ my $implementedBy = $function->extendedAttributes->{ImplementedBy};
+ my $numArguments = @{$function->arguments};
</ins><span class="cx">
</span><span class="cx"> if ($implementedBy) {
</span><del>- AddToImplIncludes("${implementedBy}.h", $function->signature->extendedAttributes->{Conditional});
</del><ins>+ AddToImplIncludes("${implementedBy}.h", $function->extendedAttributes->{Conditional});
</ins><span class="cx"> unshift(@arguments, "impl") if !$function->isStatic;
</span><span class="cx"> $functionName = "WebCore::${implementedBy}::${functionImplementationName}";
</span><span class="cx"> } elsif ($function->isStatic) {
</span><span class="lines">@@ -4291,10 +4287,10 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> my $quotedFunctionName;
</span><del>- if (!$function->signature->extendedAttributes->{Constructor}) {
- my $name = $function->signature->name;
</del><ins>+ if (!$function->extendedAttributes->{Constructor}) {
+ my $name = $function->name;
</ins><span class="cx"> $quotedFunctionName = "\"$name\"";
</span><del>- push(@arguments, GenerateCallWithUsingPointers($function->signature->extendedAttributes->{CallWith}, \@$outputArray, "JSValue::encode(jsUndefined())", $function));
</del><ins>+ push(@arguments, GenerateCallWithUsingPointers($function->extendedAttributes->{CallWith}, \@$outputArray, "JSValue::encode(jsUndefined())", $function));
</ins><span class="cx"> } else {
</span><span class="cx"> $quotedFunctionName = "nullptr";
</span><span class="cx"> }
</span><span class="lines">@@ -4303,31 +4299,31 @@
</span><span class="cx"> $implIncludes{"JSDOMBinding.h"} = 1;
</span><span class="cx">
</span><span class="cx"> my $argumentIndex = 0;
</span><del>- foreach my $parameter (@{$function->parameters}) {
- my $type = $parameter->type;
</del><ins>+ foreach my $argument (@{$function->arguments}) {
+ my $type = $argument->type;
</ins><span class="cx">
</span><del>- die "Optional parameters of non-nullable wrapper types are not supported" if $parameter->isOptional && !$type->isNullable && $codeGenerator->IsWrapperType($type);
- die "Optional parameters preceding variadic parameters are not supported" if ($parameter->isOptional && @{$function->parameters}[$numParameters - 1]->isVariadic);
</del><ins>+ die "Optional arguments of non-nullable wrapper types are not supported" if $argument->isOptional && !$type->isNullable && $codeGenerator->IsWrapperType($type);
+ die "Optional arguments preceding variadic arguments are not supported" if ($argument->isOptional && @{$function->arguments}[$numArguments - 1]->isVariadic);
</ins><span class="cx">
</span><del>- if ($parameter->isOptional && !defined($parameter->default)) {
- # As per Web IDL, optional dictionary parameters are always considered to have a default value of an empty dictionary, unless otherwise specified.
- $parameter->default("[]") if $type->name eq "Dictionary" or $codeGenerator->IsDictionaryType($type);
</del><ins>+ if ($argument->isOptional && !defined($argument->default)) {
+ # As per Web IDL, optional dictionary arguments are always considered to have a default value of an empty dictionary, unless otherwise specified.
+ $argument->default("[]") if $type->name eq "Dictionary" or $codeGenerator->IsDictionaryType($type);
</ins><span class="cx">
</span><del>- # We use undefined as default value for optional parameters of type 'any' unless specified otherwise.
- $parameter->default("undefined") if $type->name eq "any";
</del><ins>+ # We use undefined as default value for optional arguments of type 'any' unless specified otherwise.
+ $argument->default("undefined") if $type->name eq "any";
</ins><span class="cx">
</span><del>- # We use the null string as default value for parameters of type DOMString unless specified otherwise.
- $parameter->default("null") if $codeGenerator->IsStringType($type);
</del><ins>+ # We use the null string as default value for arguments of type DOMString unless specified otherwise.
+ $argument->default("null") if $codeGenerator->IsStringType($type);
</ins><span class="cx">
</span><del>- # As per Web IDL, passing undefined for a nullable parameter is treated as null. Therefore, use null as
- # default value for nullable parameters unless otherwise specified.
- $parameter->default("null") if $type->isNullable;
</del><ins>+ # As per Web IDL, passing undefined for a nullable argument is treated as null. Therefore, use null as
+ # default value for nullable arguments unless otherwise specified.
+ $argument->default("null") if $type->isNullable;
</ins><span class="cx">
</span><del>- # For callback parameters, the generated bindings treat undefined as null, so use null as implicit default value.
- $parameter->default("null") if $codeGenerator->IsCallbackInterface($type);
</del><ins>+ # For callback arguments, the generated bindings treat undefined as null, so use null as implicit default value.
+ $argument->default("null") if $codeGenerator->IsCallbackInterface($type);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- my $name = $parameter->name;
</del><ins>+ my $name = $argument->name;
</ins><span class="cx"> my $value = $name;
</span><span class="cx">
</span><span class="cx"> if ($codeGenerator->IsCallbackInterface($type)) {
</span><span class="lines">@@ -4334,7 +4330,7 @@
</span><span class="cx"> my $callbackClassName = GetCallbackClassName($type->name);
</span><span class="cx"> my $typeName = $type->name;
</span><span class="cx"> $implIncludes{"$callbackClassName.h"} = 1;
</span><del>- if ($parameter->isOptional) {
</del><ins>+ if ($argument->isOptional) {
</ins><span class="cx"> push(@$outputArray, " RefPtr<$typeName> $name;\n");
</span><span class="cx"> push(@$outputArray, " if (!state->argument($argumentIndex).isUndefinedOrNull()) {\n");
</span><span class="cx"> if ($codeGenerator->IsFunctionOnlyCallbackInterface($type)) {
</span><span class="lines">@@ -4351,7 +4347,7 @@
</span><span class="cx"> }
</span><span class="cx"> push(@$outputArray, " }\n");
</span><span class="cx"> } else {
</span><del>- die "CallbackInterface does not support Variadic parameter" if $parameter->isVariadic;
</del><ins>+ die "CallbackInterface does not support Variadic arguments" if $argument->isVariadic;
</ins><span class="cx"> if ($codeGenerator->IsFunctionOnlyCallbackInterface($type)) {
</span><span class="cx"> push(@$outputArray, " if (UNLIKELY(!state->uncheckedArgument($argumentIndex).isFunction()))\n");
</span><span class="cx"> } else {
</span><span class="lines">@@ -4366,9 +4362,9 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> $value = "WTFMove($name)";
</span><del>- } elsif ($parameter->isVariadic) {
</del><ins>+ } elsif ($argument->isVariadic) {
</ins><span class="cx"> $implIncludes{"JSDOMConvert.h"} = 1;
</span><del>- AddToImplIncludesForIDLType($type, $function->signature->extendedAttributes->{Conditional});
</del><ins>+ AddToImplIncludesForIDLType($type, $function->extendedAttributes->{Conditional});
</ins><span class="cx">
</span><span class="cx"> my $metaType = GetIDLType($interface, $type);
</span><span class="cx"> push(@$outputArray, " auto $name = convertVariadicArguments<$metaType>(*state, $argumentIndex);\n");
</span><span class="lines">@@ -4386,10 +4382,10 @@
</span><span class="cx"> my $defineOptionalValue = "auto optionalValue";
</span><span class="cx"> my $indent = "";
</span><span class="cx">
</span><del>- die "Variadic parameter is already handled here" if $parameter->isVariadic;
- my $argumentLookupMethod = $parameter->isOptional ? "argument" : "uncheckedArgument";
</del><ins>+ die "Variadic argument is already handled here" if $argument->isVariadic;
+ my $argumentLookupMethod = $argument->isOptional ? "argument" : "uncheckedArgument";
</ins><span class="cx">
</span><del>- if ($parameter->isOptional && !defined($parameter->default)) {
</del><ins>+ if ($argument->isOptional && !defined($argument->default)) {
</ins><span class="cx"> $nativeType = "Optional<$className>";
</span><span class="cx"> $optionalValue = $name;
</span><span class="cx"> $defineOptionalValue = $name;
</span><span class="lines">@@ -4398,12 +4394,12 @@
</span><span class="cx"> push(@$outputArray, " auto ${name}Value = state->$argumentLookupMethod($argumentIndex);\n");
</span><span class="cx"> push(@$outputArray, " $nativeType $name;\n");
</span><span class="cx">
</span><del>- if ($parameter->isOptional) {
- if (!defined $parameter->default) {
</del><ins>+ if ($argument->isOptional) {
+ if (!defined $argument->default) {
</ins><span class="cx"> push(@$outputArray, " if (!${name}Value.isUndefined()) {\n");
</span><span class="cx"> } else {
</span><span class="cx"> push(@$outputArray, " if (${name}Value.isUndefined())\n");
</span><del>- push(@$outputArray, " $name = " . GenerateDefaultValue($interface, $parameter) . ";\n");
</del><ins>+ push(@$outputArray, " $name = " . GenerateDefaultValue($interface, $argument->type, $argument->default) . ";\n");
</ins><span class="cx"> push(@$outputArray, " else {\n");
</span><span class="cx"> }
</span><span class="cx"> $indent = " ";
</span><span class="lines">@@ -4420,18 +4416,18 @@
</span><span class="cx"> } else {
</span><span class="cx"> my $outer;
</span><span class="cx"> my $inner;
</span><del>- my $nativeType = GetNativeTypeFromSignature($interface, $parameter);
</del><ins>+ my $nativeType = GetNativeType($interface, $argument->type);
</ins><span class="cx"> my $isTearOff = $codeGenerator->IsSVGTypeNeedingTearOff($type) && $interfaceName !~ /List$/;
</span><del>- my $shouldPassByReference = $isTearOff || ShouldPassWrapperByReference($parameter, $interface);
</del><ins>+ my $shouldPassByReference = $isTearOff || ShouldPassWrapperByReference($argument, $interface);
</ins><span class="cx">
</span><del>- die "Variadic parameter is already handled here" if $parameter->isVariadic;
- my $argumentLookupMethod = $parameter->isOptional ? "argument" : "uncheckedArgument";
</del><ins>+ die "Variadic argument is already handled here" if $argument->isVariadic;
+ my $argumentLookupMethod = $argument->isOptional ? "argument" : "uncheckedArgument";
</ins><span class="cx">
</span><span class="cx"> if (!$shouldPassByReference && ($codeGenerator->IsWrapperType($type) || $codeGenerator->IsTypedArrayType($type))) {
</span><span class="cx"> $implIncludes{"<runtime/Error.h>"} = 1;
</span><span class="cx"> my $checkedArgument = "state->$argumentLookupMethod($argumentIndex)";
</span><span class="cx"> my $uncheckedArgument = "state->uncheckedArgument($argumentIndex)";
</span><del>- my ($nativeValue, $mayThrowException) = JSValueToNative($interface, $parameter, $uncheckedArgument, $function->signature->extendedAttributes->{Conditional});
</del><ins>+ my ($nativeValue, $mayThrowException) = JSValueToNative($interface, $argument, $uncheckedArgument, $function->extendedAttributes->{Conditional});
</ins><span class="cx"> push(@$outputArray, " $nativeType $name = nullptr;\n");
</span><span class="cx"> push(@$outputArray, " if (!$checkedArgument.isUndefinedOrNull()) {\n");
</span><span class="cx"> push(@$outputArray, " $name = $nativeValue;\n");
</span><span class="lines">@@ -4441,12 +4437,12 @@
</span><span class="cx"> push(@$outputArray, " }\n");
</span><span class="cx"> $value = "WTFMove($name)";
</span><span class="cx"> } else {
</span><del>- if ($parameter->isOptional && defined($parameter->default) && !WillConvertUndefinedToDefaultParameterValue($type, $parameter->default)) {
- my $defaultValue = $parameter->default;
</del><ins>+ if ($argument->isOptional && defined($argument->default) && !WillConvertUndefinedToDefaultParameterValue($type, $argument->default)) {
+ my $defaultValue = $argument->default;
</ins><span class="cx">
</span><span class="cx"> # String-related optimizations.
</span><span class="cx"> if ($codeGenerator->IsStringType($type)) {
</span><del>- my $useAtomicString = $parameter->extendedAttributes->{AtomicString};
</del><ins>+ my $useAtomicString = $argument->extendedAttributes->{AtomicString};
</ins><span class="cx"> if ($defaultValue eq "null") {
</span><span class="cx"> $defaultValue = $useAtomicString ? "nullAtom" : "String()";
</span><span class="cx"> } elsif ($defaultValue eq "\"\"") {
</span><span class="lines">@@ -4455,13 +4451,13 @@
</span><span class="cx"> $defaultValue = $useAtomicString ? "AtomicString($defaultValue, AtomicString::ConstructFromLiteral)" : "ASCIILiteral($defaultValue)";
</span><span class="cx"> }
</span><span class="cx"> } else {
</span><del>- $defaultValue = GenerateDefaultValue($interface, $parameter);
</del><ins>+ $defaultValue = GenerateDefaultValue($interface, $argument->type, $argument->default);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> $outer = "state->$argumentLookupMethod($argumentIndex).isUndefined() ? $defaultValue : ";
</span><span class="cx"> $inner = "state->uncheckedArgument($argumentIndex)";
</span><del>- } elsif ($parameter->isOptional && !defined($parameter->default)) {
- # Use WTF::Optional<>() for optional parameters that are missing or undefined and that do not have a default value in the IDL.
</del><ins>+ } elsif ($argument->isOptional && !defined($argument->default)) {
+ # Use WTF::Optional<>() for optional arguments that are missing or undefined and that do not have a default value in the IDL.
</ins><span class="cx"> $outer = "state->$argumentLookupMethod($argumentIndex).isUndefined() ? Optional<$nativeType>() : ";
</span><span class="cx"> $inner = "state->uncheckedArgument($argumentIndex)";
</span><span class="cx"> } else {
</span><span class="lines">@@ -4469,7 +4465,7 @@
</span><span class="cx"> $inner = "state->$argumentLookupMethod($argumentIndex)";
</span><span class="cx"> }
</span><span class="cx">
</span><del>- my ($nativeValue, $mayThrowException) = JSValueToNative($interface, $parameter, $inner, $function->signature->extendedAttributes->{Conditional});
</del><ins>+ my ($nativeValue, $mayThrowException) = JSValueToNative($interface, $argument, $inner, $function->extendedAttributes->{Conditional});
</ins><span class="cx"> push(@$outputArray, " auto $name = ${outer}${nativeValue};\n");
</span><span class="cx"> $value = "WTFMove($name)";
</span><span class="cx"> push(@$outputArray, " RETURN_IF_EXCEPTION(throwScope, encodedJSValue());\n") if $mayThrowException;
</span><span class="lines">@@ -4493,7 +4489,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> push(@arguments, "WTFMove(promise)") if IsReturningPromise($function);
</span><del>- push(@arguments, "ec") if $function->signature->extendedAttributes->{MayThrowLegacyException};
</del><ins>+ push(@arguments, "ec") if $function->extendedAttributes->{MayThrowLegacyException};
</ins><span class="cx">
</span><span class="cx"> my $functionString = "$functionName(" . join(", ", @arguments) . ")";
</span><span class="cx"> $functionString = "propagateException(*state, throwScope, $functionString)" if NeedsExplicitPropagateExceptionCall($function);
</span><span class="lines">@@ -4592,10 +4588,10 @@
</span><span class="cx"> push(@headerContent, "\n // Functions\n");
</span><span class="cx"> foreach my $function (@{$interface->functions}) {
</span><span class="cx"> my @arguments = ();
</span><del>- foreach my $parameter (@{$function->parameters}) {
- push(@arguments, GetNativeTypeForCallbacks($interface, $parameter->type) . " " . $parameter->name);
</del><ins>+ foreach my $argument (@{$function->arguments}) {
+ push(@arguments, GetNativeTypeForCallbacks($interface, $argument->type) . " " . $argument->name);
</ins><span class="cx"> }
</span><del>- push(@headerContent, " virtual " . GetNativeTypeForCallbacks($interface, $function->signature->type) . " " . $function->signature->name . "(" . join(", ", @arguments) . ");\n");
</del><ins>+ push(@headerContent, " virtual " . GetNativeTypeForCallbacks($interface, $function->type) . " " . $function->name . "(" . join(", ", @arguments) . ");\n");
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -4724,14 +4720,14 @@
</span><span class="cx"> if ($numFunctions > 0) {
</span><span class="cx"> push(@implContent, "\n// Functions\n");
</span><span class="cx"> foreach my $function (@{$interface->functions}) {
</span><del>- my @params = @{$function->parameters};
- if ($function->signature->extendedAttributes->{Custom} || GetNativeType($interface, $function->signature->type) ne "bool") {
</del><ins>+ my @params = @{$function->arguments};
+ if ($function->extendedAttributes->{Custom} || GetNativeType($interface, $function->type) ne "bool") {
</ins><span class="cx"> next;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- AddToImplIncludesForIDLType($function->signature->type);
- my $functionName = $function->signature->name;
- push(@implContent, "\n" . GetNativeTypeForCallbacks($interface, $function->signature->type) . " ${className}::${functionName}(");
</del><ins>+ AddToImplIncludesForIDLType($function->type);
+ my $functionName = $function->name;
+ push(@implContent, "\n" . GetNativeTypeForCallbacks($interface, $function->type) . " ${className}::${functionName}(");
</ins><span class="cx">
</span><span class="cx"> my @args = ();
</span><span class="cx"> my @argsCheck = ();
</span><span class="lines">@@ -4803,10 +4799,10 @@
</span><span class="cx"> {
</span><span class="cx"> my ($function, $functionString, $indent, $svgPropertyType, $interface) = @_;
</span><span class="cx">
</span><del>- my $nondeterministic = $function->signature->extendedAttributes->{Nondeterministic};
- my $mayThrowLegacyException = $function->signature->extendedAttributes->{MayThrowLegacyException};
</del><ins>+ my $nondeterministic = $function->extendedAttributes->{Nondeterministic};
+ my $mayThrowLegacyException = $function->extendedAttributes->{MayThrowLegacyException};
</ins><span class="cx">
</span><del>- if ($function->signature->type->name eq "void" || IsReturningPromise($function)) {
</del><ins>+ if ($function->type->name eq "void" || IsReturningPromise($function)) {
</ins><span class="cx"> if ($nondeterministic) {
</span><span class="cx"> AddToImplIncludes("<replay/InputCursor.h>", "WEB_REPLAY");
</span><span class="cx"> push(@implContent, "#if ENABLE(WEB_REPLAY)\n");
</span><span class="lines">@@ -4841,9 +4837,9 @@
</span><span class="cx"> AddToImplIncludes("<replay/InputCursor.h>", "WEB_REPLAY");
</span><span class="cx"> AddToImplIncludes("<wtf/NeverDestroyed.h>", "WEB_REPLAY");
</span><span class="cx">
</span><del>- my $nativeType = GetNativeTypeFromSignature($interface, $function->signature);
- my $memoizedType = GetNativeTypeForMemoization($interface, $function->signature->type);
- my $bindingName = $interface->type->name . "." . $function->signature->name;
</del><ins>+ my $nativeType = GetNativeType($interface, $function->type);
+ my $memoizedType = GetNativeTypeForMemoization($interface, $function->type);
+ my $bindingName = $interface->type->name . "." . $function->name;
</ins><span class="cx"> push(@implContent, $indent . "JSValue result;\n");
</span><span class="cx"> push(@implContent, "#if ENABLE(WEB_REPLAY)\n");
</span><span class="cx"> push(@implContent, $indent . "InputCursor& cursor = state->lexicalGlobalObject()->inputCursor();\n");
</span><span class="lines">@@ -4852,28 +4848,28 @@
</span><span class="cx"> push(@implContent, $indent . " $nativeType memoizedResult = $functionString;\n");
</span><span class="cx"> my $exceptionCode = $mayThrowLegacyException ? "ec" : "0";
</span><span class="cx"> push(@implContent, $indent . " cursor.appendInput<MemoizedDOMResult<$memoizedType>>(bindingName.get().string(), memoizedResult, $exceptionCode);\n");
</span><del>- push(@implContent, $indent . " result = " . NativeToJSValueUsingPointers($function->signature, 1, $interface, "memoizedResult", $thisObject) . ";\n");
</del><ins>+ push(@implContent, $indent . " result = " . NativeToJSValueUsingPointers($function, 1, $interface, "memoizedResult", $thisObject) . ";\n");
</ins><span class="cx"> push(@implContent, $indent . "} else if (cursor.isReplaying()) {\n");
</span><span class="cx"> push(@implContent, $indent . " MemoizedDOMResultBase* input = cursor.fetchInput<MemoizedDOMResultBase>();\n");
</span><span class="cx"> push(@implContent, $indent . " $memoizedType memoizedResult;\n");
</span><span class="cx"> # FIXME: the generated code should report an error if an input cannot be fetched or converted.
</span><span class="cx"> push(@implContent, $indent . " if (input && input->convertTo<$memoizedType>(memoizedResult)) {\n");
</span><del>- push(@implContent, $indent . " result = " . NativeToJSValueUsingPointers($function->signature, 1, $interface, "memoizedResult", $thisObject) . ";\n");
</del><ins>+ push(@implContent, $indent . " result = " . NativeToJSValueUsingPointers($function, 1, $interface, "memoizedResult", $thisObject) . ";\n");
</ins><span class="cx"> push(@implContent, $indent . " ec = input->exceptionCode();\n") if $mayThrowLegacyException;
</span><span class="cx"> push(@implContent, $indent . " } else\n");
</span><del>- push(@implContent, $indent . " result = " . NativeToJSValueUsingPointers($function->signature, 1, $interface, $functionString, $thisObject) . ";\n");
</del><ins>+ push(@implContent, $indent . " result = " . NativeToJSValueUsingPointers($function, 1, $interface, $functionString, $thisObject) . ";\n");
</ins><span class="cx"> push(@implContent, $indent . "} else\n");
</span><del>- push(@implContent, $indent . " result = " . NativeToJSValueUsingPointers($function->signature, 1, $interface, $functionString, $thisObject) . ";\n");
</del><ins>+ push(@implContent, $indent . " result = " . NativeToJSValueUsingPointers($function, 1, $interface, $functionString, $thisObject) . ";\n");
</ins><span class="cx"> push(@implContent, "#else\n");
</span><del>- push(@implContent, $indent . "result = " . NativeToJSValueUsingPointers($function->signature, 1, $interface, $functionString, $thisObject) . ";\n");
</del><ins>+ push(@implContent, $indent . "result = " . NativeToJSValueUsingPointers($function, 1, $interface, $functionString, $thisObject) . ";\n");
</ins><span class="cx"> push(@implContent, "#endif\n");
</span><span class="cx"> } else {
</span><del>- push(@implContent, $indent . "JSValue result = " . NativeToJSValueUsingPointers($function->signature, 1, $interface, $functionString, $thisObject) . ";\n");
</del><ins>+ push(@implContent, $indent . "JSValue result = " . NativeToJSValueUsingPointers($function, 1, $interface, $functionString, $thisObject) . ";\n");
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> push(@implContent, "\n" . $indent . "setDOMException(state, throwScope, ec);\n") if $mayThrowLegacyException;
</span><span class="cx">
</span><del>- if ($codeGenerator->ExtendedAttributeContains($function->signature->extendedAttributes->{CallWith}, "ScriptState")) {
</del><ins>+ if ($codeGenerator->ExtendedAttributeContains($function->extendedAttributes->{CallWith}, "ScriptState")) {
</ins><span class="cx"> push(@implContent, $indent . "RETURN_IF_EXCEPTION(throwScope, encodedJSValue());\n");
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -4938,7 +4934,7 @@
</span><span class="cx"> END
</span><span class="cx">
</span><span class="cx"> foreach my $function (@{$interface->iterable->functions}) {
</span><del>- my $propertyName = $function->signature->name;
</del><ins>+ my $propertyName = $function->name;
</ins><span class="cx"> my $functionName = GetFunctionName($interface, $className, $function);
</span><span class="cx">
</span><span class="cx"> if ($propertyName eq "forEach") {
</span><span class="lines">@@ -4993,13 +4989,6 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-sub GetNativeTypeFromSignature
-{
- my ($interface, $signature) = @_;
-
- return GetNativeType($interface, $signature->type);
-}
-
</del><span class="cx"> my %nativeType = (
</span><span class="cx"> "DOMString" => "String",
</span><span class="cx"> "USVString" => "String",
</span><span class="lines">@@ -5135,7 +5124,7 @@
</span><span class="cx"> {
</span><span class="cx"> my ($interface, $type) = @_;
</span><span class="cx">
</span><del>- assert("Not a type") if ref($type) ne "domType";
</del><ins>+ assert("Not a type") if ref($type) ne "IDLType";
</ins><span class="cx">
</span><span class="cx"> my $typeName = $type->name;
</span><span class="cx">
</span><span class="lines">@@ -5157,7 +5146,7 @@
</span><span class="cx"> my ($parameter, $interface) = @_;
</span><span class="cx">
</span><span class="cx"> my $nativeType = GetNativeType($interface, $parameter->type);
</span><del>- return $codeGenerator->ShouldPassWrapperByReference($parameter, $interface) && (substr($nativeType, -1) eq '*' || $nativeType =~ /^RefPtr/);
</del><ins>+ return $codeGenerator->ShouldPassWrapperByReference($parameter) && (substr($nativeType, -1) eq '*' || $nativeType =~ /^RefPtr/);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> sub GetNativeVectorInnerType
</span><span class="lines">@@ -5234,26 +5223,26 @@
</span><span class="cx">
</span><span class="cx"> sub GetIntegerConversionConfiguration
</span><span class="cx"> {
</span><del>- my $signature = shift;
</del><ins>+ my $context = shift;
</ins><span class="cx">
</span><del>- return "IntegerConversionConfiguration::EnforceRange" if $signature->extendedAttributes->{EnforceRange};
- return "IntegerConversionConfiguration::Clamp" if $signature->extendedAttributes->{Clamp};
</del><ins>+ return "IntegerConversionConfiguration::EnforceRange" if $context->extendedAttributes->{EnforceRange};
+ return "IntegerConversionConfiguration::Clamp" if $context->extendedAttributes->{Clamp};
</ins><span class="cx"> return "IntegerConversionConfiguration::Normal";
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> sub GetStringConversionConfiguration
</span><span class="cx"> {
</span><del>- my $signature = shift;
</del><ins>+ my $context = shift;
</ins><span class="cx">
</span><del>- return "StringConversionConfiguration::TreatNullAsEmptyString" if $signature->extendedAttributes->{TreatNullAs} && $signature->extendedAttributes->{TreatNullAs} eq "EmptyString";
</del><ins>+ return "StringConversionConfiguration::TreatNullAsEmptyString" if $context->extendedAttributes->{TreatNullAs} && $context->extendedAttributes->{TreatNullAs} eq "EmptyString";
</ins><span class="cx"> return "StringConversionConfiguration::Normal";
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> sub JSValueToNativeIsHandledByDOMConvert
</span><span class="cx"> {
</span><del>- my ($type, $signature) = @_;
</del><ins>+ my ($type, $context) = @_;
</ins><span class="cx">
</span><del>- return 0 if $type->name eq "DOMString" && ($signature->extendedAttributes->{RequiresExistingAtomicString} || $signature->extendedAttributes->{AtomicString});
</del><ins>+ return 0 if $type->name eq "DOMString" && ($context->extendedAttributes->{RequiresExistingAtomicString} || $context->extendedAttributes->{AtomicString});
</ins><span class="cx">
</span><span class="cx"> return 1 if $type->isUnion;
</span><span class="cx"> return 1 if $type->name eq "any";
</span><span class="lines">@@ -5268,20 +5257,29 @@
</span><span class="cx"> return 0;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+sub IsValidContextForJSValueToNative
+{
+ my $context = shift;
+
+ return ref($context) eq "IDLAttribute" || ref($context) eq "IDLOperation" || ref($context) eq "IDLArgument";
+}
+
</ins><span class="cx"> # Returns (convertString, mayThrowException).
</span><span class="cx">
</span><span class="cx"> sub JSValueToNative
</span><span class="cx"> {
</span><del>- my ($interface, $signature, $value, $conditional, $statePointer, $stateReference, $thisObjectReference) = @_;
</del><ins>+ my ($interface, $context, $value, $conditional, $statePointer, $stateReference, $thisObjectReference) = @_;
</ins><span class="cx">
</span><del>- my $type = $signature->type;
</del><ins>+ assert("Invalid context type") if !IsValidContextForJSValueToNative($context);
</ins><span class="cx">
</span><ins>+ my $type = $context->type;
+
</ins><span class="cx"> # FIXME: Remove these 3 variables when all JSValueToNative use references.
</span><span class="cx"> $statePointer = "state" unless $statePointer;
</span><span class="cx"> $stateReference = "*state" unless $stateReference;
</span><span class="cx"> $thisObjectReference = "*castedThis" unless $thisObjectReference;
</span><span class="cx">
</span><del>- if (JSValueToNativeIsHandledByDOMConvert($type, $signature)) {
</del><ins>+ if (JSValueToNativeIsHandledByDOMConvert($type, $context)) {
</ins><span class="cx"> AddToImplIncludes("JSDOMConvert.h");
</span><span class="cx"> AddToImplIncludesForIDLType($type, $conditional);
</span><span class="cx">
</span><span class="lines">@@ -5290,15 +5288,15 @@
</span><span class="cx"> my @conversionArguments = ();
</span><span class="cx"> push(@conversionArguments, "$stateReference");
</span><span class="cx"> push(@conversionArguments, "$value");
</span><del>- push(@conversionArguments, GetIntegerConversionConfiguration($signature)) if $codeGenerator->IsIntegerType($type);
- push(@conversionArguments, GetStringConversionConfiguration($signature)) if $codeGenerator->IsStringType($type);
</del><ins>+ push(@conversionArguments, GetIntegerConversionConfiguration($context)) if $codeGenerator->IsIntegerType($type);
+ push(@conversionArguments, GetStringConversionConfiguration($context)) if $codeGenerator->IsStringType($type);
</ins><span class="cx">
</span><span class="cx"> return ("convert<$IDLType>(" . join(", ", @conversionArguments) . ")", 1);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if ($type->name eq "DOMString") {
</span><del>- return ("AtomicString($value.toString($statePointer)->toExistingAtomicString($statePointer))", 1) if $signature->extendedAttributes->{RequiresExistingAtomicString};
- return ("$value.toString($statePointer)->toAtomicString($statePointer)", 1) if $signature->extendedAttributes->{AtomicString};
</del><ins>+ return ("AtomicString($value.toString($statePointer)->toExistingAtomicString($statePointer))", 1) if $context->extendedAttributes->{RequiresExistingAtomicString};
+ return ("$value.toString($statePointer)->toAtomicString($statePointer)", 1) if $context->extendedAttributes->{AtomicString};
</ins><span class="cx"> assert("Unhandled string conversion.");
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -5369,44 +5367,53 @@
</span><span class="cx">
</span><span class="cx"> sub NativeToJSValueUsingReferences
</span><span class="cx"> {
</span><del>- my ($signature, $inFunctionCall, $interface, $value, $thisValue) = @_;
</del><ins>+ my ($context, $inFunctionCall, $interface, $value, $thisValue) = @_;
</ins><span class="cx"> my $statePointer = "&state";
</span><span class="cx"> my $stateReference = "state";
</span><span class="cx"> my $wrapped = "$thisValue.wrapped()";
</span><span class="cx"> my $globalObject = $thisValue ? "$thisValue.globalObject()" : "jsCast<JSDOMGlobalObject*>(state.lexicalGlobalObject())";
</span><span class="cx">
</span><del>- return NativeToJSValue($signature, $inFunctionCall, $interface, $value, $statePointer, $stateReference, $wrapped, $globalObject);
</del><ins>+ return NativeToJSValue($context, $inFunctionCall, $interface, $value, $statePointer, $stateReference, $wrapped, $globalObject);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> # FIXME: We should remove NativeToJSValueUsingPointers and combine NativeToJSValueUsingReferences and NativeToJSValue
</span><span class="cx"> sub NativeToJSValueUsingPointers
</span><span class="cx"> {
</span><del>- my ($signature, $inFunctionCall, $interface, $value, $thisValue) = @_;
</del><ins>+ my ($context, $inFunctionCall, $interface, $value, $thisValue) = @_;
</ins><span class="cx"> my $statePointer = "state";
</span><span class="cx"> my $stateReference = "*state";
</span><span class="cx"> my $wrapped = "$thisValue->wrapped()";
</span><span class="cx"> my $globalObject = $thisValue ? "$thisValue->globalObject()" : "jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject())";
</span><span class="cx">
</span><del>- return NativeToJSValue($signature, $inFunctionCall, $interface, $value, $statePointer, $stateReference, $wrapped, $globalObject);
</del><ins>+ return NativeToJSValue($context, $inFunctionCall, $interface, $value, $statePointer, $stateReference, $wrapped, $globalObject);
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+sub IsValidContextForNativeToJSValue
+{
+ my $context = shift;
+
+ return ref($context) eq "IDLAttribute" || ref($context) eq "IDLOperation" || ref($context) eq "IDLArgument";
+}
+
</ins><span class="cx"> sub NativeToJSValue
</span><span class="cx"> {
</span><del>- my ($signature, $inFunctionCall, $interface, $value, $statePointer, $stateReference, $wrapped, $globalObject) = @_;
</del><ins>+ my ($context, $inFunctionCall, $interface, $value, $statePointer, $stateReference, $wrapped, $globalObject) = @_;
</ins><span class="cx">
</span><del>- my $conditional = $signature->extendedAttributes->{Conditional};
- my $type = $signature->type;
- my $mayThrowException = $signature->extendedAttributes->{GetterMayThrowException} || $signature->extendedAttributes->{MayThrowException};
</del><ins>+ assert("Invalid context type") if !IsValidContextForNativeToJSValue($context);
</ins><span class="cx">
</span><ins>+ my $conditional = $context->extendedAttributes->{Conditional};
+ my $type = $context->type;
+ my $mayThrowException = $context->extendedAttributes->{GetterMayThrowException} || $context->extendedAttributes->{MayThrowException};
+
</ins><span class="cx"> # We could instead overload a function to work with optional as well as non-optional numbers, but this
</span><span class="cx"> # is slightly better because it guarantees we will fail to compile if the IDL file doesn't match the C++.
</span><del>- if ($signature->extendedAttributes->{Reflect} and ($type->name eq "unsigned long" or $type->name eq "unsigned short")) {
</del><ins>+ if ($context->extendedAttributes->{Reflect} and ($type->name eq "unsigned long" or $type->name eq "unsigned short")) {
</ins><span class="cx"> $value =~ s/getUnsignedIntegralAttribute/getIntegralAttribute/g;
</span><span class="cx"> $value = "std::max(0, $value)";
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if ($type->name eq "any") {
</span><del>- my $returnType = $signature->extendedAttributes->{ImplementationReturnType};
</del><ins>+ my $returnType = $context->extendedAttributes->{ImplementationReturnType};
</ins><span class="cx"> if (defined $returnType and ($returnType eq "IDBKeyPath" or $returnType eq "IDBKey")) {
</span><span class="cx"> AddToImplIncludes("IDBBindingUtilities.h", $conditional);
</span><span class="cx"> return "toJS($stateReference, *$globalObject, $value)";
</span><span class="lines">@@ -5445,7 +5452,7 @@
</span><span class="cx"> $value = "static_cast<" . GetNativeType($interface, $type) . ">($value)";
</span><span class="cx"> } elsif ($codeGenerator->IsSVGTypeNeedingTearOff($type) and not $interface->type->name =~ /List$/) {
</span><span class="cx"> my $tearOffType = $codeGenerator->GetSVGTypeNeedingTearOff($type);
</span><del>- if ($codeGenerator->IsSVGTypeWithWritablePropertiesNeedingTearOff($type) and !$inFunctionCall and not defined $signature->extendedAttributes->{Immutable}) {
</del><ins>+ if ($codeGenerator->IsSVGTypeWithWritablePropertiesNeedingTearOff($type) and !$inFunctionCall and not defined $context->extendedAttributes->{Immutable}) {
</ins><span class="cx"> my $getter = $value;
</span><span class="cx"> $getter =~ s/impl\.//;
</span><span class="cx"> $getter =~ s/impl->//;
</span><span class="lines">@@ -5470,10 +5477,10 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- $value = "BindingSecurity::checkSecurityForNode($stateReference, $value)" if $signature->extendedAttributes->{CheckSecurityForNode};
</del><ins>+ $value = "BindingSecurity::checkSecurityForNode($stateReference, $value)" if $context->extendedAttributes->{CheckSecurityForNode};
</ins><span class="cx">
</span><span class="cx"> my $functionName = "toJS";
</span><del>- $functionName = "toJSNewlyCreated" if $signature->extendedAttributes->{NewObject};
</del><ins>+ $functionName = "toJSNewlyCreated" if $context->extendedAttributes->{NewObject};
</ins><span class="cx">
</span><span class="cx"> my $arguments = "$statePointer, $globalObject, $value";
</span><span class="cx"> $arguments = "$stateReference, *$globalObject, throwScope, $value" if $mayThrowException;
</span><span class="lines">@@ -5887,7 +5894,7 @@
</span><span class="cx">
</span><span class="cx"> GenerateArgumentsCountCheck($outputArray, $function, $interface);
</span><span class="cx">
</span><del>- if ($function->signature->extendedAttributes->{MayThrowLegacyException} || $interface->extendedAttributes->{ConstructorMayThrowLegacyException}) {
</del><ins>+ if ($function->extendedAttributes->{MayThrowLegacyException} || $interface->extendedAttributes->{ConstructorMayThrowLegacyException}) {
</ins><span class="cx"> $implIncludes{"ExceptionCode.h"} = 1;
</span><span class="cx"> push(@$outputArray, " ExceptionCode ec = 0;\n");
</span><span class="cx"> }
</span><span class="lines">@@ -5918,12 +5925,12 @@
</span><span class="cx"> push(@constructorArgList, "*castedThis->document()") if $generatingNamedConstructor;
</span><span class="cx">
</span><span class="cx"> my $index = 0;
</span><del>- foreach my $parameter (@{$function->parameters}) {
</del><ins>+ foreach my $argument (@{$function->arguments}) {
</ins><span class="cx"> last if $index eq $paramIndex;
</span><del>- if (ShouldPassWrapperByReference($parameter, $interface)) {
- push(@constructorArgList, "*" . $parameter->name);
</del><ins>+ if (ShouldPassWrapperByReference($argument, $interface)) {
+ push(@constructorArgList, "*" . $argument->name);
</ins><span class="cx"> } else {
</span><del>- push(@constructorArgList, "WTFMove(" . $parameter->name . ")");
</del><ins>+ push(@constructorArgList, "WTFMove(" . $argument->name . ")");
</ins><span class="cx"> }
</span><span class="cx"> $index++;
</span><span class="cx"> }
</span><span class="lines">@@ -6081,7 +6088,7 @@
</span><span class="cx"> sub IsReturningPromise
</span><span class="cx"> {
</span><span class="cx"> my $function = shift;
</span><del>- return $function->signature->type && $function->signature->type->name eq "Promise";
</del><ins>+ return $function->type && $function->type->name eq "Promise";
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> sub IsConstructable
</span><span class="lines">@@ -6103,7 +6110,7 @@
</span><span class="cx"> {
</span><span class="cx"> my $interface = shift;
</span><span class="cx"> my $property = shift;
</span><del>- return $property->signature->extendedAttributes->{Unforgeable} || $interface->extendedAttributes->{Unforgeable};
</del><ins>+ return $property->extendedAttributes->{Unforgeable} || $interface->extendedAttributes->{Unforgeable};
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> sub ComputeFunctionSpecial
</span><span class="lines">@@ -6113,7 +6120,7 @@
</span><span class="cx">
</span><span class="cx"> my @specials = ();
</span><span class="cx"> push(@specials, ("DontDelete", "ReadOnly")) if IsUnforgeable($interface, $function);
</span><del>- push(@specials, "DontEnum") if $function->signature->extendedAttributes->{NotEnumerable};
</del><ins>+ push(@specials, "DontEnum") if $function->extendedAttributes->{NotEnumerable};
</ins><span class="cx"> if (IsJSBuiltin($interface, $function)) {
</span><span class="cx"> push(@specials, "JSC::Builtin");
</span><span class="cx"> }
</span><span class="lines">@@ -6127,11 +6134,11 @@
</span><span class="cx"> {
</span><span class="cx"> my ($interface, $object) = @_;
</span><span class="cx">
</span><del>- return 0 if $object->signature->extendedAttributes->{Custom};
- return 0 if $object->signature->extendedAttributes->{CustomGetter};
- return 0 if $object->signature->extendedAttributes->{CustomSetter};
</del><ins>+ return 0 if $object->extendedAttributes->{Custom};
+ return 0 if $object->extendedAttributes->{CustomGetter};
+ return 0 if $object->extendedAttributes->{CustomSetter};
</ins><span class="cx">
</span><del>- return 1 if $object->signature->extendedAttributes->{JSBuiltin};
</del><ins>+ return 1 if $object->extendedAttributes->{JSBuiltin};
</ins><span class="cx"> return 1 if $interface->extendedAttributes->{JSBuiltin};
</span><span class="cx">
</span><span class="cx"> return 0;
</span><span class="lines">@@ -6150,9 +6157,9 @@
</span><span class="cx"> sub GetJSBuiltinFunctionName
</span><span class="cx"> {
</span><span class="cx"> my ($className, $function) = @_;
</span><del>- my $scopeName = $function->signature->extendedAttributes->{ImplementedBy};
</del><ins>+ my $scopeName = $function->extendedAttributes->{ImplementedBy};
</ins><span class="cx"> $scopeName = substr $className, 2 unless $scopeName;
</span><del>- return GetJSBuiltinFunctionNameFromString($scopeName, $function->signature->name);
</del><ins>+ return GetJSBuiltinFunctionNameFromString($scopeName, $function->name);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> sub GetJSBuiltinFunctionNameFromString
</span><span class="lines">@@ -6164,7 +6171,7 @@
</span><span class="cx"> sub GetJSBuiltinScopeName
</span><span class="cx"> {
</span><span class="cx"> my ($interface, $object) = @_;
</span><del>- return $object->signature->extendedAttributes->{ImplementedBy} || $interface->type->name;
</del><ins>+ return $object->extendedAttributes->{ImplementedBy} || $interface->type->name;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> sub AddJSBuiltinIncludesIfNeeded()
</span><span class="lines">@@ -6177,11 +6184,11 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> foreach my $function (@{$interface->functions}) {
</span><del>- AddToImplIncludes(GetJSBuiltinScopeName($interface, $function) . "Builtins.h", $function->signature->extendedAttributes->{Conditional}) if IsJSBuiltin($interface, $function);
</del><ins>+ AddToImplIncludes(GetJSBuiltinScopeName($interface, $function) . "Builtins.h", $function->extendedAttributes->{Conditional}) if IsJSBuiltin($interface, $function);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> foreach my $attribute (@{$interface->attributes}) {
</span><del>- AddToImplIncludes(GetJSBuiltinScopeName($interface, $attribute) . "Builtins.h", $attribute->signature->extendedAttributes->{Conditional}) if IsJSBuiltin($interface, $attribute);
</del><ins>+ AddToImplIncludes(GetJSBuiltinScopeName($interface, $attribute) . "Builtins.h", $attribute->extendedAttributes->{Conditional}) if IsJSBuiltin($interface, $attribute);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsIDLParserpm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/IDLParser.pm (208133 => 208134)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/IDLParser.pm        2016-10-30 22:33:02 UTC (rev 208133)
+++ trunk/Source/WebCore/bindings/scripts/IDLParser.pm        2016-10-30 22:35:00 UTC (rev 208134)
</span><span class="lines">@@ -37,14 +37,15 @@
</span><span class="cx"> use constant EmptyToken => 5;
</span><span class="cx">
</span><span class="cx"> # Used to represent a parsed IDL document
</span><del>-struct( idlDocument => {
- interfaces => '@', # List of 'domInterface'
- enumerations => '@', # List of 'domEnum'
- dictionaries => '@', # List of 'domDictionary'
</del><ins>+struct( IDLDocument => {
+ interfaces => '@', # List of 'IDLInterface'
+ enumerations => '@', # List of 'IDLEnum'
+ dictionaries => '@', # List of 'IDLDictionary'
</ins><span class="cx"> fileName => '$',
</span><span class="cx"> });
</span><span class="cx">
</span><del>-struct( domType => {
</del><ins>+# https://heycam.github.io/webidl/#idl-types
+struct( IDLType => {
</ins><span class="cx"> name => '$', # Type identifier
</span><span class="cx"> isNullable => '$', # Is the type Nullable (T?)
</span><span class="cx"> isUnion => '$', # Is the type a union (T or U)
</span><span class="lines">@@ -51,62 +52,66 @@
</span><span class="cx"> subtypes => '@', # Array of subtypes, only valid if isUnion or sequence
</span><span class="cx"> });
</span><span class="cx">
</span><del>-# Used to represent a map of 'variable name' <-> 'variable type'
-struct( domSignature => {
- direction => '$', # Variable direction (in or out)
- name => '$', # Variable name
- type => 'domType', # Variable type
- specials => '@', # Specials
- extendedAttributes => '$', # Extended attributes
- isVariadic => '$', # Is variable variadic (long... numbers)
- isOptional => '$', # Is variable optional (optional T)
- default => '$', # Default value for parameters
-});
-
</del><span class="cx"> # Used to represent 'interface' blocks
</span><del>-struct( domInterface => {
- type => 'domType', # Class type
- parentType => 'domType', # Parent class type
- constants => '@', # List of 'domConstant'
- functions => '@', # List of 'domFunction'
- anonymousFunctions => '@', # List of 'domFunction'
- attributes => '@', # List of 'domAttribute'
- extendedAttributes => '$', # Extended attributes
- constructors => '@', # Constructors, list of 'domFunction'
- customConstructors => '@', # Custom constructors, list of 'domFunction'
</del><ins>+struct( IDLInterface => {
+ type => 'IDLType',
+ parentType => 'IDLType',
+ constants => '@', # List of 'IDLConstant'
+ functions => '@', # List of 'IDLOperation'
+ anonymousFunctions => '@', # List of 'IDLOperation'
+ attributes => '@', # List of 'IDLAttribute'
+ constructors => '@', # Constructors, list of 'IDLOperation'
+ customConstructors => '@', # Custom constructors, list of 'IDLOperation'
</ins><span class="cx"> isException => '$', # Used for exception interfaces
</span><span class="cx"> isCallback => '$', # Used for callback interfaces
</span><span class="cx"> isPartial => '$', # Used for partial interfaces
</span><span class="cx"> iterable => '$', # Used for iterable interfaces
</span><span class="cx"> serializable => '$', # Used for serializable interfaces
</span><ins>+ extendedAttributes => '$',
</ins><span class="cx"> });
</span><span class="cx">
</span><del>-# Used to represent domInterface contents (name of method, signature)
-struct( domFunction => {
</del><ins>+# Used to represent an argument to a IDLOperation.
+struct( IDLArgument => {
+ name => '$',
+ type => 'IDLType',
+ isVariadic => '$',
+ isOptional => '$',
+ default => '$',
+ extendedAttributes => '$',
+});
+
+# https://heycam.github.io/webidl/#idl-operations
+struct( IDLOperation => {
+ name => '$',
+ type => 'IDLType', # Return type
+ arguments => '@', # List of 'IDLArgument'
</ins><span class="cx"> isStatic => '$',
</span><del>- signature => 'domSignature', # Return type/Object name/extended attributes
- parameters => '@', # List of 'domSignature'
</del><ins>+ specials => '@',
+ extendedAttributes => '$',
</ins><span class="cx"> });
</span><span class="cx">
</span><del>-# Used to represent domInterface contents (name of attribute, signature)
-struct( domAttribute => {
</del><ins>+
+# https://heycam.github.io/webidl/#idl-attributes
+struct( IDLAttribute => {
+ name => '$',
+ type => 'IDLType',
</ins><span class="cx"> isStatic => '$',
</span><span class="cx"> isStringifier => '$',
</span><span class="cx"> isReadOnly => '$',
</span><del>- signature => 'domSignature', # Attribute signature
</del><ins>+ extendedAttributes => '$',
</ins><span class="cx"> });
</span><span class="cx">
</span><del>-# Used to represent Iterable interfaces
-struct( domIterable => {
- isKeyValue => '$',# Is map iterable or set iterable
- keyType => 'domType', # Key type for map iterables
- valueType => 'domType', # Value type for map or set iterables
</del><ins>+# https://heycam.github.io/webidl/#idl-iterable
+struct( IDLIterable => {
+ isKeyValue => '$',
+ keyType => 'IDLType',
+ valueType => 'IDLType',
</ins><span class="cx"> functions => '@', # Iterable functions (entries, keys, values, [Symbol.Iterator], forEach)
</span><del>- extendedAttributes => '$', # Extended attributes
</del><ins>+ extendedAttributes => '$',
</ins><span class="cx"> });
</span><span class="cx">
</span><del>-# Used to represent serializable interface
-struct( domSerializable => {
</del><ins>+# https://heycam.github.io/webidl/#idl-serializers
+struct( IDLSerializable => {
</ins><span class="cx"> attributes => '@', # List of attributes to serialize
</span><span class="cx"> hasAttribute => '$', # serializer = { attribute }
</span><span class="cx"> hasInherit => '$', # serializer = { inherit }
</span><span class="lines">@@ -114,39 +119,50 @@
</span><span class="cx"> functions => '@', # toJSON function
</span><span class="cx"> });
</span><span class="cx">
</span><del>-# Used to represent string constants
-struct( domConstant => {
- name => '$', # DOM Constant identifier
- type => 'domType', # Type name of data
- value => '$', # Constant value
- extendedAttributes => '$', # Extended attributes
</del><ins>+# https://heycam.github.io/webidl/#idl-constants
+struct( IDLConstant => {
+ name => '$',
+ type => 'IDLType',
+ value => '$',
+ extendedAttributes => '$',
</ins><span class="cx"> });
</span><span class="cx">
</span><del>-# Used to represent 'enum' definitions
-struct( domEnum => {
- name => '$', # Enumeration identifier
- type => 'domType', # Enumeration type
- values => '@', # Enumeration values (list of unique strings)
</del><ins>+# https://heycam.github.io/webidl/#idl-enums
+struct( IDLEnum => {
+ name => '$',
+ type => 'IDLType',
+ values => '@',
</ins><span class="cx"> extendedAttributes => '$',
</span><span class="cx"> });
</span><span class="cx">
</span><del>-struct( domDictionary => {
- type => 'domType', # Dictionary type
- parentType => 'domType', # Parent type identifier
- members => '@', # List of 'domSignature'
</del><ins>+
+struct( IDLDictionaryMember => {
+ name => '$',
+ type => 'IDLType',
+ isRequired => '$',
+ default => '$',
</ins><span class="cx"> extendedAttributes => '$',
</span><span class="cx"> });
</span><span class="cx">
</span><ins>+
+# https://heycam.github.io/webidl/#idl-dictionaries
+struct( IDLDictionary => {
+ type => 'IDLType',
+ parentType => 'IDLType',
+ members => '@', # List of 'IDLDictionaryMember'
+ extendedAttributes => '$',
+});
+
+# https://heycam.github.io/webidl/#idl-enums
+struct( IDLTypedef => {
+ type => 'IDLType',
+});
+
</ins><span class="cx"> struct( Token => {
</span><span class="cx"> type => '$', # type of token
</span><span class="cx"> value => '$' # value of token
</span><span class="cx"> });
</span><span class="cx">
</span><del>-struct( Typedef => {
- extendedAttributes => '$', # Extended attributes
- type => 'domType', # Type of data
-});
-
</del><span class="cx"> # Maps 'typedef name' -> Typedef
</span><span class="cx"> my %typedefs = ();
</span><span class="cx">
</span><span class="lines">@@ -251,14 +267,14 @@
</span><span class="cx"> };
</span><span class="cx"> assert $@ . " in $fileName" if $@;
</span><span class="cx">
</span><del>- my $document = idlDocument->new();
</del><ins>+ my $document = IDLDocument->new();
</ins><span class="cx"> $document->fileName($fileName);
</span><span class="cx"> foreach my $definition (@definitions) {
</span><del>- if (ref($definition) eq "domInterface") {
</del><ins>+ if (ref($definition) eq "IDLInterface") {
</ins><span class="cx"> push(@{$document->interfaces}, $definition);
</span><del>- } elsif (ref($definition) eq "domEnum") {
</del><ins>+ } elsif (ref($definition) eq "IDLEnum") {
</ins><span class="cx"> push(@{$document->enumerations}, $definition);
</span><del>- } elsif (ref($definition) eq "domDictionary") {
</del><ins>+ } elsif (ref($definition) eq "IDLDictionary") {
</ins><span class="cx"> push(@{$document->dictionaries}, $definition);
</span><span class="cx"> } else {
</span><span class="cx"> die "Unrecognized IDL definition kind: \"" . ref($definition) . "\"";
</span><span class="lines">@@ -362,7 +378,7 @@
</span><span class="cx"> {
</span><span class="cx"> my $typeName = shift;
</span><span class="cx">
</span><del>- my $type = domType->new();
</del><ins>+ my $type = IDLType->new();
</ins><span class="cx"> $type->name($typeName);
</span><span class="cx">
</span><span class="cx"> return $type;
</span><span class="lines">@@ -373,7 +389,7 @@
</span><span class="cx"> my $self = shift;
</span><span class="cx"> my $type = shift;
</span><span class="cx">
</span><del>- my $clonedType = domType->new();
</del><ins>+ my $clonedType = IDLType->new();
</ins><span class="cx"> $clonedType->name($type->name);
</span><span class="cx"> $clonedType->isNullable($type->isNullable);
</span><span class="cx"> $clonedType->isUnion($type->isUnion);
</span><span class="lines">@@ -441,84 +457,61 @@
</span><span class="cx"> if (!%typedefs) {
</span><span class="cx"> return;
</span><span class="cx"> }
</span><ins>+
+ # FIXME: Add support for applying typedefs to IDLIterable.
</ins><span class="cx"> foreach my $definition (@$definitions) {
</span><del>- if (ref($definition) eq "domInterface") {
</del><ins>+ if (ref($definition) eq "IDLInterface") {
</ins><span class="cx"> foreach my $constant (@{$definition->constants}) {
</span><del>- if (exists $typedefs{$constant->type->name}) {
- my $typedef = $typedefs{$constant->type->name};
- $self->assertNoExtendedAttributesInTypedef($constant->type->name, __LINE__);
-
- my $clonedType = $self->cloneType($typedef->type);
-
- # Retain nullability from the original type.
- $clonedType->isNullable($constant->type->isNullable);
-
- $constant->type($clonedType);
- }
</del><ins>+ $constant->type($self->typeByApplyingTypedefs($constant->type));
</ins><span class="cx"> }
</span><span class="cx"> foreach my $attribute (@{$definition->attributes}) {
</span><del>- $self->applyTypedefsForSignature($attribute->signature);
</del><ins>+ $attribute->type($self->typeByApplyingTypedefs($attribute->type));
</ins><span class="cx"> }
</span><span class="cx"> foreach my $function (@{$definition->functions}, @{$definition->anonymousFunctions}, @{$definition->constructors}, @{$definition->customConstructors}) {
</span><del>- $self->applyTypedefsForSignature($function->signature);
- foreach my $signature (@{$function->parameters}) {
- $self->applyTypedefsForSignature($signature);
</del><ins>+ if ($function->type) {
+ $function->type($self->typeByApplyingTypedefs($function->type));
</ins><span class="cx"> }
</span><ins>+
+ foreach my $argument (@{$function->arguments}) {
+ $argument->type($self->typeByApplyingTypedefs($argument->type));
+ }
</ins><span class="cx"> }
</span><del>- } elsif (ref($definition) eq "domDictionary") {
</del><ins>+ } elsif (ref($definition) eq "IDLDictionary") {
</ins><span class="cx"> foreach my $member (@{$definition->members}) {
</span><del>- $self->applyTypedefsForSignature($member);
</del><ins>+ $member->type($self->typeByApplyingTypedefs($member->type));
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-sub applyTypedefsForSignature
</del><ins>+sub typeByApplyingTypedefs
</ins><span class="cx"> {
</span><span class="cx"> my $self = shift;
</span><del>- my $signature = shift;
</del><ins>+ my $type = shift;
</ins><span class="cx">
</span><del>- if (!defined ($signature->type)) {
- return;
- }
</del><ins>+ assert("Missing type") if !$type;
</ins><span class="cx">
</span><del>- my $typeName = $signature->type->name;
-
- # Handle union types, sequences and etc.
- # FIXME: This should be recursive.
- my $numberOfSubtypes = scalar @{$signature->type->subtypes};
</del><ins>+ my $numberOfSubtypes = scalar @{$type->subtypes};
</ins><span class="cx"> if ($numberOfSubtypes) {
</span><span class="cx"> for my $i (0..$numberOfSubtypes - 1) {
</span><del>- my $subtype = @{$signature->type->subtypes}[$i];
- my $subtypeName = $subtype->name;
</del><ins>+ my $subtype = @{$type->subtypes}[$i];
+ my $replacementSubtype = $self->typeByApplyingTypedefs($subtype);
+ @{$type->subtypes}[$i] = $replacementSubtype
+ }
</ins><span class="cx">
</span><del>- if (exists $typedefs{$subtypeName}) {
- my $typedef = $typedefs{$subtypeName};
-
- my $clonedType = $self->cloneType($typedef->type);
-
- # Retain nullability from the original type.
- $clonedType->isNullable($subtype->isNullable);
-
- @{$signature->type->subtypes}[$i] = $clonedType;
- }
- }
-
- return;
</del><ins>+ return $type;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- if (exists $typedefs{$typeName}) {
- my $typedef = $typedefs{$typeName};
</del><ins>+ if (exists $typedefs{$type->name}) {
+ my $typedef = $typedefs{$type->name};
</ins><span class="cx">
</span><span class="cx"> my $clonedType = $self->cloneType($typedef->type);
</span><del>-
- # Retain nullability from the original type.
- $clonedType->isNullable($signature->type->isNullable);
</del><ins>+ $clonedType->isNullable($clonedType->isNullable || $type->isNullable);
</ins><span class="cx">
</span><del>- $signature->type($clonedType);
-
- copyExtendedAttributes($signature->extendedAttributes, $typedef->extendedAttributes);
</del><ins>+ return $clonedType;
</ins><span class="cx"> }
</span><ins>+
+ return $type;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> sub parseDefinition
</span><span class="lines">@@ -591,7 +584,7 @@
</span><span class="cx">
</span><span class="cx"> my $next = $self->nextToken();
</span><span class="cx"> if ($next->value() eq "interface") {
</span><del>- my $interface = domInterface->new();
</del><ins>+ my $interface = IDLInterface->new();
</ins><span class="cx"> $self->assertTokenValue($self->getToken(), "interface", __LINE__);
</span><span class="cx"> my $interfaceNameToken = $self->getToken();
</span><span class="cx"> $self->assertTokenType($interfaceNameToken, IdentifierToken);
</span><span class="lines">@@ -708,7 +701,7 @@
</span><span class="cx">
</span><span class="cx"> my $next = $self->nextToken();
</span><span class="cx"> if ($next->value() eq "dictionary") {
</span><del>- my $dictionary = domDictionary->new();
</del><ins>+ my $dictionary = IDLDictionary->new();
</ins><span class="cx"> $dictionary->extendedAttributes($extendedAttributeList);
</span><span class="cx"> $self->assertTokenValue($self->getToken(), "dictionary", __LINE__);
</span><span class="cx">
</span><span class="lines">@@ -759,12 +752,12 @@
</span><span class="cx">
</span><span class="cx"> my $next = $self->nextToken();
</span><span class="cx"> if ($next->type() == IdentifierToken || $next->value() =~ /$nextExceptionField_1/) {
</span><del>- my $member = domSignature->new();
- if ($next->value ne "required") {
- $member->isOptional(1);
</del><ins>+ my $member = IDLDictionaryMember->new();
+ if ($next->value eq "required") {
+ $self->assertTokenValue($self->getToken(), "required", __LINE__);
+ $member->isRequired(1);
</ins><span class="cx"> } else {
</span><del>- $self->assertTokenValue($self->getToken(), "required", __LINE__);
- $member->isOptional(0);
</del><ins>+ $member->isRequired(0);
</ins><span class="cx"> }
</span><span class="cx"> $member->extendedAttributes($extendedAttributeList);
</span><span class="cx">
</span><span class="lines">@@ -833,7 +826,7 @@
</span><span class="cx">
</span><span class="cx"> my $next = $self->nextToken();
</span><span class="cx"> if ($next->value() eq "exception") {
</span><del>- my $interface = domInterface->new();
</del><ins>+ my $interface = IDLInterface->new();
</ins><span class="cx"> $self->assertTokenValue($self->getToken(), "exception", __LINE__);
</span><span class="cx"> my $exceptionNameToken = $self->getToken();
</span><span class="cx"> $self->assertTokenType($exceptionNameToken, IdentifierToken);
</span><span class="lines">@@ -899,7 +892,7 @@
</span><span class="cx">
</span><span class="cx"> my $next = $self->nextToken();
</span><span class="cx"> if ($next->value() eq "enum") {
</span><del>- my $enum = domEnum->new();
</del><ins>+ my $enum = IDLEnum->new();
</ins><span class="cx"> $self->assertTokenValue($self->getToken(), "enum", __LINE__);
</span><span class="cx"> my $enumNameToken = $self->getToken();
</span><span class="cx"> $self->assertTokenType($enumNameToken, IdentifierToken);
</span><span class="lines">@@ -978,8 +971,7 @@
</span><span class="cx"> my $next = $self->nextToken();
</span><span class="cx"> if ($next->value() eq "typedef") {
</span><span class="cx"> $self->assertTokenValue($self->getToken(), "typedef", __LINE__);
</span><del>- my $typedef = Typedef->new();
- $typedef->extendedAttributes($self->parseExtendedAttributeListAllowEmpty());
</del><ins>+ my $typedef = IDLTypedef->new();
</ins><span class="cx">
</span><span class="cx"> my $type = $self->parseType();
</span><span class="cx"> $typedef->type($type);
</span><span class="lines">@@ -1018,7 +1010,7 @@
</span><span class="cx">
</span><span class="cx"> my $next = $self->nextToken();
</span><span class="cx"> if ($next->value() eq "const") {
</span><del>- my $newDataNode = domConstant->new();
</del><ins>+ my $newDataNode = IDLConstant->new();
</ins><span class="cx"> $self->assertTokenValue($self->getToken(), "const", __LINE__);
</span><span class="cx"> my $type = $self->parseConstType();
</span><span class="cx"> $newDataNode->type($type);
</span><span class="lines">@@ -1133,13 +1125,12 @@
</span><span class="cx"> $newDataNode = $self->parseSerializerRest($extendedAttributeList);
</span><span class="cx"> my $next = $self->nextToken();
</span><span class="cx"> } else {
</span><del>- $newDataNode = domSerializable->new();
</del><ins>+ $newDataNode = IDLSerializable->new();
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- my $toJSONFunction = domFunction->new();
- $toJSONFunction->signature(domSignature->new());
- $toJSONFunction->signature->extendedAttributes($extendedAttributeList);
- $toJSONFunction->signature->name("toJSON");
</del><ins>+ my $toJSONFunction = IDLOperation->new();
+ $toJSONFunction->name("toJSON");
+ $toJSONFunction->extendedAttributes($extendedAttributeList);
</ins><span class="cx"> push(@{$newDataNode->functions}, $toJSONFunction);
</span><span class="cx">
</span><span class="cx"> $self->assertTokenValue($self->getToken(), ";", __LINE__);
</span><span class="lines">@@ -1172,7 +1163,7 @@
</span><span class="cx"> my $next = $self->nextToken();
</span><span class="cx"> if ($next->value() eq "{") {
</span><span class="cx"> $self->assertTokenValue($self->getToken(), "{", __LINE__);
</span><del>- my $newDataNode = domSerializable->new();
</del><ins>+ my $newDataNode = IDLSerializable->new();
</ins><span class="cx"> $self->parseSerializationAttributes($newDataNode);
</span><span class="cx"> $self->assertTokenValue($self->getToken(), "}", __LINE__);
</span><span class="cx"> return $newDataNode;
</span><span class="lines">@@ -1186,7 +1177,7 @@
</span><span class="cx"> $self->assertTokenType($token, IdentifierToken);
</span><span class="cx"> push(@attributes, $token->value());
</span><span class="cx">
</span><del>- my $newDataNode = domSerializable->new();
</del><ins>+ my $newDataNode = IDLSerializable->new();
</ins><span class="cx"> $newDataNode->attributes(\@attributes);
</span><span class="cx">
</span><span class="cx"> return $newDataNode;
</span><span class="lines">@@ -1197,21 +1188,21 @@
</span><span class="cx"> sub parseSerializationAttributes
</span><span class="cx"> {
</span><span class="cx"> my $self = shift;
</span><del>- my $domSerializable = shift;
</del><ins>+ my $serializable = shift;
</ins><span class="cx"> my $token = $self->getToken();
</span><span class="cx">
</span><span class="cx"> if ($token->value() eq "getter") {
</span><del>- $domSerializable->hasGetter(1);
</del><ins>+ $serializable->hasGetter(1);
</ins><span class="cx"> die "Serializer getter keyword is not currently supported.";
</span><span class="cx">
</span><span class="cx"> }
</span><span class="cx"> if ($token->value() eq "inherit") {
</span><del>- $domSerializable->hasInherit(1);
</del><ins>+ $serializable->hasInherit(1);
</ins><span class="cx"> die "Serializer inherit keyword is not currently supported.";
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if ($token->value() eq "attribute") {
</span><del>- $domSerializable->hasAttribute(1);
</del><ins>+ $serializable->hasAttribute(1);
</ins><span class="cx"> # Attributes will be filled in via applyMemberList()
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="lines">@@ -1220,7 +1211,7 @@
</span><span class="cx"> $self->assertTokenType($token, IdentifierToken);
</span><span class="cx"> push(@attributes, $token->value());
</span><span class="cx"> push(@attributes, @{$self->parseIdentifiers()});
</span><del>- $domSerializable->attributes(\@attributes);
</del><ins>+ $serializable->attributes(\@attributes);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> sub parseIdentifierList
</span><span class="lines">@@ -1286,11 +1277,11 @@
</span><span class="cx"> }
</span><span class="cx"> if ($next->type() == IdentifierToken || $next->value() =~ /$nextAttributeOrOperationRest_1/) {
</span><span class="cx"> my $returnType = $self->parseReturnType();
</span><del>- my $interface = $self->parseOperationRest($extendedAttributeList);
- if (defined ($interface)) {
- $interface->signature->type($returnType);
</del><ins>+ my $operation = $self->parseOperationRest($extendedAttributeList);
+ if (defined ($operation)) {
+ $operation->type($returnType);
</ins><span class="cx"> }
</span><del>- return $interface;
</del><ins>+ return $operation;
</ins><span class="cx"> }
</span><span class="cx"> $self->assertUnexpectedToken($next->value(), __LINE__);
</span><span class="cx"> }
</span><span class="lines">@@ -1315,26 +1306,25 @@
</span><span class="cx">
</span><span class="cx"> my $next = $self->nextToken();
</span><span class="cx"> if ($next->value() =~ /$nextAttributeRest_1/) {
</span><del>- my $newDataNode = domAttribute->new();
- if ($self->parseReadOnly()) {
- $newDataNode->isReadOnly(1);
- }
</del><ins>+ my $newDataNode = IDLAttribute->new();
+ $newDataNode->isReadOnly($self->parseReadOnly());
+
</ins><span class="cx"> $self->assertTokenValue($self->getToken(), "attribute", __LINE__);
</span><del>- $newDataNode->signature(domSignature->new());
</del><span class="cx">
</span><span class="cx"> my $type = $self->parseType();
</span><del>- $newDataNode->signature->type($type);
</del><ins>+ $newDataNode->type($type);
</ins><span class="cx">
</span><span class="cx"> my $token = $self->getToken();
</span><span class="cx"> $self->assertTokenType($token, IdentifierToken);
</span><del>- $newDataNode->signature->name(identifierRemoveNullablePrefix($token->value()));
</del><ins>+ $newDataNode->name(identifierRemoveNullablePrefix($token->value()));
</ins><span class="cx"> $self->assertTokenValue($self->getToken(), ";", __LINE__);
</span><ins>+
</ins><span class="cx"> # CustomConstructor may also be used on attributes.
</span><span class="cx"> if (defined $extendedAttributeList->{"CustomConstructors"}) {
</span><span class="cx"> delete $extendedAttributeList->{"CustomConstructors"};
</span><span class="cx"> $extendedAttributeList->{"CustomConstructor"} = "VALUE_IS_MISSING";
</span><span class="cx"> }
</span><del>- $newDataNode->signature->extendedAttributes($extendedAttributeList);
</del><ins>+ $newDataNode->extendedAttributes($extendedAttributeList);
</ins><span class="cx"> return $newDataNode;
</span><span class="cx"> }
</span><span class="cx"> $self->assertUnexpectedToken($next->value(), __LINE__);
</span><span class="lines">@@ -1379,7 +1369,7 @@
</span><span class="cx"> my $next = $self->nextToken();
</span><span class="cx"> if ($next->type() == IdentifierToken || $next->value() eq "(") {
</span><span class="cx"> my $operation = $self->parseOperationRest($extendedAttributeList);
</span><del>- $operation->signature->type($returnType);
</del><ins>+ $operation->type($returnType);
</ins><span class="cx"> return $operation;
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -1396,12 +1386,12 @@
</span><span class="cx"> my @specials = ();
</span><span class="cx"> push(@specials, @{$self->parseSpecials()});
</span><span class="cx"> my $returnType = $self->parseReturnType();
</span><del>- my $interface = $self->parseOperationRest($extendedAttributeList);
- if (defined ($interface)) {
- $interface->signature->type($returnType);
- $interface->signature->specials(\@specials);
</del><ins>+ my $operation = $self->parseOperationRest($extendedAttributeList);
+ if (defined ($operation)) {
+ $operation->type($returnType);
+ $operation->specials(\@specials);
</ins><span class="cx"> }
</span><del>- return $interface;
</del><ins>+ return $operation;
</ins><span class="cx"> }
</span><span class="cx"> $self->assertUnexpectedToken($next->value(), __LINE__);
</span><span class="cx"> }
</span><span class="lines">@@ -1469,36 +1459,31 @@
</span><span class="cx"> my $self = shift;
</span><span class="cx"> my $extendedAttributeList = shift;
</span><span class="cx">
</span><del>- my $symbolIteratorFunction = domFunction->new();
- $symbolIteratorFunction->signature(domSignature->new());
- $symbolIteratorFunction->signature->extendedAttributes($extendedAttributeList);
- $symbolIteratorFunction->signature->name("[Symbol.Iterator]");
</del><ins>+ my $symbolIteratorFunction = IDLOperation->new();
+ $symbolIteratorFunction->name("[Symbol.Iterator]");
+ $symbolIteratorFunction->extendedAttributes($extendedAttributeList);
</ins><span class="cx">
</span><del>- my $entriesFunction = domFunction->new();
- $entriesFunction->signature(domSignature->new());
- $entriesFunction->signature->extendedAttributes($extendedAttributeList);
- $entriesFunction->signature->name("entries");
</del><ins>+ my $entriesFunction = IDLOperation->new();
+ $entriesFunction->name("entries");
+ $entriesFunction->extendedAttributes($extendedAttributeList);
</ins><span class="cx">
</span><del>- my $keysFunction = domFunction->new();
- $keysFunction->signature(domSignature->new());
- $keysFunction->signature->extendedAttributes($extendedAttributeList);
- $keysFunction->signature->name("keys");
</del><ins>+ my $keysFunction = IDLOperation->new();
+ $keysFunction->name("keys");
+ $keysFunction->extendedAttributes($extendedAttributeList);
</ins><span class="cx">
</span><del>- my $valuesFunction = domFunction->new();
- $valuesFunction->signature(domSignature->new());
- $valuesFunction->signature->extendedAttributes($extendedAttributeList);
- $valuesFunction->signature->name("values");
</del><ins>+ my $valuesFunction = IDLOperation->new();
+ $valuesFunction->name("values");
+ $valuesFunction->extendedAttributes($extendedAttributeList);
</ins><span class="cx">
</span><del>- my $forEachFunction = domFunction->new();
- $forEachFunction->signature(domSignature->new());
- $forEachFunction->signature->extendedAttributes($extendedAttributeList);
- $forEachFunction->signature->name("forEach");
- my $forEachArgument = domSignature->new();
</del><ins>+ my $forEachFunction = IDLOperation->new();
+ $forEachFunction->name("forEach");
+ $forEachFunction->extendedAttributes($extendedAttributeList);
+ my $forEachArgument = IDLArgument->new();
</ins><span class="cx"> $forEachArgument->name("callback");
</span><span class="cx"> $forEachArgument->type(makeSimpleType("any"));
</span><del>- push(@{$forEachFunction->parameters}, ($forEachArgument));
</del><ins>+ push(@{$forEachFunction->arguments}, ($forEachArgument));
</ins><span class="cx">
</span><del>- my $newDataNode = domIterable->new();
</del><ins>+ my $newDataNode = IDLIterable->new();
</ins><span class="cx"> $newDataNode->extendedAttributes($extendedAttributeList);
</span><span class="cx"> push(@{$newDataNode->functions}, $symbolIteratorFunction);
</span><span class="cx"> push(@{$newDataNode->functions}, $entriesFunction);
</span><span class="lines">@@ -1532,15 +1517,19 @@
</span><span class="cx">
</span><span class="cx"> my $next = $self->nextToken();
</span><span class="cx"> if ($next->type() == IdentifierToken || $next->value() eq "(") {
</span><del>- my $newDataNode = domFunction->new();
- $newDataNode->signature(domSignature->new());
</del><ins>+ my $newDataNode = IDLOperation->new();
+
</ins><span class="cx"> my $name = $self->parseOptionalIdentifier();
</span><del>- $newDataNode->signature->name(identifierRemoveNullablePrefix($name));
</del><ins>+ $newDataNode->name(identifierRemoveNullablePrefix($name));
+
</ins><span class="cx"> $self->assertTokenValue($self->getToken(), "(", $name, __LINE__);
</span><del>- push(@{$newDataNode->parameters}, @{$self->parseArgumentList()});
</del><ins>+
+ push(@{$newDataNode->arguments}, @{$self->parseArgumentList()});
+
</ins><span class="cx"> $self->assertTokenValue($self->getToken(), ")", __LINE__);
</span><span class="cx"> $self->assertTokenValue($self->getToken(), ";", __LINE__);
</span><del>- $newDataNode->signature->extendedAttributes($extendedAttributeList);
</del><ins>+
+ $newDataNode->extendedAttributes($extendedAttributeList);
</ins><span class="cx"> return $newDataNode;
</span><span class="cx"> }
</span><span class="cx"> $self->assertUnexpectedToken($next->value(), __LINE__);
</span><span class="lines">@@ -1592,10 +1581,8 @@
</span><span class="cx"> my $self = shift;
</span><span class="cx"> my $next = $self->nextToken();
</span><span class="cx"> if ($next->type() == IdentifierToken || $next->value() =~ /$nextArgumentList_1/) {
</span><del>- my $in = $self->parseIn();
</del><span class="cx"> my $extendedAttributeList = $self->parseExtendedAttributeListAllowEmpty();
</span><span class="cx"> my $argument = $self->parseOptionalOrRequiredArgument($extendedAttributeList);
</span><del>- $argument->direction($self->parseIn());
</del><span class="cx"> return $argument;
</span><span class="cx"> }
</span><span class="cx"> $self->assertUnexpectedToken($next->value(), __LINE__);
</span><span class="lines">@@ -1606,7 +1593,7 @@
</span><span class="cx"> my $self = shift;
</span><span class="cx"> my $extendedAttributeList = shift;
</span><span class="cx">
</span><del>- my $paramDataNode = domSignature->new();
</del><ins>+ my $paramDataNode = IDLArgument->new();
</ins><span class="cx"> $paramDataNode->extendedAttributes($extendedAttributeList);
</span><span class="cx">
</span><span class="cx"> my $next = $self->nextToken();
</span><span class="lines">@@ -1677,19 +1664,17 @@
</span><span class="cx">
</span><span class="cx"> my $next = $self->nextToken();
</span><span class="cx"> if ($next->type() == IdentifierToken || $next->value() =~ /$nextExceptionField_1/) {
</span><del>- my $newDataNode = domAttribute->new();
- $newDataNode->type("attribute");
</del><ins>+ my $newDataNode = IDLAttribute->new();
</ins><span class="cx"> $newDataNode->isReadOnly(1);
</span><del>- $newDataNode->signature(domSignature->new());
</del><span class="cx">
</span><span class="cx"> my $type = $self->parseType();
</span><del>- $newDataNode->signature->type($type);
</del><ins>+ $newDataNode->type($type);
</ins><span class="cx">
</span><span class="cx"> my $token = $self->getToken();
</span><span class="cx"> $self->assertTokenType($token, IdentifierToken);
</span><del>- $newDataNode->signature->name(identifierRemoveNullablePrefix($token->value()));
</del><ins>+ $newDataNode->name(identifierRemoveNullablePrefix($token->value()));
</ins><span class="cx"> $self->assertTokenValue($self->getToken(), ";", __LINE__);
</span><del>- $newDataNode->signature->extendedAttributes($extendedAttributeList);
</del><ins>+ $newDataNode->extendedAttributes($extendedAttributeList);
</ins><span class="cx"> return $newDataNode;
</span><span class="cx"> }
</span><span class="cx"> $self->assertUnexpectedToken($next->value(), __LINE__);
</span><span class="lines">@@ -1959,7 +1944,7 @@
</span><span class="cx"> if ($next->value() eq "any") {
</span><span class="cx"> $self->assertTokenValue($self->getToken(), "any", __LINE__);
</span><span class="cx">
</span><del>- my $anyType = domType->new();
</del><ins>+ my $anyType = IDLType->new();
</ins><span class="cx"> $anyType->name("any");
</span><span class="cx"> return $anyType;
</span><span class="cx"> }
</span><span class="lines">@@ -1976,7 +1961,7 @@
</span><span class="cx"> my $self = shift;
</span><span class="cx"> my $next = $self->nextToken();
</span><span class="cx">
</span><del>- my $unionType = domType->new();
</del><ins>+ my $unionType = IDLType->new();
</ins><span class="cx"> $unionType->name("UNION");
</span><span class="cx"> $unionType->isUnion(1);
</span><span class="cx">
</span><span class="lines">@@ -2035,7 +2020,7 @@
</span><span class="cx"> my $self = shift;
</span><span class="cx"> my $next = $self->nextToken();
</span><span class="cx">
</span><del>- my $type = domType->new();
</del><ins>+ my $type = IDLType->new();
</ins><span class="cx">
</span><span class="cx"> if ($next->value() =~ /$nextNonAnyType_1/) {
</span><span class="cx"> $type->name($self->parsePrimitiveType());
</span><span class="lines">@@ -2131,7 +2116,7 @@
</span><span class="cx"> my $self = shift;
</span><span class="cx"> my $next = $self->nextToken();
</span><span class="cx">
</span><del>- my $type = domType->new();
</del><ins>+ my $type = IDLType->new();
</ins><span class="cx">
</span><span class="cx"> if ($next->value() =~ /$nextNonAnyType_1/) {
</span><span class="cx"> $type->name($self->parsePrimitiveType());
</span><span class="lines">@@ -2268,7 +2253,7 @@
</span><span class="cx"> if ($next->value() eq "void") {
</span><span class="cx"> $self->assertTokenValue($self->getToken(), "void", __LINE__);
</span><span class="cx">
</span><del>- my $voidType = domType->new();
</del><ins>+ my $voidType = IDLType->new();
</ins><span class="cx"> $voidType->name("void");
</span><span class="cx"> return $voidType;
</span><span class="cx"> }
</span><span class="lines">@@ -2278,17 +2263,6 @@
</span><span class="cx"> $self->assertUnexpectedToken($next->value(), __LINE__);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-sub parseIn
-{
- my $self = shift;
- my $next = $self->nextToken();
- if ($next->value() eq "in") {
- $self->assertTokenValue($self->getToken(), "in", __LINE__);
- return "in";
- }
- return "";
-}
-
</del><span class="cx"> sub parseOptionalSemicolon
</span><span class="cx"> {
</span><span class="cx"> my $self = shift;
</span><span class="lines">@@ -2329,7 +2303,7 @@
</span><span class="cx"> # This check may have to move to the code generator, if we don't have enough information
</span><span class="cx"> # here to determine serializability: https://heycam.github.io/webidl/#idl-serializers
</span><span class="cx"> my $serializable_types = '^(\(byte|octet|short|unsigned short|long|unsigned long|long long|unsigned long long|float|unrestricted float|double|unrestricted double|boolean|DOMString|ByteString|USVString)$';
</span><del>- return $attribute->signature->type->name =~ /$serializable_types/;
</del><ins>+ return $attribute->type->name =~ /$serializable_types/;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> sub applyMemberList
</span><span class="lines">@@ -2338,20 +2312,20 @@
</span><span class="cx"> my $members = shift;
</span><span class="cx">
</span><span class="cx"> for my $item (@{$members}) {
</span><del>- if (ref($item) eq "domAttribute") {
</del><ins>+ if (ref($item) eq "IDLAttribute") {
</ins><span class="cx"> push(@{$interface->attributes}, $item);
</span><span class="cx"> next;
</span><span class="cx"> }
</span><del>- if (ref($item) eq "domConstant") {
</del><ins>+ if (ref($item) eq "IDLConstant") {
</ins><span class="cx"> push(@{$interface->constants}, $item);
</span><span class="cx"> next;
</span><span class="cx"> }
</span><del>- if (ref($item) eq "domIterable") {
</del><ins>+ if (ref($item) eq "IDLIterable") {
</ins><span class="cx"> $interface->iterable($item);
</span><span class="cx"> next;
</span><span class="cx"> }
</span><del>- if (ref($item) eq "domFunction") {
- if ($item->signature->name eq "") {
</del><ins>+ if (ref($item) eq "IDLOperation") {
+ if ($item->name eq "") {
</ins><span class="cx"> push(@{$interface->anonymousFunctions}, $item);
</span><span class="cx"> } else {
</span><span class="cx"> push(@{$interface->functions}, $item);
</span><span class="lines">@@ -2358,7 +2332,7 @@
</span><span class="cx"> }
</span><span class="cx"> next;
</span><span class="cx"> }
</span><del>- if (ref($item) eq "domSerializable") {
</del><ins>+ if (ref($item) eq "IDLSerializable") {
</ins><span class="cx"> $interface->serializable($item);
</span><span class="cx"> next;
</span><span class="cx"> }
</span><span class="lines">@@ -2369,12 +2343,12 @@
</span><span class="cx"> if ($interface->serializable->hasAttribute) {
</span><span class="cx"> foreach my $attribute (@{$interface->attributes}) {
</span><span class="cx"> if (isSerializableAttribute($attribute)) {
</span><del>- push(@{$interface->serializable->attributes}, $attribute->signature->name);
</del><ins>+ push(@{$interface->serializable->attributes}, $attribute->name);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> } elsif ($numSerializerAttributes == 0) {
</span><span class="cx"> foreach my $attribute (@{$interface->attributes}) {
</span><del>- push(@{$interface->serializable->attributes}, $attribute->signature->name);
</del><ins>+ push(@{$interface->serializable->attributes}, $attribute->name);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -2389,24 +2363,22 @@
</span><span class="cx"> my @constructorParams = @{$extendedAttributeList->{"Constructors"}};
</span><span class="cx"> my $index = (@constructorParams == 1) ? 0 : 1;
</span><span class="cx"> foreach my $param (@constructorParams) {
</span><del>- my $constructor = domFunction->new();
- $constructor->signature(domSignature->new());
- $constructor->signature->name("Constructor");
- $constructor->signature->extendedAttributes($extendedAttributeList);
- $constructor->parameters($param);
</del><ins>+ my $constructor = IDLOperation->new();
+ $constructor->name("Constructor");
+ $constructor->extendedAttributes($extendedAttributeList);
+ $constructor->arguments($param);
</ins><span class="cx"> push(@{$interface->constructors}, $constructor);
</span><span class="cx"> }
</span><span class="cx"> delete $extendedAttributeList->{"Constructors"};
</span><span class="cx"> $extendedAttributeList->{"Constructor"} = "VALUE_IS_MISSING";
</span><span class="cx"> } elsif (defined $extendedAttributeList->{"NamedConstructor"}) {
</span><del>- my $newDataNode = domFunction->new();
- $newDataNode->signature(domSignature->new());
- $newDataNode->signature->name("NamedConstructor");
- $newDataNode->signature->extendedAttributes($extendedAttributeList);
</del><ins>+ my $newDataNode = IDLOperation->new();
+ $newDataNode->name("NamedConstructor");
+ $newDataNode->extendedAttributes($extendedAttributeList);
</ins><span class="cx"> my %attributes = %{$extendedAttributeList->{"NamedConstructor"}};
</span><span class="cx"> my @attributeKeys = keys (%attributes);
</span><span class="cx"> my $constructorName = $attributeKeys[0];
</span><del>- push(@{$newDataNode->parameters}, @{$attributes{$constructorName}});
</del><ins>+ push(@{$newDataNode->arguments}, @{$attributes{$constructorName}});
</ins><span class="cx"> $extendedAttributeList->{"NamedConstructor"} = $constructorName;
</span><span class="cx"> push(@{$interface->constructors}, $newDataNode);
</span><span class="cx"> }
</span><span class="lines">@@ -2414,11 +2386,10 @@
</span><span class="cx"> my @customConstructorParams = @{$extendedAttributeList->{"CustomConstructors"}};
</span><span class="cx"> my $index = (@customConstructorParams == 1) ? 0 : 1;
</span><span class="cx"> foreach my $param (@customConstructorParams) {
</span><del>- my $customConstructor = domFunction->new();
- $customConstructor->signature(domSignature->new());
- $customConstructor->signature->name("CustomConstructor");
- $customConstructor->signature->extendedAttributes($extendedAttributeList);
- $customConstructor->parameters($param);
</del><ins>+ my $customConstructor = IDLOperation->new();
+ $customConstructor->name("CustomConstructor");
+ $customConstructor->extendedAttributes($extendedAttributeList);
+ $customConstructor->arguments($param);
</ins><span class="cx"> push(@{$interface->customConstructors}, $customConstructor);
</span><span class="cx"> }
</span><span class="cx"> delete $extendedAttributeList->{"CustomConstructors"};
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsgeneratebindingspl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/generate-bindings.pl (208133 => 208134)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/generate-bindings.pl        2016-10-30 22:33:02 UTC (rev 208133)
+++ trunk/Source/WebCore/bindings/scripts/generate-bindings.pl        2016-10-30 22:35:00 UTC (rev 208134)
</span><span class="lines">@@ -157,14 +157,14 @@
</span><span class="cx">
</span><span class="cx"> # Support for attributes of partial interfaces.
</span><span class="cx"> foreach my $attribute (@{$interface->attributes}) {
</span><del>- next unless shouldPropertyBeExposed($attribute->signature, \@targetGlobalContexts);
</del><ins>+ next unless shouldPropertyBeExposed($attribute, \@targetGlobalContexts);
</ins><span class="cx">
</span><span class="cx"> # Record that this attribute is implemented by $interfaceName.
</span><del>- $attribute->signature->extendedAttributes->{"ImplementedBy"} = $interfaceName if $interface->isPartial;
</del><ins>+ $attribute->extendedAttributes->{"ImplementedBy"} = $interfaceName if $interface->isPartial;
</ins><span class="cx">
</span><span class="cx"> # Add interface-wide extended attributes to each attribute.
</span><span class="cx"> foreach my $extendedAttributeName (keys %{$interface->extendedAttributes}) {
</span><del>- $attribute->signature->extendedAttributes->{$extendedAttributeName} = $interface->extendedAttributes->{$extendedAttributeName};
</del><ins>+ $attribute->extendedAttributes->{$extendedAttributeName} = $interface->extendedAttributes->{$extendedAttributeName};
</ins><span class="cx"> }
</span><span class="cx"> push(@{$targetDataNode->attributes}, $attribute);
</span><span class="cx"> }
</span><span class="lines">@@ -171,14 +171,14 @@
</span><span class="cx">
</span><span class="cx"> # Support for methods of partial interfaces.
</span><span class="cx"> foreach my $function (@{$interface->functions}) {
</span><del>- next unless shouldPropertyBeExposed($function->signature, \@targetGlobalContexts);
</del><ins>+ next unless shouldPropertyBeExposed($function, \@targetGlobalContexts);
</ins><span class="cx">
</span><span class="cx"> # Record that this method is implemented by $interfaceName.
</span><del>- $function->signature->extendedAttributes->{"ImplementedBy"} = $interfaceName if $interface->isPartial;
</del><ins>+ $function->extendedAttributes->{"ImplementedBy"} = $interfaceName if $interface->isPartial;
</ins><span class="cx">
</span><span class="cx"> # Add interface-wide extended attributes to each method.
</span><span class="cx"> foreach my $extendedAttributeName (keys %{$interface->extendedAttributes}) {
</span><del>- $function->signature->extendedAttributes->{$extendedAttributeName} = $interface->extendedAttributes->{$extendedAttributeName};
</del><ins>+ $function->extendedAttributes->{$extendedAttributeName} = $interface->extendedAttributes->{$extendedAttributeName};
</ins><span class="cx"> }
</span><span class="cx"> push(@{$targetDataNode->functions}, $function);
</span><span class="cx"> }
</span><span class="lines">@@ -210,9 +210,9 @@
</span><span class="cx"> # on which global contexts they should be exposed.
</span><span class="cx"> sub shouldPropertyBeExposed
</span><span class="cx"> {
</span><del>- my ($signature, $targetGlobalContexts) = @_;
</del><ins>+ my ($context, $targetGlobalContexts) = @_;
</ins><span class="cx">
</span><del>- my $exposed = $signature->extendedAttributes->{Exposed};
</del><ins>+ my $exposed = $context->extendedAttributes->{Exposed};
</ins><span class="cx">
</span><span class="cx"> return 1 unless $exposed;
</span><span class="cx">
</span><span class="lines">@@ -289,13 +289,13 @@
</span><span class="cx"> checkIfIDLAttributesExists($idlAttributes, $interface->extendedAttributes, $idlFile);
</span><span class="cx">
</span><span class="cx"> foreach my $attribute (@{$interface->attributes}) {
</span><del>- checkIfIDLAttributesExists($idlAttributes, $attribute->signature->extendedAttributes, $idlFile);
</del><ins>+ checkIfIDLAttributesExists($idlAttributes, $attribute->extendedAttributes, $idlFile);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> foreach my $function (@{$interface->functions}) {
</span><del>- checkIfIDLAttributesExists($idlAttributes, $function->signature->extendedAttributes, $idlFile);
- foreach my $parameter (@{$function->parameters}) {
- checkIfIDLAttributesExists($idlAttributes, $parameter->extendedAttributes, $idlFile);
</del><ins>+ checkIfIDLAttributesExists($idlAttributes, $function->extendedAttributes, $idlFile);
+ foreach my $argument (@{$function->arguments}) {
+ checkIfIDLAttributesExists($idlAttributes, $argument->extendedAttributes, $idlFile);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestTypedefscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp (208133 => 208134)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp        2016-10-30 22:33:02 UTC (rev 208133)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp        2016-10-30 22:35:00 UTC (rev 208134)
</span><span class="lines">@@ -48,6 +48,7 @@
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionNullableSequenceArg(JSC::ExecState*);
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionSequenceOfNullablesArg(JSC::ExecState*);
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionNullableSequenceOfNullablesArg(JSC::ExecState*);
</span><ins>+JSC::EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionNullableSequenceOfUnionsArg(JSC::ExecState*);
</ins><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionUnionArg(JSC::ExecState*);
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionFuncWithClamp(JSC::ExecState*);
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionImmutablePointFunction(JSC::ExecState*);
</span><span class="lines">@@ -173,6 +174,7 @@
</span><span class="cx"> { "nullableSequenceArg", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestTypedefsPrototypeFunctionNullableSequenceArg), (intptr_t) (1) } },
</span><span class="cx"> { "sequenceOfNullablesArg", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestTypedefsPrototypeFunctionSequenceOfNullablesArg), (intptr_t) (1) } },
</span><span class="cx"> { "nullableSequenceOfNullablesArg", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestTypedefsPrototypeFunctionNullableSequenceOfNullablesArg), (intptr_t) (1) } },
</span><ins>+ { "nullableSequenceOfUnionsArg", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestTypedefsPrototypeFunctionNullableSequenceOfUnionsArg), (intptr_t) (1) } },
</ins><span class="cx"> { "unionArg", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestTypedefsPrototypeFunctionUnionArg), (intptr_t) (1) } },
</span><span class="cx"> { "funcWithClamp", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestTypedefsPrototypeFunctionFuncWithClamp), (intptr_t) (1) } },
</span><span class="cx"> { "immutablePointFunction", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestTypedefsPrototypeFunctionImmutablePointFunction), (intptr_t) (0) } },
</span><span class="lines">@@ -610,6 +612,26 @@
</span><span class="cx"> return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+static inline JSC::EncodedJSValue jsTestTypedefsPrototypeFunctionNullableSequenceOfUnionsArgCaller(JSC::ExecState*, JSTestTypedefs*, JSC::ThrowScope&);
+
+EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionNullableSequenceOfUnionsArg(ExecState* state)
+{
+ return BindingCaller<JSTestTypedefs>::callOperation<jsTestTypedefsPrototypeFunctionNullableSequenceOfUnionsArgCaller>(state, "nullableSequenceOfUnionsArg");
+}
+
+static inline JSC::EncodedJSValue jsTestTypedefsPrototypeFunctionNullableSequenceOfUnionsArgCaller(JSC::ExecState* state, JSTestTypedefs* castedThis, JSC::ThrowScope& throwScope)
+{
+ UNUSED_PARAM(state);
+ UNUSED_PARAM(throwScope);
+ auto& impl = castedThis->wrapped();
+ if (UNLIKELY(state->argumentCount() < 1))
+ return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
+ auto sequenceArg = convert<IDLNullable<IDLSequence<IDLUnion<IDLDOMString, IDLSequence<IDLDOMString>>>>>(*state, state->uncheckedArgument(0));
+ RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
+ impl.nullableSequenceOfUnionsArg(WTFMove(sequenceArg));
+ return JSValue::encode(jsUndefined());
+}
+
</ins><span class="cx"> static inline JSC::EncodedJSValue jsTestTypedefsPrototypeFunctionUnionArgCaller(JSC::ExecState*, JSTestTypedefs*, JSC::ThrowScope&);
</span><span class="cx">
</span><span class="cx"> EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionUnionArg(ExecState* state)
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestTestTypedefsidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/TestTypedefs.idl (208133 => 208134)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/TestTypedefs.idl        2016-10-30 22:33:02 UTC (rev 208133)
+++ trunk/Source/WebCore/bindings/scripts/test/TestTypedefs.idl        2016-10-30 22:35:00 UTC (rev 208134)
</span><span class="lines">@@ -49,10 +49,11 @@
</span><span class="cx"> void nullableSequenceArg(SEQUENCE_OF_STRINGS? sequenceArg);
</span><span class="cx"> void sequenceOfNullablesArg(sequence<STRING?> sequenceArg);
</span><span class="cx"> void nullableSequenceOfNullablesArg(SEQUENCE_OF_NULLABLE_STRINGS? sequenceArg);
</span><ins>+ void nullableSequenceOfUnionsArg(sequence<(STRING or SEQUENCE_OF_STRINGS)>? sequenceArg);
</ins><span class="cx">
</span><span class="cx"> void unionArg(UNION_STRING_LONG unionArg);
</span><span class="cx">
</span><del>- void funcWithClamp(ULONGLONG_CLAMP arg1, optional ULONGLONG_CLAMP arg2);
</del><ins>+ void funcWithClamp([Clamp] ULONGLONG arg1, [Clamp] optional ULONGLONG arg2);
</ins><span class="cx">
</span><span class="cx"> [Immutable] SVGPOINT immutablePointFunction();
</span><span class="cx">
</span><span class="lines">@@ -71,7 +72,6 @@
</span><span class="cx">
</span><span class="cx"> typedef unrestricted float DOUBLE;
</span><span class="cx"> typedef unsigned long long ULONGLONG;
</span><del>-typedef [Clamp] unsigned long long ULONGLONG_CLAMP;
</del><span class="cx"> typedef SerializedScriptValue SCRIPT_VALUE;
</span><span class="cx"> typedef sequence<long> SEQUENCE_OF_LONGS;
</span><span class="cx"> typedef long? NULLABLE_LONG;
</span></span></pre></div>
<a id="trunkSourceWebCorepagemake_settingspl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/make_settings.pl (208133 => 208134)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/make_settings.pl        2016-10-30 22:33:02 UTC (rev 208133)
+++ trunk/Source/WebCore/page/make_settings.pl        2016-10-30 22:35:00 UTC (rev 208134)
</span><span class="lines">@@ -370,7 +370,7 @@
</span><span class="cx"> my $type = $parsedItems{$settingName}{"type"};
</span><span class="cx"> my $idlType = $webcoreTypeToIdlType{$type};
</span><span class="cx"> my $setterFunctionName = setterFunctionName($settingName);
</span><del>- print $file " void $setterFunctionName(in $idlType $settingName);\n";
</del><ins>+ print $file " void $setterFunctionName($idlType $settingName);\n";
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> enumerateParsedItems($file, $parsedItemsRef, \&writeIdlSetter);
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (208133 => 208134)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2016-10-30 22:33:02 UTC (rev 208133)
+++ trunk/Tools/ChangeLog        2016-10-30 22:35:00 UTC (rev 208134)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2016-10-30 Sam Weinig <sam@webkit.org>
+
+ [WebIDL] Restructure IDLParser structs to better match modern WebIDL concepts
+ https://bugs.webkit.org/show_bug.cgi?id=164208
+
+ Reviewed by Darin Adler.
+
+ * DumpRenderTree/Bindings/CodeGeneratorDumpRenderTree.pm:
+ * WebKitTestRunner/InjectedBundle/Bindings/CodeGeneratorTestRunner.pm:
+ Update for new struct types.
+
</ins><span class="cx"> 2016-10-29 Darin Adler <darin@apple.com>
</span><span class="cx">
</span><span class="cx"> Fix failing ExtendedColor tests.
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreeBindingsCodeGeneratorDumpRenderTreepm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/Bindings/CodeGeneratorDumpRenderTree.pm (208133 => 208134)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/Bindings/CodeGeneratorDumpRenderTree.pm        2016-10-30 22:33:02 UTC (rev 208133)
+++ trunk/Tools/DumpRenderTree/Bindings/CodeGeneratorDumpRenderTree.pm        2016-10-30 22:35:00 UTC (rev 208134)
</span><span class="lines">@@ -176,7 +176,7 @@
</span><span class="cx"> if (my @functions = @{$interface->functions}) {
</span><span class="cx"> push(@contents, "\n // Functions\n\n");
</span><span class="cx"> foreach my $function (@functions) {
</span><del>- push(@contents, " static JSValueRef @{[$function->signature->name]}(JSContextRef, JSObjectRef, JSObjectRef, size_t, const JSValueRef[], JSValueRef*);\n");
</del><ins>+ push(@contents, " static JSValueRef @{[$function->name]}(JSContextRef, JSObjectRef, JSObjectRef, size_t, const JSValueRef[], JSValueRef*);\n");
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -270,7 +270,7 @@
</span><span class="cx"> foreach my $function (@functions) {
</span><span class="cx"> push(@contents, <<EOF);
</span><span class="cx">
</span><del>-JSValueRef ${className}::@{[$function->signature->name]}(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
</del><ins>+JSValueRef ${className}::@{[$function->name]}(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
</ins><span class="cx"> {
</span><span class="cx"> ${implementationClassName}* impl = to${implementationClassName}(context, thisObject);
</span><span class="cx"> if (!impl)
</span><span class="lines">@@ -278,33 +278,33 @@
</span><span class="cx">
</span><span class="cx"> EOF
</span><span class="cx"> my $functionCall;
</span><del>- if ($function->signature->extendedAttributes->{"CustomArgumentHandling"}) {
- $functionCall = "impl->" . $function->signature->name . "(context, argumentCount, arguments, exception)";
</del><ins>+ if ($function->extendedAttributes->{"CustomArgumentHandling"}) {
+ $functionCall = "impl->" . $function->name . "(context, argumentCount, arguments, exception)";
</ins><span class="cx"> } else {
</span><del>- my @parameters = ();
- my @specifiedParameters = @{$function->parameters};
</del><ins>+ my @arguments = ();
+ my @specifiedArguments = @{$function->arguments};
</ins><span class="cx">
</span><del>- $self->_includeHeaders(\%contentsIncludes, $function->signature->type, $function->signature);
</del><ins>+ $self->_includeHeaders(\%contentsIncludes, $function->type);
</ins><span class="cx">
</span><del>- if ($function->signature->extendedAttributes->{"PassContext"}) {
- push(@parameters, "context");
</del><ins>+ if ($function->extendedAttributes->{"PassContext"}) {
+ push(@arguments, "context");
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- foreach my $i (0..$#specifiedParameters) {
- my $parameter = $specifiedParameters[$i];
</del><ins>+ foreach my $i (0..$#specifiedArguments) {
+ my $argument = $specifiedArguments[$i];
</ins><span class="cx">
</span><del>- $self->_includeHeaders(\%contentsIncludes, $type, $parameter);
</del><ins>+ $self->_includeHeaders(\%contentsIncludes, $type);
</ins><span class="cx">
</span><del>- push(@contents, " " . $self->_platformTypeVariableDeclaration($parameter, $parameter->name, "arguments[$i]", "argumentCount > $i") . "\n");
</del><ins>+ push(@contents, " " . $self->_platformTypeVariableDeclaration($argument->type, $argument->name, "arguments[$i]", "argumentCount > $i") . "\n");
</ins><span class="cx">
</span><del>- push(@parameters, $self->_parameterExpression($parameter));
</del><ins>+ push(@arguments, $self->_argumentExpression($argument));
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- $functionCall = "impl->" . $function->signature->name . "(" . join(", ", @parameters) . ")";
</del><ins>+ $functionCall = "impl->" . $function->name . "(" . join(", ", @arguments) . ")";
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- push(@contents, " ${functionCall};\n\n") if $function->signature->type->name eq "void";
- push(@contents, " return " . $self->_returnExpression($function->signature, $functionCall) . ";\n}\n");
</del><ins>+ push(@contents, " ${functionCall};\n\n") if $function->type->name eq "void";
+ push(@contents, " return " . $self->_returnExpression($function->type, $functionCall) . ";\n}\n");
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -311,7 +311,7 @@
</span><span class="cx"> if (my @attributes = @{$interface->attributes}) {
</span><span class="cx"> push(@contents, "\n// Attributes\n");
</span><span class="cx"> foreach my $attribute (@attributes) {
</span><del>- $self->_includeHeaders(\%contentsIncludes, $attribute->signature->type, $attribute->signature);
</del><ins>+ $self->_includeHeaders(\%contentsIncludes, $attribute->type);
</ins><span class="cx">
</span><span class="cx"> my $getterName = $self->_getterName($attribute);
</span><span class="cx"> my $getterExpression = "impl->${getterName}()";
</span><span class="lines">@@ -324,7 +324,7 @@
</span><span class="cx"> if (!impl)
</span><span class="cx"> return JSValueMakeUndefined(context);
</span><span class="cx">
</span><del>- return @{[$self->_returnExpression($attribute->signature, $getterExpression)]};
</del><ins>+ return @{[$self->_returnExpression($attribute->type, $getterExpression)]};
</ins><span class="cx"> }
</span><span class="cx"> EOF
</span><span class="cx">
</span><span class="lines">@@ -339,7 +339,7 @@
</span><span class="cx">
</span><span class="cx"> EOF
</span><span class="cx">
</span><del>- my $platformValue = $self->_platformTypeConstructor($attribute->signature, "value");
</del><ins>+ my $platformValue = $self->_platformTypeConstructor($attribute->type, "value");
</ins><span class="cx">
</span><span class="cx"> push(@contents, <<EOF);
</span><span class="cx"> impl->@{[$self->_setterName($attribute)]}(${platformValue});
</span><span class="lines">@@ -368,12 +368,12 @@
</span><span class="cx"> {
</span><span class="cx"> my ($self, $attribute) = @_;
</span><span class="cx">
</span><del>- return $attribute->signature->name;
</del><ins>+ return $attribute->name;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> sub _includeHeaders
</span><span class="cx"> {
</span><del>- my ($self, $headers, $type, $signature) = @_;
</del><ins>+ my ($self, $headers, $type) = @_;
</ins><span class="cx">
</span><span class="cx"> return unless defined $type;
</span><span class="cx"> return if $type->name eq "boolean";
</span><span class="lines">@@ -416,7 +416,7 @@
</span><span class="cx">
</span><span class="cx"> sub _platformType
</span><span class="cx"> {
</span><del>- my ($self, $type, $signature) = @_;
</del><ins>+ my ($self, $type) = @_;
</ins><span class="cx">
</span><span class="cx"> return undef unless defined $type;
</span><span class="cx">
</span><span class="lines">@@ -429,10 +429,8 @@
</span><span class="cx">
</span><span class="cx"> sub _platformTypeConstructor
</span><span class="cx"> {
</span><del>- my ($self, $signature, $argumentName) = @_;
</del><ins>+ my ($self, $type, $argumentName) = @_;
</ins><span class="cx">
</span><del>- my $type = $signature->type;
-
</del><span class="cx"> return "JSValueToBoolean(context, $argumentName)" if $type eq "boolean";
</span><span class="cx"> return "$argumentName" if $type->name eq "object";
</span><span class="cx"> return "JSRetainPtr<JSStringRef>(Adopt, JSValueToStringCopy(context, $argumentName, 0))" if $$self{codeGenerator}->IsStringType($type);
</span><span class="lines">@@ -442,10 +440,10 @@
</span><span class="cx">
</span><span class="cx"> sub _platformTypeVariableDeclaration
</span><span class="cx"> {
</span><del>- my ($self, $signature, $variableName, $argumentName, $condition) = @_;
</del><ins>+ my ($self, $type, $variableName, $argumentName, $condition) = @_;
</ins><span class="cx">
</span><del>- my $platformType = $self->_platformType($signature->type, $signature);
- my $constructor = $self->_platformTypeConstructor($signature, $argumentName);
</del><ins>+ my $platformType = $self->_platformType($type);
+ my $constructor = $self->_platformTypeConstructor($type, $argumentName);
</ins><span class="cx">
</span><span class="cx"> my %nonPointerTypes = (
</span><span class="cx"> "bool" => 1,
</span><span class="lines">@@ -470,10 +468,8 @@
</span><span class="cx">
</span><span class="cx"> sub _returnExpression
</span><span class="cx"> {
</span><del>- my ($self, $signature, $expression) = @_;
</del><ins>+ my ($self, $returnType, $expression) = @_;
</ins><span class="cx">
</span><del>- my $returnType = $signature->type;
-
</del><span class="cx"> return "JSValueMakeUndefined(context)" if $returnType->name eq "void";
</span><span class="cx"> return "JSValueMakeBoolean(context, ${expression})" if $returnType->name eq "boolean";
</span><span class="cx"> return "${expression}" if $returnType->name eq "object";
</span><span class="lines">@@ -482,12 +478,12 @@
</span><span class="cx"> return "toJS(context, WTF::getPtr(${expression}))";
</span><span class="cx"> }
</span><span class="cx">
</span><del>-sub _parameterExpression
</del><ins>+sub _argumentExpression
</ins><span class="cx"> {
</span><del>- my ($self, $parameter) = @_;
</del><ins>+ my ($self, $argument) = @_;
</ins><span class="cx">
</span><del>- my $type = $parameter->type;
- my $name = $parameter->name;
</del><ins>+ my $type = $argument->type;
+ my $name = $argument->name;
</ins><span class="cx">
</span><span class="cx"> return "${name}.get()" if $$self{codeGenerator}->IsStringType($type);
</span><span class="cx"> return $name;
</span><span class="lines">@@ -497,7 +493,7 @@
</span><span class="cx"> {
</span><span class="cx"> my ($self, $attribute) = @_;
</span><span class="cx">
</span><del>- my $name = $attribute->signature->name;
</del><ins>+ my $name = $attribute->name;
</ins><span class="cx">
</span><span class="cx"> return "set" . $$self{codeGenerator}->WK_ucfirst($name);
</span><span class="cx"> }
</span><span class="lines">@@ -507,9 +503,9 @@
</span><span class="cx"> my ($self, $interface) = @_;
</span><span class="cx">
</span><span class="cx"> my $mapFunction = sub {
</span><del>- my $name = $_->signature->name;
</del><ins>+ my $name = $_->name;
</ins><span class="cx"> my @attributes = qw(kJSPropertyAttributeDontDelete kJSPropertyAttributeReadOnly);
</span><del>- push(@attributes, "kJSPropertyAttributeDontEnum") if $_->signature->extendedAttributes->{"DontEnum"};
</del><ins>+ push(@attributes, "kJSPropertyAttributeDontEnum") if $_->extendedAttributes->{"DontEnum"};
</ins><span class="cx">
</span><span class="cx"> return "{ \"$name\", $name, " . join(" | ", @attributes) . " }";
</span><span class="cx"> };
</span><span class="lines">@@ -547,14 +543,14 @@
</span><span class="cx"> my ($self, $interface) = @_;
</span><span class="cx">
</span><span class="cx"> my $mapFunction = sub {
</span><del>- return if $_->signature->extendedAttributes->{"NoImplementation"};
</del><ins>+ return if $_->extendedAttributes->{"NoImplementation"};
</ins><span class="cx">
</span><del>- my $attributeName = $_->signature->name;
</del><ins>+ my $attributeName = $_->name;
</ins><span class="cx"> my $getterName = $self->_getterName($_);
</span><span class="cx"> my $setterName = $_->isReadOnly ? "0" : $self->_setterName($_);
</span><span class="cx"> my @attributes = qw(kJSPropertyAttributeDontDelete);
</span><span class="cx"> push(@attributes, "kJSPropertyAttributeReadOnly") if $_->isReadOnly;
</span><del>- push(@attributes, "kJSPropertyAttributeDontEnum") if $_->signature->extendedAttributes->{"DontEnum"};
</del><ins>+ push(@attributes, "kJSPropertyAttributeDontEnum") if $_->extendedAttributes->{"DontEnum"};
</ins><span class="cx">
</span><span class="cx"> return "{ \"$attributeName\", $getterName, $setterName, " . join(" | ", @attributes) . " }";
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleBindingsCodeGeneratorTestRunnerpm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/CodeGeneratorTestRunner.pm (208133 => 208134)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/CodeGeneratorTestRunner.pm        2016-10-30 22:33:02 UTC (rev 208133)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/CodeGeneratorTestRunner.pm        2016-10-30 22:35:00 UTC (rev 208134)
</span><span class="lines">@@ -71,8 +71,6 @@
</span><span class="cx"> {
</span><span class="cx"> my ($type) = @_;
</span><span class="cx">
</span><del>- assert("Not a type") if ref($type) ne "domType";
-
</del><span class="cx"> return "JS" . _implementationClassName($type);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -191,7 +189,7 @@
</span><span class="cx"> if (my @functions = @{$interface->functions}) {
</span><span class="cx"> push(@contents, "\n // Functions\n\n");
</span><span class="cx"> foreach my $function (@functions) {
</span><del>- push(@contents, " static JSValueRef @{[$function->signature->name]}(JSContextRef, JSObjectRef, JSObjectRef, size_t, const JSValueRef[], JSValueRef*);\n");
</del><ins>+ push(@contents, " static JSValueRef @{[$function->name]}(JSContextRef, JSObjectRef, JSObjectRef, size_t, const JSValueRef[], JSValueRef*);\n");
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -285,7 +283,7 @@
</span><span class="cx"> foreach my $function (@functions) {
</span><span class="cx"> push(@contents, <<EOF);
</span><span class="cx">
</span><del>-JSValueRef ${className}::@{[$function->signature->name]}(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
</del><ins>+JSValueRef ${className}::@{[$function->name]}(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
</ins><span class="cx"> {
</span><span class="cx"> ${implementationClassName}* impl = to${implementationClassName}(context, thisObject);
</span><span class="cx"> if (!impl)
</span><span class="lines">@@ -293,33 +291,33 @@
</span><span class="cx">
</span><span class="cx"> EOF
</span><span class="cx"> my $functionCall;
</span><del>- if ($function->signature->extendedAttributes->{"CustomArgumentHandling"}) {
- $functionCall = "impl->" . $function->signature->name . "(context, argumentCount, arguments, exception)";
</del><ins>+ if ($function->extendedAttributes->{"CustomArgumentHandling"}) {
+ $functionCall = "impl->" . $function->name . "(context, argumentCount, arguments, exception)";
</ins><span class="cx"> } else {
</span><del>- my @parameters = ();
- my @specifiedParameters = @{$function->parameters};
</del><ins>+ my @arguments = ();
+ my @specifiedArguments = @{$function->arguments};
</ins><span class="cx">
</span><del>- $self->_includeHeaders(\%contentsIncludes, $function->signature->type, $function->signature);
</del><ins>+ $self->_includeHeaders(\%contentsIncludes, $function->type);
</ins><span class="cx">
</span><del>- if ($function->signature->extendedAttributes->{"PassContext"}) {
- push(@parameters, "context");
</del><ins>+ if ($function->extendedAttributes->{"PassContext"}) {
+ push(@arguments, "context");
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- foreach my $i (0..$#specifiedParameters) {
- my $parameter = $specifiedParameters[$i];
</del><ins>+ foreach my $i (0..$#specifiedArguments) {
+ my $argument = $specifiedArguments[$i];
</ins><span class="cx">
</span><del>- $self->_includeHeaders(\%contentsIncludes, $type, $parameter);
</del><ins>+ $self->_includeHeaders(\%contentsIncludes, $type);
</ins><span class="cx">
</span><del>- push(@contents, " " . $self->_platformTypeVariableDeclaration($parameter, $parameter->name, "arguments[$i]", "argumentCount > $i") . "\n");
</del><ins>+ push(@contents, " " . $self->_platformTypeVariableDeclaration($argument->type, $argument->name, "arguments[$i]", "argumentCount > $i") . "\n");
</ins><span class="cx">
</span><del>- push(@parameters, $self->_parameterExpression($parameter));
</del><ins>+ push(@arguments, $self->_argumentExpression($argument));
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- $functionCall = "impl->" . $function->signature->name . "(" . join(", ", @parameters) . ")";
</del><ins>+ $functionCall = "impl->" . $function->name . "(" . join(", ", @arguments) . ")";
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- push(@contents, " ${functionCall};\n\n") if $function->signature->type->name eq "void";
- push(@contents, " return " . $self->_returnExpression($function->signature, $functionCall) . ";\n}\n");
</del><ins>+ push(@contents, " ${functionCall};\n\n") if $function->type->name eq "void";
+ push(@contents, " return " . $self->_returnExpression($function->type, $functionCall) . ";\n}\n");
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -326,7 +324,7 @@
</span><span class="cx"> if (my @attributes = @{$interface->attributes}) {
</span><span class="cx"> push(@contents, "\n// Attributes\n");
</span><span class="cx"> foreach my $attribute (@attributes) {
</span><del>- $self->_includeHeaders(\%contentsIncludes, $attribute->signature->type, $attribute->signature);
</del><ins>+ $self->_includeHeaders(\%contentsIncludes, $attribute->type);
</ins><span class="cx">
</span><span class="cx"> my $getterName = $self->_getterName($attribute);
</span><span class="cx"> my $getterExpression = "impl->${getterName}()";
</span><span class="lines">@@ -339,7 +337,7 @@
</span><span class="cx"> if (!impl)
</span><span class="cx"> return JSValueMakeUndefined(context);
</span><span class="cx">
</span><del>- return @{[$self->_returnExpression($attribute->signature, $getterExpression)]};
</del><ins>+ return @{[$self->_returnExpression($attribute->type, $getterExpression)]};
</ins><span class="cx"> }
</span><span class="cx"> EOF
</span><span class="cx">
</span><span class="lines">@@ -354,7 +352,7 @@
</span><span class="cx">
</span><span class="cx"> EOF
</span><span class="cx">
</span><del>- my $platformValue = $self->_platformTypeConstructor($attribute->signature, "value");
</del><ins>+ my $platformValue = $self->_platformTypeConstructor($attribute->type, "value");
</ins><span class="cx">
</span><span class="cx"> push(@contents, <<EOF);
</span><span class="cx"> impl->@{[$self->_setterName($attribute)]}(${platformValue});
</span><span class="lines">@@ -383,12 +381,12 @@
</span><span class="cx"> {
</span><span class="cx"> my ($self, $attribute) = @_;
</span><span class="cx">
</span><del>- return $attribute->signature->name;
</del><ins>+ return $attribute->name;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> sub _includeHeaders
</span><span class="cx"> {
</span><del>- my ($self, $headers, $type, $signature) = @_;
</del><ins>+ my ($self, $headers, $type) = @_;
</ins><span class="cx">
</span><span class="cx"> return unless defined $type;
</span><span class="cx"> return if $type->name eq "boolean";
</span><span class="lines">@@ -431,7 +429,7 @@
</span><span class="cx">
</span><span class="cx"> sub _platformType
</span><span class="cx"> {
</span><del>- my ($self, $type, $signature) = @_;
</del><ins>+ my ($self, $type) = @_;
</ins><span class="cx">
</span><span class="cx"> return undef unless defined $type;
</span><span class="cx">
</span><span class="lines">@@ -444,10 +442,8 @@
</span><span class="cx">
</span><span class="cx"> sub _platformTypeConstructor
</span><span class="cx"> {
</span><del>- my ($self, $signature, $argumentName) = @_;
</del><ins>+ my ($self, $type, $argumentName) = @_;
</ins><span class="cx">
</span><del>- my $type = $signature->type;
-
</del><span class="cx"> return "JSValueToBoolean(context, $argumentName)" if $type->name eq "boolean";
</span><span class="cx"> return "$argumentName" if $type->name eq "object";
</span><span class="cx"> return "JSRetainPtr<JSStringRef>(Adopt, JSValueToStringCopy(context, $argumentName, 0))" if $$self{codeGenerator}->IsStringType($type);
</span><span class="lines">@@ -457,10 +453,10 @@
</span><span class="cx">
</span><span class="cx"> sub _platformTypeVariableDeclaration
</span><span class="cx"> {
</span><del>- my ($self, $signature, $variableName, $argumentName, $condition) = @_;
</del><ins>+ my ($self, $type, $variableName, $argumentName, $condition) = @_;
</ins><span class="cx">
</span><del>- my $platformType = $self->_platformType($signature->type, $signature);
- my $constructor = $self->_platformTypeConstructor($signature, $argumentName);
</del><ins>+ my $platformType = $self->_platformType($type);
+ my $constructor = $self->_platformTypeConstructor($type, $argumentName);
</ins><span class="cx">
</span><span class="cx"> my %nonPointerTypes = (
</span><span class="cx"> "bool" => 1,
</span><span class="lines">@@ -485,10 +481,8 @@
</span><span class="cx">
</span><span class="cx"> sub _returnExpression
</span><span class="cx"> {
</span><del>- my ($self, $signature, $expression) = @_;
</del><ins>+ my ($self, $returnType, $expression) = @_;
</ins><span class="cx">
</span><del>- my $returnType = $signature->type;
-
</del><span class="cx"> return "JSValueMakeUndefined(context)" if $returnType->name eq "void";
</span><span class="cx"> return "JSValueMakeBoolean(context, ${expression})" if $returnType->name eq "boolean";
</span><span class="cx"> return "${expression}" if $returnType->name eq "object";
</span><span class="lines">@@ -497,12 +491,12 @@
</span><span class="cx"> return "toJS(context, WTF::getPtr(${expression}))";
</span><span class="cx"> }
</span><span class="cx">
</span><del>-sub _parameterExpression
</del><ins>+sub _argumentExpression
</ins><span class="cx"> {
</span><del>- my ($self, $parameter) = @_;
</del><ins>+ my ($self, $argument) = @_;
</ins><span class="cx">
</span><del>- my $type = $parameter->type;
- my $name = $parameter->name;
</del><ins>+ my $type = $argument->type;
+ my $name = $argument->name;
</ins><span class="cx">
</span><span class="cx"> return "${name}.get()" if $$self{codeGenerator}->IsStringType($type);
</span><span class="cx"> return $name;
</span><span class="lines">@@ -512,7 +506,7 @@
</span><span class="cx"> {
</span><span class="cx"> my ($self, $attribute) = @_;
</span><span class="cx">
</span><del>- my $name = $attribute->signature->name;
</del><ins>+ my $name = $attribute->name;
</ins><span class="cx">
</span><span class="cx"> return "set" . $$self{codeGenerator}->WK_ucfirst($name);
</span><span class="cx"> }
</span><span class="lines">@@ -522,9 +516,9 @@
</span><span class="cx"> my ($self, $interface) = @_;
</span><span class="cx">
</span><span class="cx"> my $mapFunction = sub {
</span><del>- my $name = $_->signature->name;
</del><ins>+ my $name = $_->name;
</ins><span class="cx"> my @attributes = qw(kJSPropertyAttributeDontDelete kJSPropertyAttributeReadOnly);
</span><del>- push(@attributes, "kJSPropertyAttributeDontEnum") if $_->signature->extendedAttributes->{"DontEnum"};
</del><ins>+ push(@attributes, "kJSPropertyAttributeDontEnum") if $_->extendedAttributes->{"DontEnum"};
</ins><span class="cx">
</span><span class="cx"> return "{ \"$name\", $name, " . join(" | ", @attributes) . " }";
</span><span class="cx"> };
</span><span class="lines">@@ -562,14 +556,14 @@
</span><span class="cx"> my ($self, $interface) = @_;
</span><span class="cx">
</span><span class="cx"> my $mapFunction = sub {
</span><del>- return if $_->signature->extendedAttributes->{"NoImplementation"};
</del><ins>+ return if $_->extendedAttributes->{"NoImplementation"};
</ins><span class="cx">
</span><del>- my $attributeName = $_->signature->name;
</del><ins>+ my $attributeName = $_->name;
</ins><span class="cx"> my $getterName = $self->_getterName($_);
</span><span class="cx"> my $setterName = $_->isReadOnly ? "0" : $self->_setterName($_);
</span><span class="cx"> my @attributes = qw(kJSPropertyAttributeDontDelete);
</span><span class="cx"> push(@attributes, "kJSPropertyAttributeReadOnly") if $_->isReadOnly;
</span><del>- push(@attributes, "kJSPropertyAttributeDontEnum") if $_->signature->extendedAttributes->{"DontEnum"};
</del><ins>+ push(@attributes, "kJSPropertyAttributeDontEnum") if $_->extendedAttributes->{"DontEnum"};
</ins><span class="cx">
</span><span class="cx"> return "{ \"$attributeName\", $getterName, $setterName, " . join(" | ", @attributes) . " }";
</span><span class="cx"> };
</span></span></pre>
</div>
</div>
</body>
</html>