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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
67 'Float32Array', | 67 'Float32Array', |
68 'Float64Array', | 68 'Float64Array', |
69 'Int8Array', | 69 'Int8Array', |
70 'Int16Array', | 70 'Int16Array', |
71 'Int32Array', | 71 'Int32Array', |
72 'Uint8Array', | 72 'Uint8Array', |
73 'Uint8ClampedArray', | 73 'Uint8ClampedArray', |
74 'Uint16Array', | 74 'Uint16Array', |
75 'Uint32Array', | 75 'Uint32Array', |
76 ]) | 76 ]) |
77 ARRAY_BUFFER_VIEW_AND_TYPED_ARRAY_TYPES = TYPED_ARRAY_TYPES.union(frozenset([ | |
78 'ArrayBufferView' | |
79 ])) | |
77 ARRAY_BUFFER_AND_VIEW_TYPES = TYPED_ARRAY_TYPES.union(frozenset([ | 80 ARRAY_BUFFER_AND_VIEW_TYPES = TYPED_ARRAY_TYPES.union(frozenset([ |
78 'ArrayBuffer', | 81 'ArrayBuffer', |
79 'ArrayBufferView', | 82 'ArrayBufferView', |
80 'DataView', | 83 'DataView', |
81 'SharedArrayBuffer', | 84 'SharedArrayBuffer', |
82 ])) | 85 ])) |
83 | 86 |
84 | 87 |
85 IdlType.is_array_buffer_or_view = property( | 88 IdlType.is_array_buffer_or_view = property( |
86 lambda self: self.base_type in ARRAY_BUFFER_AND_VIEW_TYPES) | 89 lambda self: self.base_type in ARRAY_BUFFER_AND_VIEW_TYPES) |
87 | 90 |
91 IdlType.is_array_buffer_view_or_typed_array = property( | |
92 lambda self: self.base_type in ARRAY_BUFFER_VIEW_AND_TYPED_ARRAY_TYPES) | |
93 | |
88 IdlType.is_typed_array = property( | 94 IdlType.is_typed_array = property( |
89 lambda self: self.base_type in TYPED_ARRAY_TYPES) | 95 lambda self: self.base_type in TYPED_ARRAY_TYPES) |
90 | 96 |
91 IdlType.is_wrapper_type = property( | 97 IdlType.is_wrapper_type = property( |
92 lambda self: (self.is_interface_type and | 98 lambda self: (self.is_interface_type and |
93 not self.is_callback_interface and | 99 not self.is_callback_interface and |
94 self.base_type not in NON_WRAPPER_TYPES)) | 100 self.base_type not in NON_WRAPPER_TYPES)) |
95 | 101 |
96 | 102 |
97 ################################################################################ | 103 ################################################################################ |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
195 return ('PassRefPtr<%s>' if used_as_rvalue_type else 'RefPtr<%s>') % bas e_idl_type | 201 return ('PassRefPtr<%s>' if used_as_rvalue_type else 'RefPtr<%s>') % bas e_idl_type |
196 if idl_type.is_string_type: | 202 if idl_type.is_string_type: |
197 if not raw_type: | 203 if not raw_type: |
198 return 'String' | 204 return 'String' |
199 return 'V8StringResource<%s>' % string_mode() | 205 return 'V8StringResource<%s>' % string_mode() |
200 | 206 |
201 if base_idl_type == 'ArrayBufferView' and 'FlexibleArrayBufferView' in exten ded_attributes: | 207 if base_idl_type == 'ArrayBufferView' and 'FlexibleArrayBufferView' in exten ded_attributes: |
202 return 'FlexibleArrayBufferView' | 208 return 'FlexibleArrayBufferView' |
203 if base_idl_type in TYPED_ARRAY_TYPES and 'FlexibleArrayBufferView' in exten ded_attributes: | 209 if base_idl_type in TYPED_ARRAY_TYPES and 'FlexibleArrayBufferView' in exten ded_attributes: |
204 return 'Flexible' + base_idl_type + 'View' | 210 return 'Flexible' + base_idl_type + 'View' |
211 if base_idl_type in ARRAY_BUFFER_VIEW_AND_TYPED_ARRAY_TYPES: | |
212 if not used_in_cpp_sequence: | |
213 return cpp_template_type('NotShared', idl_type.implemented_as) | |
205 if idl_type.is_interface_type: | 214 if idl_type.is_interface_type: |
206 implemented_as_class = idl_type.implemented_as | 215 implemented_as_class = idl_type.implemented_as |
207 if raw_type or (used_as_rvalue_type and idl_type.is_garbage_collected) o r not used_in_cpp_sequence: | 216 if raw_type or (used_as_rvalue_type and idl_type.is_garbage_collected) o r not used_in_cpp_sequence: |
208 return implemented_as_class + '*' | 217 return implemented_as_class + '*' |
209 if not used_in_cpp_sequence: | 218 if not used_in_cpp_sequence: |
210 return implemented_as_class + '*' | 219 return implemented_as_class + '*' |
211 return cpp_template_type('Member', implemented_as_class) | 220 return cpp_template_type('Member', implemented_as_class) |
212 if idl_type.is_dictionary: | 221 if idl_type.is_dictionary: |
213 if used_as_rvalue_type: | 222 if used_as_rvalue_type: |
214 return 'const %s&' % base_idl_type | 223 return 'const %s&' % base_idl_type |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
336 lambda self: self.value_type.is_traceable) | 345 lambda self: self.value_type.is_traceable) |
337 | 346 |
338 | 347 |
339 ################################################################################ | 348 ################################################################################ |
340 # Includes | 349 # Includes |
341 ################################################################################ | 350 ################################################################################ |
342 | 351 |
343 INCLUDES_FOR_TYPE = { | 352 INCLUDES_FOR_TYPE = { |
344 'object': set(), | 353 'object': set(), |
345 'ArrayBufferView': set(['bindings/core/v8/V8ArrayBufferView.h', | 354 'ArrayBufferView': set(['bindings/core/v8/V8ArrayBufferView.h', |
355 'core/dom/NotShared.h', | |
346 'core/dom/FlexibleArrayBufferView.h']), | 356 'core/dom/FlexibleArrayBufferView.h']), |
347 'Dictionary': set(['bindings/core/v8/Dictionary.h']), | 357 'Dictionary': set(['bindings/core/v8/Dictionary.h']), |
348 'EventHandler': set(['bindings/core/v8/V8AbstractEventListener.h', | 358 'EventHandler': set(['bindings/core/v8/V8AbstractEventListener.h', |
349 'bindings/core/v8/V8EventListenerHelper.h']), | 359 'bindings/core/v8/V8EventListenerHelper.h']), |
350 'EventListener': set(['bindings/core/v8/BindingSecurity.h', | 360 'EventListener': set(['bindings/core/v8/BindingSecurity.h', |
351 'bindings/core/v8/V8EventListenerHelper.h', | 361 'bindings/core/v8/V8EventListenerHelper.h', |
352 'core/frame/LocalDOMWindow.h']), | 362 'core/frame/LocalDOMWindow.h']), |
353 'HTMLCollection': set(['bindings/core/v8/V8HTMLCollection.h', | 363 'HTMLCollection': set(['bindings/core/v8/V8HTMLCollection.h', |
354 'core/dom/ClassCollection.h', | 364 'core/dom/ClassCollection.h', |
355 'core/dom/TagCollection.h', | 365 'core/dom/TagCollection.h', |
(...skipping 15 matching lines...) Expand all Loading... | |
371 | 381 |
372 def includes_for_type(idl_type, extended_attributes=None): | 382 def includes_for_type(idl_type, extended_attributes=None): |
373 idl_type = idl_type.preprocessed_type | 383 idl_type = idl_type.preprocessed_type |
374 extended_attributes = extended_attributes or {} | 384 extended_attributes = extended_attributes or {} |
375 | 385 |
376 # Simple types | 386 # Simple types |
377 base_idl_type = idl_type.base_type | 387 base_idl_type = idl_type.base_type |
378 if base_idl_type in INCLUDES_FOR_TYPE: | 388 if base_idl_type in INCLUDES_FOR_TYPE: |
379 return INCLUDES_FOR_TYPE[base_idl_type] | 389 return INCLUDES_FOR_TYPE[base_idl_type] |
380 if base_idl_type in TYPED_ARRAY_TYPES: | 390 if base_idl_type in TYPED_ARRAY_TYPES: |
381 return INCLUDES_FOR_TYPE['ArrayBufferView'].union( | 391 ta_includes = set() |
haraken
2017/04/06 08:43:54
ta => typed_array
Blink prefers a fully qualified
binji
2017/04/09 00:40:02
Done.
| |
382 set(['bindings/%s/v8/V8%s.h' % (component_dir[base_idl_type], base_i dl_type)]) | 392 ta_includes.update(INCLUDES_FOR_TYPE['ArrayBufferView']) |
383 ) | 393 ta_includes.update(['core/dom/NotShared.h']) |
haraken
2017/04/06 08:43:54
This is not needed since INCLUDES_FOR_TYPE['ArrayB
binji
2017/04/09 00:40:02
Done.
| |
394 ta_includes.update(set(['bindings/%s/v8/V8%s.h' % (component_dir[base_id l_type], base_idl_type)])) | |
395 return ta_includes | |
384 if idl_type.is_basic_type: | 396 if idl_type.is_basic_type: |
385 return set(['bindings/core/v8/IDLTypes.h', | 397 return set(['bindings/core/v8/IDLTypes.h', |
386 'bindings/core/v8/NativeValueTraitsImpl.h']) | 398 'bindings/core/v8/NativeValueTraitsImpl.h']) |
387 if base_idl_type.endswith('ConstructorConstructor'): | 399 if base_idl_type.endswith('ConstructorConstructor'): |
388 # FIXME: rename to NamedConstructor | 400 # FIXME: rename to NamedConstructor |
389 # FIXME: replace with a [NamedConstructorAttribute] extended attribute | 401 # FIXME: replace with a [NamedConstructorAttribute] extended attribute |
390 # Ending with 'ConstructorConstructor' indicates a named constructor, | 402 # Ending with 'ConstructorConstructor' indicates a named constructor, |
391 # and these do not have header files, as they are part of the generated | 403 # and these do not have header files, as they are part of the generated |
392 # bindings for the interface | 404 # bindings for the interface |
393 return set() | 405 return set() |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
452 includes_for_type.add('wtf/Vector.h') | 464 includes_for_type.add('wtf/Vector.h') |
453 | 465 |
454 base_idl_type = idl_type.base_type | 466 base_idl_type = idl_type.base_type |
455 if idl_type.is_string_type: | 467 if idl_type.is_string_type: |
456 includes_for_type.add('wtf/text/WTFString.h') | 468 includes_for_type.add('wtf/text/WTFString.h') |
457 if base_idl_type in interfaces_info: | 469 if base_idl_type in interfaces_info: |
458 interface_info = interfaces_info[base_idl_type] | 470 interface_info = interfaces_info[base_idl_type] |
459 includes_for_type.add(interface_info['include_path']) | 471 includes_for_type.add(interface_info['include_path']) |
460 if base_idl_type in INCLUDES_FOR_TYPE: | 472 if base_idl_type in INCLUDES_FOR_TYPE: |
461 includes_for_type.update(INCLUDES_FOR_TYPE[base_idl_type]) | 473 includes_for_type.update(INCLUDES_FOR_TYPE[base_idl_type]) |
462 if idl_type.is_typed_array: | 474 if idl_type.is_array_buffer_view_or_typed_array: |
463 return set(['core/dom/DOMTypedArray.h']) | 475 return set(['core/dom/DOMTypedArray.h', 'core/dom/NotShared.h']) |
464 return includes_for_type | 476 return includes_for_type |
465 | 477 |
466 | 478 |
467 def impl_includes_for_type_union(idl_type, interfaces_info): | 479 def impl_includes_for_type_union(idl_type, interfaces_info): |
468 includes_for_type = set() | 480 includes_for_type = set() |
469 for member_type in idl_type.member_types: | 481 for member_type in idl_type.member_types: |
470 includes_for_type.update(member_type.impl_includes_for_type(interfaces_i nfo)) | 482 includes_for_type.update(member_type.impl_includes_for_type(interfaces_i nfo)) |
471 return includes_for_type | 483 return includes_for_type |
472 | 484 |
473 IdlTypeBase.impl_includes_for_type = impl_includes_for_type | 485 IdlTypeBase.impl_includes_for_type = impl_includes_for_type |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
512 'ScriptValue': 'ScriptValue(ScriptState::current({isolate}), {v8_value})', | 524 'ScriptValue': 'ScriptValue(ScriptState::current({isolate}), {v8_value})', |
513 'Window': 'toDOMWindow({isolate}, {v8_value})', | 525 'Window': 'toDOMWindow({isolate}, {v8_value})', |
514 'XPathNSResolver': 'toXPathNSResolver(ScriptState::current({isolate}), {v8_v alue})', | 526 'XPathNSResolver': 'toXPathNSResolver(ScriptState::current({isolate}), {v8_v alue})', |
515 } | 527 } |
516 | 528 |
517 | 529 |
518 def v8_conversion_needs_exception_state(idl_type): | 530 def v8_conversion_needs_exception_state(idl_type): |
519 return (idl_type.is_numeric_type or | 531 return (idl_type.is_numeric_type or |
520 idl_type.is_enum or | 532 idl_type.is_enum or |
521 idl_type.is_dictionary or | 533 idl_type.is_dictionary or |
534 idl_type.is_array_buffer_view_or_typed_array or | |
522 idl_type.name in ('Boolean', 'ByteString', 'Date', 'Dictionary', 'US VString', 'SerializedScriptValue')) | 535 idl_type.name in ('Boolean', 'ByteString', 'Date', 'Dictionary', 'US VString', 'SerializedScriptValue')) |
523 | 536 |
524 IdlType.v8_conversion_needs_exception_state = property(v8_conversion_needs_excep tion_state) | 537 IdlType.v8_conversion_needs_exception_state = property(v8_conversion_needs_excep tion_state) |
525 IdlArrayOrSequenceType.v8_conversion_needs_exception_state = True | 538 IdlArrayOrSequenceType.v8_conversion_needs_exception_state = True |
526 IdlRecordType.v8_conversion_needs_exception_state = True | 539 IdlRecordType.v8_conversion_needs_exception_state = True |
527 IdlUnionType.v8_conversion_needs_exception_state = True | 540 IdlUnionType.v8_conversion_needs_exception_state = True |
528 | 541 |
529 | 542 |
530 TRIVIAL_CONVERSIONS = frozenset([ | 543 TRIVIAL_CONVERSIONS = frozenset([ |
531 'any', | 544 'any', |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
572 # Array or sequence types | 585 # Array or sequence types |
573 native_array_element_type = idl_type.native_array_element_type | 586 native_array_element_type = idl_type.native_array_element_type |
574 if native_array_element_type: | 587 if native_array_element_type: |
575 return v8_value_to_cpp_value_array_or_sequence(native_array_element_type , v8_value, index, isolate) | 588 return v8_value_to_cpp_value_array_or_sequence(native_array_element_type , v8_value, index, isolate) |
576 | 589 |
577 # Simple types | 590 # Simple types |
578 idl_type = idl_type.preprocessed_type | 591 idl_type = idl_type.preprocessed_type |
579 base_idl_type = idl_type.as_union_type.name if idl_type.is_union_type else i dl_type.base_type | 592 base_idl_type = idl_type.as_union_type.name if idl_type.is_union_type else i dl_type.base_type |
580 | 593 |
581 if 'FlexibleArrayBufferView' in extended_attributes: | 594 if 'FlexibleArrayBufferView' in extended_attributes: |
582 if base_idl_type not in TYPED_ARRAY_TYPES.union(set(['ArrayBufferView']) ): | 595 if base_idl_type not in ARRAY_BUFFER_VIEW_AND_TYPED_ARRAY_TYPES: |
583 raise ValueError("Unrecognized base type for extended attribute 'Fle xibleArrayBufferView': %s" % (idl_type.base_type)) | 596 raise ValueError("Unrecognized base type for extended attribute 'Fle xibleArrayBufferView': %s" % (idl_type.base_type)) |
584 base_idl_type = 'FlexibleArrayBufferView' | 597 base_idl_type = 'FlexibleArrayBufferView' |
585 | 598 |
586 if idl_type.is_integer_type: | 599 if idl_type.is_integer_type: |
587 configuration = 'NormalConversion' | 600 configuration = 'NormalConversion' |
588 if 'EnforceRange' in extended_attributes: | 601 if 'EnforceRange' in extended_attributes: |
589 configuration = 'EnforceRange' | 602 configuration = 'EnforceRange' |
590 elif 'Clamp' in extended_attributes: | 603 elif 'Clamp' in extended_attributes: |
591 configuration = 'Clamp' | 604 configuration = 'Clamp' |
592 arguments = ', '.join([v8_value, 'exceptionState', configuration]) | 605 arguments = ', '.join([v8_value, 'exceptionState', configuration]) |
593 elif idl_type.v8_conversion_needs_exception_state: | 606 elif idl_type.v8_conversion_needs_exception_state: |
594 arguments = ', '.join([v8_value, 'exceptionState']) | 607 arguments = ', '.join([v8_value, 'exceptionState']) |
595 else: | 608 else: |
596 arguments = v8_value | 609 arguments = v8_value |
597 | 610 |
598 if base_idl_type in V8_VALUE_TO_CPP_VALUE: | 611 if base_idl_type in V8_VALUE_TO_CPP_VALUE: |
599 cpp_expression_format = V8_VALUE_TO_CPP_VALUE[base_idl_type] | 612 cpp_expression_format = V8_VALUE_TO_CPP_VALUE[base_idl_type] |
600 elif idl_type.is_array_buffer_or_view: | 613 elif idl_type.name == 'ArrayBuffer': |
601 cpp_expression_format = ( | 614 cpp_expression_format = ( |
602 '{v8_value}->Is{idl_type}() ? ' | 615 '{v8_value}->Is{idl_type}() ? ' |
603 'V8{idl_type}::toImpl(v8::Local<v8::{idl_type}>::Cast({v8_value})) : 0') | 616 'V8{idl_type}::toImpl(v8::Local<v8::{idl_type}>::Cast({v8_value})) : 0') |
617 elif idl_type.is_array_buffer_view_or_typed_array: | |
618 this_cpp_type = idl_type.cpp_type | |
619 cpp_expression_format = ('toNotShared<%s>({isolate}, {v8_value}, excepti onState)' % this_cpp_type) | |
604 elif idl_type.is_union_type: | 620 elif idl_type.is_union_type: |
605 nullable = 'UnionTypeConversionMode::Nullable' if idl_type.includes_null able_type else 'UnionTypeConversionMode::NotNullable' | 621 nullable = 'UnionTypeConversionMode::Nullable' if idl_type.includes_null able_type else 'UnionTypeConversionMode::NotNullable' |
606 cpp_expression_format = 'V8{idl_type}::toImpl({isolate}, {v8_value}, {va riable_name}, %s, exceptionState)' % nullable | 622 cpp_expression_format = 'V8{idl_type}::toImpl({isolate}, {v8_value}, {va riable_name}, %s, exceptionState)' % nullable |
607 elif idl_type.use_output_parameter_for_result: | 623 elif idl_type.use_output_parameter_for_result: |
608 cpp_expression_format = 'V8{idl_type}::toImpl({isolate}, {v8_value}, {va riable_name}, exceptionState)' | 624 cpp_expression_format = 'V8{idl_type}::toImpl({isolate}, {v8_value}, {va riable_name}, exceptionState)' |
609 elif idl_type.is_callback_function: | 625 elif idl_type.is_callback_function: |
610 cpp_expression_format = ( | 626 cpp_expression_format = ( |
611 '{idl_type}::create(ScriptState::current({isolate}), {v8_value})') | 627 '{idl_type}::create(ScriptState::current({isolate}), {v8_value})') |
612 elif idl_type.v8_conversion_needs_exception_state: | 628 elif idl_type.v8_conversion_needs_exception_state: |
613 # Effectively, this if branch means everything with v8_conversion_needs_ exception_state == True | 629 # Effectively, this if branch means everything with v8_conversion_needs_ exception_state == True |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
658 # Optional expression that returns a value to be assigned to the local varia ble. | 674 # Optional expression that returns a value to be assigned to the local varia ble. |
659 assign_expression = None | 675 assign_expression = None |
660 # Optional void expression executed unconditionally. | 676 # Optional void expression executed unconditionally. |
661 set_expression = None | 677 set_expression = None |
662 # Optional expression that returns true if the conversion fails. | 678 # Optional expression that returns true if the conversion fails. |
663 check_expression = None | 679 check_expression = None |
664 # Optional expression used as the return value when returning. Only | 680 # Optional expression used as the return value when returning. Only |
665 # meaningful if 'check_expression' is not None. | 681 # meaningful if 'check_expression' is not None. |
666 return_expression = bailout_return_value | 682 return_expression = bailout_return_value |
667 | 683 |
668 if idl_type.is_string_type or idl_type.v8_conversion_needs_exception_state: | 684 if 'FlexibleArrayBufferView' in extended_attributes: |
685 if idl_type.base_type not in ARRAY_BUFFER_VIEW_AND_TYPED_ARRAY_TYPES: | |
686 raise ValueError("Unrecognized base type for extended attribute 'Fle xibleArrayBufferView': %s" % (idl_type.base_type)) | |
687 set_expression = cpp_value | |
688 elif idl_type.is_string_type or idl_type.v8_conversion_needs_exception_state : | |
669 # Types for which conversion can fail and that need error handling. | 689 # Types for which conversion can fail and that need error handling. |
670 | 690 |
671 check_expression = 'exceptionState.hadException()' | 691 check_expression = 'exceptionState.hadException()' |
672 | 692 |
673 if idl_type.is_dictionary or idl_type.is_union_type: | 693 if idl_type.is_dictionary or idl_type.is_union_type: |
674 set_expression = cpp_value | 694 set_expression = cpp_value |
675 else: | 695 else: |
676 assign_expression = cpp_value | 696 assign_expression = cpp_value |
677 # Note: 'not idl_type.v8_conversion_needs_exception_state' implies | 697 # Note: 'not idl_type.v8_conversion_needs_exception_state' implies |
678 # 'idl_type.is_string_type', but there are types for which both are | 698 # 'idl_type.is_string_type', but there are types for which both are |
679 # true (ByteString and USVString), so using idl_type.is_string_type | 699 # true (ByteString and USVString), so using idl_type.is_string_type |
680 # as the condition here would be wrong. | 700 # as the condition here would be wrong. |
681 if not idl_type.v8_conversion_needs_exception_state: | 701 if not idl_type.v8_conversion_needs_exception_state: |
682 if use_exception_state: | 702 if use_exception_state: |
683 check_expression = '!%s.prepare(exceptionState)' % variable_ name | 703 check_expression = '!%s.prepare(exceptionState)' % variable_ name |
684 else: | 704 else: |
685 check_expression = '!%s.prepare()' % variable_name | 705 check_expression = '!%s.prepare()' % variable_name |
686 elif not idl_type.v8_conversion_is_trivial and not idl_type.is_callback_func tion: | 706 elif not idl_type.v8_conversion_is_trivial and not idl_type.is_callback_func tion: |
687 return { | 707 return { |
688 'error_message': 'no V8 -> C++ conversion for IDL type: %s' % idl_ty pe.name | 708 'error_message': 'no V8 -> C++ conversion for IDL type: %s' % idl_ty pe.name |
689 } | 709 } |
690 elif 'FlexibleArrayBufferView' in extended_attributes: | |
691 if idl_type.base_type not in TYPED_ARRAY_TYPES.union(set(['ArrayBufferVi ew'])): | |
692 raise ValueError("Unrecognized base type for extended attribute 'Fle xibleArrayBufferView': %s" % (idl_type.base_type)) | |
693 set_expression = cpp_value | |
694 else: | 710 else: |
695 assign_expression = cpp_value | 711 assign_expression = cpp_value |
696 | 712 |
697 # Types that don't need error handling, and simply assign a value to the | 713 # Types that don't need error handling, and simply assign a value to the |
698 # local variable. | 714 # local variable. |
699 | 715 |
700 return { | 716 return { |
701 'assign_expression': assign_expression, | 717 'assign_expression': assign_expression, |
702 'check_expression': check_expression, | 718 'check_expression': check_expression, |
703 'cpp_type': this_cpp_type, | 719 'cpp_type': this_cpp_type, |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1059 IdlTypeBase.is_explicit_nullable = property(is_explicit_nullable) | 1075 IdlTypeBase.is_explicit_nullable = property(is_explicit_nullable) |
1060 | 1076 |
1061 | 1077 |
1062 def includes_nullable_type_union(idl_type): | 1078 def includes_nullable_type_union(idl_type): |
1063 # http://heycam.github.io/webidl/#dfn-includes-a-nullable-type | 1079 # http://heycam.github.io/webidl/#dfn-includes-a-nullable-type |
1064 return idl_type.number_of_nullable_member_types == 1 | 1080 return idl_type.number_of_nullable_member_types == 1 |
1065 | 1081 |
1066 IdlTypeBase.includes_nullable_type = False | 1082 IdlTypeBase.includes_nullable_type = False |
1067 IdlNullableType.includes_nullable_type = True | 1083 IdlNullableType.includes_nullable_type = True |
1068 IdlUnionType.includes_nullable_type = property(includes_nullable_type_union) | 1084 IdlUnionType.includes_nullable_type = property(includes_nullable_type_union) |
OLD | NEW |