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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 # Includes | 286 # Includes |
287 ################################################################################ | 287 ################################################################################ |
288 | 288 |
289 def includes_for_cpp_class(class_name, relative_dir_posix): | 289 def includes_for_cpp_class(class_name, relative_dir_posix): |
290 return set([posixpath.join('bindings', relative_dir_posix, class_name + '.h'
)]) | 290 return set([posixpath.join('bindings', relative_dir_posix, class_name + '.h'
)]) |
291 | 291 |
292 | 292 |
293 INCLUDES_FOR_TYPE = { | 293 INCLUDES_FOR_TYPE = { |
294 'object': set(), | 294 'object': set(), |
295 'CompareHow': set(), | 295 'CompareHow': set(), |
296 'Dictionary': set(['bindings/v8/Dictionary.h']), | 296 'Dictionary': set(['bindings/core/v8/Dictionary.h']), |
297 'EventHandler': set(['bindings/v8/V8AbstractEventListener.h', | 297 'EventHandler': set(['bindings/core/v8/V8AbstractEventListener.h', |
298 'bindings/v8/V8EventListenerList.h']), | 298 'bindings/core/v8/V8EventListenerList.h']), |
299 'EventListener': set(['bindings/v8/BindingSecurity.h', | 299 'EventListener': set(['bindings/core/v8/BindingSecurity.h', |
300 'bindings/v8/V8EventListenerList.h', | 300 'bindings/core/v8/V8EventListenerList.h', |
301 'core/frame/LocalDOMWindow.h']), | 301 'core/frame/LocalDOMWindow.h']), |
302 'HTMLCollection': set(['bindings/core/v8/V8HTMLCollection.h', | 302 'HTMLCollection': set(['bindings/core/v8/V8HTMLCollection.h', |
303 'core/dom/ClassCollection.h', | 303 'core/dom/ClassCollection.h', |
304 'core/dom/TagCollection.h', | 304 'core/dom/TagCollection.h', |
305 'core/html/HTMLCollection.h', | 305 'core/html/HTMLCollection.h', |
306 'core/html/HTMLFormControlsCollection.h', | 306 'core/html/HTMLFormControlsCollection.h', |
307 'core/html/HTMLTableRowsCollection.h']), | 307 'core/html/HTMLTableRowsCollection.h']), |
308 'MediaQueryListListener': set(['core/css/MediaQueryListListener.h']), | 308 'MediaQueryListListener': set(['core/css/MediaQueryListListener.h']), |
309 'NodeList': set(['bindings/core/v8/V8NodeList.h', | 309 'NodeList': set(['bindings/core/v8/V8NodeList.h', |
310 'core/dom/NameNodeList.h', | 310 'core/dom/NameNodeList.h', |
311 'core/dom/NodeList.h', | 311 'core/dom/NodeList.h', |
312 'core/dom/StaticNodeList.h', | 312 'core/dom/StaticNodeList.h', |
313 'core/html/LabelsNodeList.h']), | 313 'core/html/LabelsNodeList.h']), |
314 'Promise': set(['bindings/v8/ScriptPromise.h']), | 314 'Promise': set(['bindings/core/v8/ScriptPromise.h']), |
315 'SerializedScriptValue': set(['bindings/v8/SerializedScriptValue.h']), | 315 'SerializedScriptValue': set(['bindings/core/v8/SerializedScriptValue.h']), |
316 'ScriptValue': set(['bindings/v8/ScriptValue.h']), | 316 'ScriptValue': set(['bindings/core/v8/ScriptValue.h']), |
317 } | 317 } |
318 | 318 |
319 | 319 |
320 def includes_for_type(idl_type): | 320 def includes_for_type(idl_type): |
321 idl_type = idl_type.preprocessed_type | 321 idl_type = idl_type.preprocessed_type |
322 | 322 |
323 # Composite types | 323 # Composite types |
324 array_or_sequence_type = idl_type.array_or_sequence_type | 324 array_or_sequence_type = idl_type.array_or_sequence_type |
325 if array_or_sequence_type: | 325 if array_or_sequence_type: |
326 return includes_for_type(array_or_sequence_type) | 326 return includes_for_type(array_or_sequence_type) |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
700 | 700 |
701 def literal_cpp_value(idl_type, idl_literal): | 701 def literal_cpp_value(idl_type, idl_literal): |
702 """Converts an expression that is a valid C++ literal for this type.""" | 702 """Converts an expression that is a valid C++ literal for this type.""" |
703 # FIXME: add validation that idl_type and idl_literal are compatible | 703 # FIXME: add validation that idl_type and idl_literal are compatible |
704 literal_value = str(idl_literal) | 704 literal_value = str(idl_literal) |
705 if idl_type.base_type in CPP_UNSIGNED_TYPES: | 705 if idl_type.base_type in CPP_UNSIGNED_TYPES: |
706 return literal_value + 'u' | 706 return literal_value + 'u' |
707 return literal_value | 707 return literal_value |
708 | 708 |
709 IdlType.literal_cpp_value = literal_cpp_value | 709 IdlType.literal_cpp_value = literal_cpp_value |
OLD | NEW |