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 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 else: | 452 else: |
453 arguments = v8_value | 453 arguments = v8_value |
454 | 454 |
455 if base_idl_type in V8_VALUE_TO_CPP_VALUE: | 455 if base_idl_type in V8_VALUE_TO_CPP_VALUE: |
456 cpp_expression_format = V8_VALUE_TO_CPP_VALUE[base_idl_type] | 456 cpp_expression_format = V8_VALUE_TO_CPP_VALUE[base_idl_type] |
457 elif idl_type.is_typed_array_element_type: | 457 elif idl_type.is_typed_array_element_type: |
458 cpp_expression_format = ( | 458 cpp_expression_format = ( |
459 '{v8_value}->Is{idl_type}() ? ' | 459 '{v8_value}->Is{idl_type}() ? ' |
460 'V8{idl_type}::toNative(v8::Handle<v8::{idl_type}>::Cast({v8_value})
) : 0') | 460 'V8{idl_type}::toNative(v8::Handle<v8::{idl_type}>::Cast({v8_value})
) : 0') |
461 elif idl_type.is_dictionary: | 461 elif idl_type.is_dictionary: |
462 cpp_expression_format = 'V8{idl_type}::toNative({isoalte}, {v8_value})' | 462 cpp_expression_format = 'V8{idl_type}::toNative({isolate}, {v8_value})' |
463 else: | 463 else: |
464 cpp_expression_format = ( | 464 cpp_expression_format = ( |
465 'V8{idl_type}::toNativeWithTypeCheck({isolate}, {v8_value})') | 465 'V8{idl_type}::toNativeWithTypeCheck({isolate}, {v8_value})') |
466 | 466 |
467 return cpp_expression_format.format(arguments=arguments, idl_type=base_idl_t
ype, v8_value=v8_value, isolate=isolate) | 467 return cpp_expression_format.format(arguments=arguments, idl_type=base_idl_t
ype, v8_value=v8_value, isolate=isolate) |
468 | 468 |
469 | 469 |
470 def v8_value_to_cpp_value_array_or_sequence(native_array_element_type, v8_value,
index, isolate='info.GetIsolate()'): | 470 def v8_value_to_cpp_value_array_or_sequence(native_array_element_type, v8_value,
index, isolate='info.GetIsolate()'): |
471 # Index is None for setters, index (starting at 0) for method arguments, | 471 # Index is None for setters, index (starting at 0) for method arguments, |
472 # and is used to provide a human-readable exception message | 472 # and is used to provide a human-readable exception message |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
763 | 763 |
764 def is_explicit_nullable(idl_type): | 764 def is_explicit_nullable(idl_type): |
765 # Nullable type that isn't implicit nullable (see above.) For such types, | 765 # Nullable type that isn't implicit nullable (see above.) For such types, |
766 # we use Nullable<T> or similar explicit ways to represent a null value. | 766 # we use Nullable<T> or similar explicit ways to represent a null value. |
767 return idl_type.is_nullable and not idl_type.is_implicit_nullable | 767 return idl_type.is_nullable and not idl_type.is_implicit_nullable |
768 | 768 |
769 IdlType.is_implicit_nullable = property(is_implicit_nullable) | 769 IdlType.is_implicit_nullable = property(is_implicit_nullable) |
770 IdlType.is_explicit_nullable = property(is_explicit_nullable) | 770 IdlType.is_explicit_nullable = property(is_explicit_nullable) |
771 IdlUnionType.is_implicit_nullable = False | 771 IdlUnionType.is_implicit_nullable = False |
772 IdlUnionType.is_explicit_nullable = property(is_explicit_nullable) | 772 IdlUnionType.is_explicit_nullable = property(is_explicit_nullable) |
OLD | NEW |