Changeset 207278 in webkit


Ignore:
Timestamp:
Oct 12, 2016 10:21:14 PM (7 years ago)
Author:
Chris Dumez
Message:

The bindings generator should provide a better error message when it does not find a dictionary definition
https://bugs.webkit.org/show_bug.cgi?id=163377

Reviewed by Ryosuke Niwa.

The bindings generator should provide a better error message when it does
not find a dictionary definition.

  • bindings/scripts/CodeGenerator.pm:

(GetDictionaryByName):

  • bindings/scripts/CodeGeneratorJS.pm:

(assert):
(GenerateDictionaryImplementationContent):
(GenerateHeader):
(GenerateDictionaryHeader):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r207277 r207278  
     12016-10-12  Chris Dumez  <cdumez@apple.com>
     2
     3        The bindings generator should provide a better error message when it does not find a dictionary definition
     4        https://bugs.webkit.org/show_bug.cgi?id=163377
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        The bindings generator should provide a better error message when it does
     9        not find a dictionary definition.
     10
     11        * bindings/scripts/CodeGenerator.pm:
     12        (GetDictionaryByName):
     13        * bindings/scripts/CodeGeneratorJS.pm:
     14        (assert):
     15        (GenerateDictionaryImplementationContent):
     16        (GenerateHeader):
     17        (GenerateDictionaryHeader):
     18
    1192016-10-12  Chris Dumez  <cdumez@apple.com>
    220
  • trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm

    r207150 r207278  
    475475{
    476476    my ($object, $name) = @_;
    477     return unless defined($name);
     477    die "GetDictionaryByName() was called with an undefined dictionary name" unless defined($name);
    478478
    479479    for my $dictionary (@{$useDocument->dictionaries}) {
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r207277 r207278  
    3434use strict;
    3535use constant FileNamePrefix => "JS";
     36use Carp qw<longmess>;
     37use Data::Dumper;
    3638use Hasher;
    3739
     
    108110EOF
    109111
     112sub assert
     113{
     114    my $message = shift;
     115
     116    my $mess = longmess();
     117    print Dumper($mess);
     118
     119    die $message;
     120}
     121
    110122# Default constructor
    111123sub new
     
    10931105    my @dictionaries;
    10941106    push(@dictionaries, $dictionary);
    1095     my $parentDictionary = $codeGenerator->GetDictionaryByName($dictionary->parent);
    1096     while (defined($parentDictionary)) {
     1107    my $parentName = $dictionary->parent;
     1108    while (defined($parentName)) {
     1109        my $parentDictionary = $codeGenerator->GetDictionaryByName($parentName);
     1110        assert("Unable to find definition for dictionary named '" . $parentName . "'!") unless defined($parentDictionary);
    10971111        unshift(@dictionaries, $parentDictionary);
    1098         $parentDictionary = $codeGenerator->GetDictionaryByName($parentDictionary->parent);
     1112        $parentName = $parentDictionary->parent;
    10991113    }
    11001114
     
    17421756        }, 0);
    17431757        for my $dictionary (@$dictionaries) {
    1744             my $parentDictionary = $dictionary->parent;
    1745             while (defined($parentDictionary)) {
    1746                 push(@ancestors, $parentDictionary) if $codeGenerator->IsExternalDictionaryType($parentDictionary);
    1747                 $parentDictionary = $codeGenerator->GetDictionaryByName($parentDictionary)->parent;
     1758            my $parentName = $dictionary->parent;
     1759            while (defined($parentName)) {
     1760                push(@ancestors, $parentName) if $codeGenerator->IsExternalDictionaryType($parentName);
     1761                my $parentDictionary = $codeGenerator->GetDictionaryByName($parentName);
     1762                assert("Unable to find definition for dictionary named '" . $parentName . "'!") unless defined($parentDictionary);
     1763                $parentName = $parentDictionary->parent;
    17481764            }
    17491765        }
     
    43764392    if ($writeDependencies) {
    43774393        my @ancestors;
    4378         my $parentDictionary = $dictionary->parent;
    4379         while (defined($parentDictionary)) {
    4380             push(@ancestors, $parentDictionary) if $codeGenerator->IsExternalDictionaryType($parentDictionary);
    4381             $parentDictionary = $codeGenerator->GetDictionaryByName($parentDictionary)->parent;
     4394        my $parentName = $dictionary->parent;
     4395        while (defined($parentName)) {
     4396            push(@ancestors, $parentName) if $codeGenerator->IsExternalDictionaryType($parentName);
     4397            my $parentDictionary = $codeGenerator->GetDictionaryByName($parentName);
     4398            assert("Unable to find definition for dictionary named '" . $parentName . "'!") unless $parentDictionary;
     4399            $parentName = $parentDictionary->parent;
    43824400        }
    43834401        push(@depsContent, "$className.h : ", join(" ", map { "$_.idl" } @ancestors), "\n");
Note: See TracChangeset for help on using the changeset viewer.