Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: Source/bindings/scripts/v8_types.py

Issue 704503002: IDL: Union type support for attributes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@union-arraybuffer
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/bindings/scripts/v8_methods.py ('k') | Source/bindings/templates/attributes.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 624
625 assignment = '%s = %s' % (variable_name, cpp_value) 625 assignment = '%s = %s' % (variable_name, cpp_value)
626 if declare_variable: 626 if declare_variable:
627 return '%s %s' % (this_cpp_type, assignment) 627 return '%s %s' % (this_cpp_type, assignment)
628 return assignment 628 return assignment
629 629
630 630
631 IdlTypeBase.v8_value_to_local_cpp_value = v8_value_to_local_cpp_value 631 IdlTypeBase.v8_value_to_local_cpp_value = v8_value_to_local_cpp_value
632 632
633 633
634 def use_output_parameter_for_result(idl_type):
635 """True when methods/getters which return the given idl_type should
636 take the output argument.
637 """
638 return idl_type.is_dictionary or idl_type.is_union_type
639
640 IdlTypeBase.use_output_parameter_for_result = property(use_output_parameter_for_ result)
641
642
634 ################################################################################ 643 ################################################################################
635 # C++ -> V8 644 # C++ -> V8
636 ################################################################################ 645 ################################################################################
637 646
638 def preprocess_idl_type(idl_type): 647 def preprocess_idl_type(idl_type):
639 if idl_type.is_enum: 648 if idl_type.is_enum:
640 # Enumerations are internally DOMStrings 649 # Enumerations are internally DOMStrings
641 return IdlType('DOMString') 650 return IdlType('DOMString')
642 if (idl_type.name in ['Any', 'Object'] or idl_type.is_callback_function): 651 if (idl_type.name in ['Any', 'Object'] or idl_type.is_callback_function):
643 return IdlType('ScriptValue') 652 return IdlType('ScriptValue')
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 873
865 874
866 def is_explicit_nullable(idl_type): 875 def is_explicit_nullable(idl_type):
867 # Nullable type that isn't implicit nullable (see above.) For such types, 876 # Nullable type that isn't implicit nullable (see above.) For such types,
868 # we use Nullable<T> or similar explicit ways to represent a null value. 877 # we use Nullable<T> or similar explicit ways to represent a null value.
869 return idl_type.is_nullable and not idl_type.is_implicit_nullable 878 return idl_type.is_nullable and not idl_type.is_implicit_nullable
870 879
871 IdlTypeBase.is_implicit_nullable = property(is_implicit_nullable) 880 IdlTypeBase.is_implicit_nullable = property(is_implicit_nullable)
872 IdlUnionType.is_implicit_nullable = False 881 IdlUnionType.is_implicit_nullable = False
873 IdlTypeBase.is_explicit_nullable = property(is_explicit_nullable) 882 IdlTypeBase.is_explicit_nullable = property(is_explicit_nullable)
OLDNEW
« no previous file with comments | « Source/bindings/scripts/v8_methods.py ('k') | Source/bindings/templates/attributes.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698