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

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

Issue 352133002: IDL: fix handling of non-decimal and unsigned default values (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 6 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
« no previous file with comments | « no previous file | Source/bindings/scripts/v8_methods.py » ('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 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 # FIXME: This code is unnecessarily complicated due to the rather 443 # FIXME: This code is unnecessarily complicated due to the rather
444 # inconsistent way the upstream IDL parser outputs default values. 444 # inconsistent way the upstream IDL parser outputs default values.
445 # http://crbug.com/374178 445 # http://crbug.com/374178
446 idl_type = node.GetProperty('TYPE') 446 idl_type = node.GetProperty('TYPE')
447 if idl_type == 'DOMString': 447 if idl_type == 'DOMString':
448 value = node.GetProperty('NAME') 448 value = node.GetProperty('NAME')
449 if '"' in value or '\\' in value: 449 if '"' in value or '\\' in value:
450 raise ValueError('Unsupported string value: %r' % value) 450 raise ValueError('Unsupported string value: %r' % value)
451 return IdlLiteral(idl_type, value) 451 return IdlLiteral(idl_type, value)
452 if idl_type == 'integer': 452 if idl_type == 'integer':
453 return IdlLiteral(idl_type, int(node.GetProperty('NAME'))) 453 return IdlLiteral(idl_type, int(node.GetProperty('NAME'), base=0))
454 if idl_type == 'float': 454 if idl_type == 'float':
455 return IdlLiteral(idl_type, float(node.GetProperty('VALUE'))) 455 return IdlLiteral(idl_type, float(node.GetProperty('VALUE')))
456 if idl_type == 'boolean': 456 if idl_type == 'boolean':
457 return IdlLiteral(idl_type, node.GetProperty('VALUE')) 457 return IdlLiteral(idl_type, node.GetProperty('VALUE'))
458 if idl_type == 'NULL': 458 if idl_type == 'NULL':
459 return IdlLiteralNull() 459 return IdlLiteralNull()
460 raise ValueError('Unrecognized default value type: %s' % idl_type) 460 raise ValueError('Unrecognized default value type: %s' % idl_type)
461 461
462 462
463 ################################################################################ 463 ################################################################################
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
791 child_class = child.GetClass() 791 child_class = child.GetClass()
792 if child_class != 'Type': 792 if child_class != 'Type':
793 raise ValueError('Unrecognized node class: %s' % child_class) 793 raise ValueError('Unrecognized node class: %s' % child_class)
794 return type_node_to_type(child) 794 return type_node_to_type(child)
795 795
796 796
797 def union_type_node_to_idl_union_type(node, is_nullable=False): 797 def union_type_node_to_idl_union_type(node, is_nullable=False):
798 member_types = [type_node_to_type(member_type_node) 798 member_types = [type_node_to_type(member_type_node)
799 for member_type_node in node.GetChildren()] 799 for member_type_node in node.GetChildren()]
800 return IdlUnionType(member_types, is_nullable=is_nullable) 800 return IdlUnionType(member_types, is_nullable=is_nullable)
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/scripts/v8_methods.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698