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

Side by Side Diff: Source/bindings/scripts/IDLParser.pm

Issue 16924018: [Binding] Remove signature from domAttribute (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: rebased Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # 1 #
2 # KDOM IDL parser 2 # KDOM IDL parser
3 # 3 #
4 # Copyright (C) 2005 Nikolas Zimmermann <wildfox@kde.org> 4 # Copyright (C) 2005 Nikolas Zimmermann <wildfox@kde.org>
5 # 5 #
6 # This library is free software; you can redistribute it and/or 6 # This library is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU Library General Public 7 # modify it under the terms of the GNU Library General Public
8 # License as published by the Free Software Foundation; either 8 # License as published by the Free Software Foundation; either
9 # version 2 of the License, or (at your option) any later version. 9 # version 2 of the License, or (at your option) any later version.
10 # 10 #
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 type => '$', 69 type => '$',
70 extendedAttributes => '$', # Extended attributes 70 extendedAttributes => '$', # Extended attributes
71 specials => '@', # Specials 71 specials => '@', # Specials
72 parameters => '@', # List of 'domSignature' 72 parameters => '@', # List of 'domSignature'
73 overloadedIndex => '$', 73 overloadedIndex => '$',
74 }); 74 });
75 75
76 # Used to represent domInterface contents (name of attribute, signature) 76 # Used to represent domInterface contents (name of attribute, signature)
77 struct( domAttribute => { 77 struct( domAttribute => {
78 type => '$', # Attribute type (including namespace) (string or UnionType) 78 type => '$', # Attribute type (including namespace) (string or UnionType)
79 name => '$',
80 isNullable => '$', # Is variable type Nullable (T?)
79 isStatic => '$', 81 isStatic => '$',
80 isReadOnly => '$', 82 isReadOnly => '$',
81 signature => '$', # Attribute signature
82 getterExceptions => '@', # Possibly raised exceptions. 83 getterExceptions => '@', # Possibly raised exceptions.
83 setterExceptions => '@', # Possibly raised exceptions. 84 setterExceptions => '@', # Possibly raised exceptions.
85 extendedAttributes => '$', # Extended attributes
84 }); 86 });
85 87
86 # Used to represent a map of 'variable name' <-> 'variable type' 88 # Used to represent a map of 'variable name' <-> 'variable type'
87 struct( domSignature => { 89 struct( domSignature => {
88 name => '$', # Variable name 90 name => '$', # Variable name
89 type => '$', # Variable type (string or UnionType) 91 type => '$', # Variable type (string or UnionType)
90 extendedAttributes => '$', # Extended attributes 92 extendedAttributes => '$', # Extended attributes
91 isOptional => '$', # Is variable optional (optional T) 93 isOptional => '$', # Is variable optional (optional T)
92 isNullable => '$', # Is variable type Nullable (T?) 94 isNullable => '$', # Is variable type Nullable (T?)
93 isVariadic => '$' # Is variable variadic (long... numbers) 95 isVariadic => '$' # Is variable variadic (long... numbers)
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 foreach my $definition (@$definitions) { 388 foreach my $definition (@$definitions) {
387 if (ref($definition) eq "domInterface") { 389 if (ref($definition) eq "domInterface") {
388 foreach my $constant (@{$definition->constants}) { 390 foreach my $constant (@{$definition->constants}) {
389 if (exists $typedefs{$constant->type}) { 391 if (exists $typedefs{$constant->type}) {
390 my $typedef = $typedefs{$constant->type}; 392 my $typedef = $typedefs{$constant->type};
391 $self->assertNoExtendedAttributesInTypedef($constant->type, __LINE__); 393 $self->assertNoExtendedAttributesInTypedef($constant->type, __LINE__);
392 $constant->type($typedef->type); 394 $constant->type($typedef->type);
393 } 395 }
394 } 396 }
395 foreach my $attribute (@{$definition->attributes}) { 397 foreach my $attribute (@{$definition->attributes}) {
396 $self->applyTypedefsForSignature($attribute->signature); 398 $self->applyTypedefsForSignature($attribute);
397 } 399 }
398 foreach my $function (@{$definition->functions}, @{$definition->cons tructors}, @{$definition->customConstructors}) { 400 foreach my $function (@{$definition->functions}, @{$definition->cons tructors}, @{$definition->customConstructors}) {
399 $self->applyTypedefsForSignature($function); 401 $self->applyTypedefsForSignature($function);
400 foreach my $signature (@{$function->parameters}) { 402 foreach my $signature (@{$function->parameters}) {
401 $self->applyTypedefsForSignature($signature); 403 $self->applyTypedefsForSignature($signature);
402 } 404 }
403 } 405 }
404 } 406 }
405 } 407 }
406 } 408 }
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after
1146 1148
1147 sub parseAttributeRest 1149 sub parseAttributeRest
1148 { 1150 {
1149 my $self = shift; 1151 my $self = shift;
1150 my $extendedAttributeList = shift; 1152 my $extendedAttributeList = shift;
1151 1153
1152 my $next = $self->nextToken(); 1154 my $next = $self->nextToken();
1153 if ($next->value() =~ /$nextAttributeRest_1/) { 1155 if ($next->value() =~ /$nextAttributeRest_1/) {
1154 my $newDataNode = domAttribute->new(); 1156 my $newDataNode = domAttribute->new();
1155 if ($self->parseReadOnly()) { 1157 if ($self->parseReadOnly()) {
1156 $newDataNode->type("attribute");
1157 $newDataNode->isReadOnly(1); 1158 $newDataNode->isReadOnly(1);
1158 } else {
1159 $newDataNode->type("attribute");
1160 } 1159 }
1161 $self->assertTokenValue($self->getToken(), "attribute", __LINE__); 1160 $self->assertTokenValue($self->getToken(), "attribute", __LINE__);
1162 $newDataNode->signature(domSignature->new());
1163 my $type = $self->parseType(); 1161 my $type = $self->parseType();
1164 $newDataNode->signature->isNullable(typeHasNullableSuffix($type)); 1162 $newDataNode->isNullable(typeHasNullableSuffix($type));
1165 # Remove all "?" in the type declaration, e.g. "double?" -> "double". 1163 # Remove all "?" in the type declaration, e.g. "double?" -> "double".
1166 $newDataNode->signature->type(typeRemoveNullableSuffix($type)); 1164 $newDataNode->type(typeRemoveNullableSuffix($type));
1167 my $token = $self->getToken(); 1165 my $token = $self->getToken();
1168 $self->assertTokenType($token, IdentifierToken); 1166 $self->assertTokenType($token, IdentifierToken);
1169 $newDataNode->signature->name($token->value()); 1167 $newDataNode->name($token->value());
1170 $self->assertTokenValue($self->getToken(), ";", __LINE__); 1168 $self->assertTokenValue($self->getToken(), ";", __LINE__);
1171 # CustomConstructor may also be used on attributes. 1169 # CustomConstructor may also be used on attributes.
1172 if (defined $extendedAttributeList->{"CustomConstructors"}) { 1170 if (defined $extendedAttributeList->{"CustomConstructors"}) {
1173 delete $extendedAttributeList->{"CustomConstructors"}; 1171 delete $extendedAttributeList->{"CustomConstructors"};
1174 $extendedAttributeList->{"CustomConstructor"} = "VALUE_IS_MISSING"; 1172 $extendedAttributeList->{"CustomConstructor"} = "VALUE_IS_MISSING";
1175 } 1173 }
1176 $newDataNode->signature->extendedAttributes($extendedAttributeList); 1174 $newDataNode->extendedAttributes($extendedAttributeList);
1177 return $newDataNode; 1175 return $newDataNode;
1178 } 1176 }
1179 $self->assertUnexpectedToken($next->value(), __LINE__); 1177 $self->assertUnexpectedToken($next->value(), __LINE__);
1180 } 1178 }
1181 1179
1182 sub parseInherit 1180 sub parseInherit
1183 { 1181 {
1184 my $self = shift; 1182 my $self = shift;
1185 my $next = $self->nextToken(); 1183 my $next = $self->nextToken();
1186 if ($next->value() eq "inherit") { 1184 if ($next->value() eq "inherit") {
(...skipping 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after
2236 $customConstructor->overloadedIndex($index++); 2234 $customConstructor->overloadedIndex($index++);
2237 push(@{$interface->customConstructors}, $customConstructor); 2235 push(@{$interface->customConstructors}, $customConstructor);
2238 } 2236 }
2239 delete $extendedAttributeList->{"CustomConstructors"}; 2237 delete $extendedAttributeList->{"CustomConstructors"};
2240 $extendedAttributeList->{"CustomConstructor"} = "VALUE_IS_MISSING"; 2238 $extendedAttributeList->{"CustomConstructor"} = "VALUE_IS_MISSING";
2241 } 2239 }
2242 $interface->extendedAttributes($extendedAttributeList); 2240 $interface->extendedAttributes($extendedAttributeList);
2243 } 2241 }
2244 2242
2245 1; 2243 1;
OLDNEW
« no previous file with comments | « Source/bindings/scripts/CodeGeneratorV8.pm ('k') | Source/bindings/scripts/generate-bindings.pl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698