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

Side by Side Diff: Source/bindings/scripts/generate-bindings.pl

Issue 17376006: Implement WebIDL implements (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add back [PerWorldBindings] Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/bindings/scripts/preprocess_idls.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/perl -w 1 #!/usr/bin/perl -w
2 # 2 #
3 # Copyright (C) 2005 Apple Computer, Inc. 3 # Copyright (C) 2005 Apple Computer, Inc.
4 # Copyright (C) 2006 Anders Carlsson <andersca@mac.com> 4 # Copyright (C) 2006 Anders Carlsson <andersca@mac.com>
5 # 5 #
6 # This file is part of WebKit 6 # This file is part of WebKit
7 # 7 #
8 # This library is free software; you can redistribute it and/or 8 # This library is free software; you can redistribute it and/or
9 # modify it under the terms of the GNU Library General Public 9 # modify it under the terms of the GNU Library General Public
10 # License as published by the Free Software Foundation; either 10 # License as published by the Free Software Foundation; either
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 } 127 }
128 128
129 foreach my $idlFile (@supplementedIdlFiles) { 129 foreach my $idlFile (@supplementedIdlFiles) {
130 next if $idlFile eq $targetIdlFile; 130 next if $idlFile eq $targetIdlFile;
131 131
132 my $interfaceName = fileparse(basename($idlFile), ".idl"); 132 my $interfaceName = fileparse(basename($idlFile), ".idl");
133 my $parser = IDLParser->new(!$verbose); 133 my $parser = IDLParser->new(!$verbose);
134 my $document = $parser->Parse($idlFile, $defines, $preprocessor); 134 my $document = $parser->Parse($idlFile, $defines, $preprocessor);
135 135
136 foreach my $interface (@{$document->interfaces}) { 136 foreach my $interface (@{$document->interfaces}) {
137 if ($interface->isPartial and $interface->name eq $targetInterfaceName) { 137 if (!$interface->isPartial || $interface->name eq $targetInterfaceName) {
138 my $targetDataNode; 138 my $targetDataNode;
139 foreach my $interface (@{$targetDocument->interfaces}) { 139 foreach my $interface (@{$targetDocument->interfaces}) {
140 if ($interface->name eq $targetInterfaceName) { 140 if ($interface->name eq $targetInterfaceName) {
141 $targetDataNode = $interface; 141 $targetDataNode = $interface;
142 last; 142 last;
143 } 143 }
144 } 144 }
145 die "Not found an interface ${targetInterfaceName} in ${targetInterf aceName}.idl." unless defined $targetDataNode; 145 die "Not found an interface ${targetInterfaceName} in ${targetInterf aceName}.idl." unless defined $targetDataNode;
146 146
147 # Support for attributes of partial interfaces. 147 # Support for attributes of partial interfaces.
148 foreach my $attribute (@{$interface->attributes}) { 148 foreach my $attribute (@{$interface->attributes}) {
149 # Record that this attribute is implemented by $interfaceName. 149 # Record that this attribute is implemented by $interfaceName.
150 $attribute->extendedAttributes->{"ImplementedBy"} = $interfaceNa me; 150 $attribute->extendedAttributes->{"ImplementedBy"} = $interfaceNa me if $interface->isPartial;
151 151
152 # Add interface-wide extended attributes to each attribute. 152 # Add interface-wide extended attributes to each attribute.
153 applyInterfaceExtendedAttributes($interface, $attribute->extende dAttributes); 153 applyInterfaceExtendedAttributes($interface, $attribute->extende dAttributes);
154 154
155 push(@{$targetDataNode->attributes}, $attribute); 155 push(@{$targetDataNode->attributes}, $attribute);
156 } 156 }
157 157
158 # Support for methods of partial interfaces. 158 # Support for methods of partial interfaces.
159 foreach my $function (@{$interface->functions}) { 159 foreach my $function (@{$interface->functions}) {
160 # Record that this method is implemented by $interfaceName. 160 # Record that this method is implemented by $interfaceName.
161 $function->extendedAttributes->{"ImplementedBy"} = $interfaceNam e; 161 $function->extendedAttributes->{"ImplementedBy"} = $interfaceNam e if $interface->isPartial;
162 162
163 # Add interface-wide extended attributes to each method. 163 # Add interface-wide extended attributes to each method.
164 applyInterfaceExtendedAttributes($interface, $function->extended Attributes); 164 applyInterfaceExtendedAttributes($interface, $function->extended Attributes);
165 165
166 push(@{$targetDataNode->functions}, $function); 166 push(@{$targetDataNode->functions}, $function);
167 } 167 }
168 168
169 # Support for constants of partial interfaces. 169 # Support for constants of partial interfaces.
170 foreach my $constant (@{$interface->constants}) { 170 foreach my $constant (@{$interface->constants}) {
171 # Record that this constant is implemented by $interfaceName. 171 # Record that this constant is implemented by $interfaceName.
172 $constant->extendedAttributes->{"ImplementedBy"} = $interfaceNam e; 172 $constant->extendedAttributes->{"ImplementedBy"} = $interfaceNam e if $interface->isPartial;
173 173
174 # Add interface-wide extended attributes to each constant. 174 # Add interface-wide extended attributes to each constant.
175 applyInterfaceExtendedAttributes($interface, $constant->extended Attributes); 175 applyInterfaceExtendedAttributes($interface, $constant->extended Attributes);
176 176
177 push(@{$targetDataNode->constants}, $constant); 177 push(@{$targetDataNode->constants}, $constant);
178 } 178 }
179 } else { 179 } else {
180 die "$idlFile is not a supplemental dependency of $targetIdlFile. Th ere maybe a bug in the the supplemental dependency generator (preprocess_idls.py ).\n"; 180 die "$idlFile is not a supplemental dependency of $targetIdlFile. Th ere maybe a bug in the the supplemental dependency generator (preprocess_idls.py ).\n";
181 } 181 }
182 } 182 }
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 last OUTER; 304 last OUTER;
305 } 305 }
306 } 306 }
307 } 307 }
308 if ($error) { 308 if ($error) {
309 die "IDL ATTRIBUTE CHECKER ERROR: $error 309 die "IDL ATTRIBUTE CHECKER ERROR: $error
310 If you want to add a new IDL attribute, you need to add it to bindings/scripts/I DLAttributes.txt and add explanations to the Blink IDL document (http://chromium .org/blink/webidl). 310 If you want to add a new IDL attribute, you need to add it to bindings/scripts/I DLAttributes.txt and add explanations to the Blink IDL document (http://chromium .org/blink/webidl).
311 "; 311 ";
312 } 312 }
313 } 313 }
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/scripts/preprocess_idls.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698