OLD | NEW |
1 # Copyright (C) 2013 Google Inc. All rights reserved. | 1 # Copyright (C) 2013 Google Inc. All rights reserved. |
2 # | 2 # |
3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
5 # met: | 5 # met: |
6 # | 6 # |
7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 | 62 |
63 def read_idl_file(self, idl_filename): | 63 def read_idl_file(self, idl_filename): |
64 """Returns an IdlDefinitions object for an IDL file, without any depende
ncies. | 64 """Returns an IdlDefinitions object for an IDL file, without any depende
ncies. |
65 | 65 |
66 The IdlDefinitions object is guaranteed to contain a single | 66 The IdlDefinitions object is guaranteed to contain a single |
67 IdlInterface; it may also contain other definitions, such as | 67 IdlInterface; it may also contain other definitions, such as |
68 callback functions and enumerations.""" | 68 callback functions and enumerations.""" |
69 ast = blink_idl_parser.parse_file(self.parser, idl_filename) | 69 ast = blink_idl_parser.parse_file(self.parser, idl_filename) |
70 if not ast: | 70 if not ast: |
71 raise Exception('Failed to parse %s' % idl_filename) | 71 raise Exception('Failed to parse %s' % idl_filename) |
72 definitions = IdlDefinitions(ast) | 72 idl_name = os.path.basename(idl_filename) |
| 73 definitions = IdlDefinitions(idl_name, ast) |
73 | 74 |
74 # Validate file contents with filename convention | 75 # Validate file contents with filename convention |
75 # The Blink IDL filenaming convention is that the file | 76 # The Blink IDL filenaming convention is that the file |
76 # <definition_name>.idl MUST contain exactly 1 definition | 77 # <definition_name>.idl MUST contain exactly 1 definition |
77 # (interface, dictionary or exception), and the definition name must | 78 # (interface, dictionary or exception), and the definition name must |
78 # agree with the file's basename, unless it is a partial definition. | 79 # agree with the file's basename, unless it is a partial definition. |
79 # (e.g., 'partial interface Foo' can be in FooBar.idl). | 80 # (e.g., 'partial interface Foo' can be in FooBar.idl). |
80 targets = (definitions.interfaces.values() + | 81 targets = (definitions.interfaces.values() + |
81 definitions.dictionaries.values()) | 82 definitions.dictionaries.values()) |
82 number_of_targets = len(targets) | 83 number_of_targets = len(targets) |
(...skipping 19 matching lines...) Expand all Loading... |
102 IDL ATTRIBUTE ERROR in file: | 103 IDL ATTRIBUTE ERROR in file: |
103 %s: | 104 %s: |
104 %s | 105 %s |
105 If you want to add a new IDL extended attribute, please add it to: | 106 If you want to add a new IDL extended attribute, please add it to: |
106 %s | 107 %s |
107 and add an explanation to the Blink IDL documentation at: | 108 and add an explanation to the Blink IDL documentation at: |
108 http://www.chromium.org/blink/webidl/blink-idl-extended-attributes | 109 http://www.chromium.org/blink/webidl/blink-idl-extended-attributes |
109 """ % (idl_filename, str(error), EXTENDED_ATTRIBUTES_RELATIVE_PATH)) | 110 """ % (idl_filename, str(error), EXTENDED_ATTRIBUTES_RELATIVE_PATH)) |
110 | 111 |
111 return definitions | 112 return definitions |
OLD | NEW |