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

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

Issue 928233002: IDL: Don't lose nullable flag when "preprocessing" type (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fix compilation Created 5 years, 10 months 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
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 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 return idl_type.is_dictionary or idl_type.is_union_type 664 return idl_type.is_dictionary or idl_type.is_union_type
665 665
666 IdlTypeBase.use_output_parameter_for_result = property(use_output_parameter_for_ result) 666 IdlTypeBase.use_output_parameter_for_result = property(use_output_parameter_for_ result)
667 667
668 668
669 ################################################################################ 669 ################################################################################
670 # C++ -> V8 670 # C++ -> V8
671 ################################################################################ 671 ################################################################################
672 672
673 def preprocess_idl_type(idl_type): 673 def preprocess_idl_type(idl_type):
674 if idl_type.is_nullable:
675 return IdlNullableType(idl_type.inner_type.preprocessed_type)
674 if idl_type.is_enum: 676 if idl_type.is_enum:
675 # Enumerations are internally DOMStrings 677 # Enumerations are internally DOMStrings
676 return IdlType('DOMString') 678 return IdlType('DOMString')
677 if (idl_type.name in ['Any', 'Object'] or idl_type.is_callback_function): 679 if idl_type.base_type in ['any', 'object'] or idl_type.is_callback_function:
Jens Widell 2015/02/16 14:33:54 Looking at idl_type.name here was wrong; it would
678 return IdlType('ScriptValue') 680 return IdlType('ScriptValue')
679 return idl_type 681 return idl_type
680 682
681 IdlTypeBase.preprocessed_type = property(preprocess_idl_type) 683 IdlTypeBase.preprocessed_type = property(preprocess_idl_type)
682 684
683 685
684 def preprocess_idl_type_and_value(idl_type, cpp_value, extended_attributes): 686 def preprocess_idl_type_and_value(idl_type, cpp_value, extended_attributes):
685 """Returns IDL type and value, with preliminary type conversions applied.""" 687 """Returns IDL type and value, with preliminary type conversions applied."""
686 idl_type = idl_type.preprocessed_type 688 idl_type = idl_type.preprocessed_type
687 if idl_type.name == 'Promise': 689 if idl_type.name == 'Promise':
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
947 number_of_nullable_member_types_union) 949 number_of_nullable_member_types_union)
948 950
949 951
950 def includes_nullable_type_union(idl_type): 952 def includes_nullable_type_union(idl_type):
951 # http://heycam.github.io/webidl/#dfn-includes-a-nullable-type 953 # http://heycam.github.io/webidl/#dfn-includes-a-nullable-type
952 return idl_type.number_of_nullable_member_types == 1 954 return idl_type.number_of_nullable_member_types == 1
953 955
954 IdlTypeBase.includes_nullable_type = False 956 IdlTypeBase.includes_nullable_type = False
955 IdlNullableType.includes_nullable_type = True 957 IdlNullableType.includes_nullable_type = True
956 IdlUnionType.includes_nullable_type = property(includes_nullable_type_union) 958 IdlUnionType.includes_nullable_type = property(includes_nullable_type_union)
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/tests/idls/core/TestObject.idl » ('j') | Source/core/html/canvas/WebGLRenderingContextBase.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698