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 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
711 'unrestricted double': 'DartConverter<double>::ToDart({cpp_value})', | 711 'unrestricted double': 'DartConverter<double>::ToDart({cpp_value})', |
712 # FIXME(vsm): Dart_Null? | 712 # FIXME(vsm): Dart_Null? |
713 'void': '', | 713 'void': '', |
714 # Special cases | 714 # Special cases |
715 'EventHandler': '-----OOPS TO DART-EVENT---', | 715 'EventHandler': '-----OOPS TO DART-EVENT---', |
716 # We need to generate the NullCheck version in some cases. | 716 # We need to generate the NullCheck version in some cases. |
717 'ScriptPromise': 'DartUtilities::scriptPromiseToDart({cpp_value})', | 717 'ScriptPromise': 'DartUtilities::scriptPromiseToDart({cpp_value})', |
718 'DartValue': 'DartConverter<DartValue*>::ToDart({cpp_value})', | 718 'DartValue': 'DartConverter<DartValue*>::ToDart({cpp_value})', |
719 # General | 719 # General |
720 'array': 'VectorToDart({cpp_value})', | 720 'array': 'VectorToDart({cpp_value})', |
721 'DOMWrapper': 'Dart{idl_type}::toDart({cpp_value})', | 721 'DOMWrapper': 'DartConverter<{idl_type}*>::ToDart({cpp_value})', |
722 } | 722 } |
723 | 723 |
724 | 724 |
725 def cpp_value_to_dart_value(idl_type, cpp_value, creation_context='', extended_a
ttributes=None): | 725 def cpp_value_to_dart_value(idl_type, cpp_value, creation_context='', extended_a
ttributes=None): |
726 """Returns an expression that converts a C++ value to a Dart value.""" | 726 """Returns an expression that converts a C++ value to a Dart value.""" |
727 # the isolate parameter is needed for callback interfaces | 727 # the isolate parameter is needed for callback interfaces |
728 idl_type, cpp_value = preprocess_idl_type_and_value(idl_type, cpp_value, ext
ended_attributes) | 728 idl_type, cpp_value = preprocess_idl_type_and_value(idl_type, cpp_value, ext
ended_attributes) |
729 this_dart_conversion_type = idl_type.dart_conversion_type(extended_attribute
s) | 729 this_dart_conversion_type = idl_type.dart_conversion_type(extended_attribute
s) |
730 format_string = CPP_VALUE_TO_DART_VALUE[this_dart_conversion_type] | 730 format_string = CPP_VALUE_TO_DART_VALUE[this_dart_conversion_type] |
731 statement = format_string.format(cpp_value=cpp_value, idl_type=idl_type.base
_type) | 731 statement = format_string.format(cpp_value=cpp_value, idl_type=idl_type.base
_type) |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
853 # This logic is in cpp_types in v8_types.py, since they handle | 853 # This logic is in cpp_types in v8_types.py, since they handle |
854 # this using the V8StringResource type. We handle it here | 854 # this using the V8StringResource type. We handle it here |
855 if (extended_attributes.get('TreatNullAs') == 'EmptyString' or | 855 if (extended_attributes.get('TreatNullAs') == 'EmptyString' or |
856 extended_attributes.get('TreatUndefinedAs') == 'EmptyString'): | 856 extended_attributes.get('TreatUndefinedAs') == 'EmptyString'): |
857 return True | 857 return True |
858 | 858 |
859 if extended_attributes.get('Default') == 'EmptyString': | 859 if extended_attributes.get('Default') == 'EmptyString': |
860 return True | 860 return True |
861 | 861 |
862 return False | 862 return False |
OLD | NEW |