Chromium Code Reviews| Index: Source/bindings/scripts/generate-bindings.pl |
| diff --git a/Source/bindings/scripts/generate-bindings.pl b/Source/bindings/scripts/generate-bindings.pl |
| index b3f3d43298ac01f3e561873f5119d564763adf41..583ad4456a28725fdd54f783454213224b36b272 100755 |
| --- a/Source/bindings/scripts/generate-bindings.pl |
| +++ b/Source/bindings/scripts/generate-bindings.pl |
| @@ -1,4 +1,4 @@ |
| -#!/usr/bin/perl -w |
| +#!/usr/bin/perl -w -I../../core/scripts |
|
haraken
2013/06/03 07:09:17
Nit: I don't think this is needed. If we need to a
|
| # |
| # Copyright (C) 2005 Apple Computer, Inc. |
| # Copyright (C) 2006 Anders Carlsson <andersca@mac.com> |
| @@ -38,6 +38,7 @@ use Cwd; |
| use IDLParser; |
| use CodeGeneratorV8; |
| +use SemanticAnalyzer; |
| my @idlDirectories; |
| my $outputDirectory; |
| @@ -121,8 +122,8 @@ my $targetParser = IDLParser->new(!$verbose); |
| my $targetDocument = $targetParser->Parse($targetIdlFile, $defines, $preprocessor); |
| if ($idlAttributesFile) { |
| - my $idlAttributes = loadIDLAttributes($idlAttributesFile); |
| - checkIDLAttributes($idlAttributes, $targetDocument, basename($targetIdlFile)); |
| + my $semanticAnalyzer = SemanticAnalyzer->new($idlAttributesFile); |
| + $semanticAnalyzer->checkIDLAttributes($targetDocument, basename($targetIdlFile)); |
| } |
| foreach my $idlFile (@supplementedIdlFiles) { |
| @@ -215,86 +216,3 @@ sub generateEmptyHeaderAndCpp |
| print FH $contents; |
| close FH; |
| } |
| - |
| -sub loadIDLAttributes |
| -{ |
| - my $idlAttributesFile = shift; |
| - |
| - my %idlAttributes; |
| - open FH, "<", $idlAttributesFile or die "Couldn't open $idlAttributesFile: $!"; |
| - while (my $line = <FH>) { |
| - chomp $line; |
| - next if $line =~ /^\s*#/; |
| - next if $line =~ /^\s*$/; |
| - |
| - if ($line =~ /^\s*([^=\s]*)\s*=?\s*(.*)/) { |
| - my $name = $1; |
| - $idlAttributes{$name} = {}; |
| - if ($2) { |
| - foreach my $rightValue (split /\|/, $2) { |
| - $rightValue =~ s/^\s*|\s*$//g; |
| - $rightValue = "VALUE_IS_MISSING" unless $rightValue; |
| - $idlAttributes{$name}{$rightValue} = 1; |
| - } |
| - } else { |
| - $idlAttributes{$name}{"VALUE_IS_MISSING"} = 1; |
| - } |
| - } else { |
| - die "The format of " . basename($idlAttributesFile) . " is wrong: line $.\n"; |
| - } |
| - } |
| - close FH; |
| - |
| - return \%idlAttributes; |
| -} |
| - |
| -sub checkIDLAttributes |
| -{ |
| - my $idlAttributes = shift; |
| - my $document = shift; |
| - my $idlFile = shift; |
| - |
| - foreach my $interface (@{$document->interfaces}) { |
| - checkIfIDLAttributesExists($idlAttributes, $interface->extendedAttributes, $idlFile); |
| - |
| - foreach my $attribute (@{$interface->attributes}) { |
| - checkIfIDLAttributesExists($idlAttributes, $attribute->signature->extendedAttributes, $idlFile); |
| - } |
| - |
| - foreach my $function (@{$interface->functions}) { |
| - checkIfIDLAttributesExists($idlAttributes, $function->signature->extendedAttributes, $idlFile); |
| - foreach my $parameter (@{$function->parameters}) { |
| - checkIfIDLAttributesExists($idlAttributes, $parameter->extendedAttributes, $idlFile); |
| - } |
| - } |
| - } |
| -} |
| - |
| -sub checkIfIDLAttributesExists |
| -{ |
| - my $idlAttributes = shift; |
| - my $extendedAttributes = shift; |
| - my $idlFile = shift; |
| - |
| - my $error; |
| - OUTER: for my $name (keys %$extendedAttributes) { |
| - if (!exists $idlAttributes->{$name}) { |
| - $error = "Unknown IDL attribute [$name] is found at $idlFile."; |
| - last OUTER; |
| - } |
| - if ($idlAttributes->{$name}{"*"}) { |
| - next; |
| - } |
| - for my $rightValue (split /\s*\|\s*/, $extendedAttributes->{$name}) { |
| - if (!exists $idlAttributes->{$name}{$rightValue}) { |
| - $error = "Unknown IDL attribute [$name=" . $extendedAttributes->{$name} . "] is found at $idlFile."; |
| - last OUTER; |
| - } |
| - } |
| - } |
| - if ($error) { |
| - die "IDL ATTRIBUTE CHECKER ERROR: $error |
| -If you want to add a new IDL attribute, you need to add it to bindings/scripts/IDLAttributes.txt and add explanations to the Blink IDL document (http://chromium.org/blink/webidl). |
| -"; |
| - } |
| -} |