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

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

Issue 340443004: IDL: reuse more code between CG for methods and constructors (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rename scriptContext -> executionContext 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_attributes.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 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 448
449 ################################################################################ 449 ################################################################################
450 # Operations 450 # Operations
451 ################################################################################ 451 ################################################################################
452 452
453 class IdlOperation(TypedObject): 453 class IdlOperation(TypedObject):
454 def __init__(self, node=None): 454 def __init__(self, node=None):
455 self.arguments = [] 455 self.arguments = []
456 self.extended_attributes = {} 456 self.extended_attributes = {}
457 self.specials = [] 457 self.specials = []
458 self.is_constructor = False
458 459
459 if not node: 460 if not node:
460 self.is_static = False 461 self.is_static = False
461 return 462 return
462 self.name = node.GetName() # FIXME: should just be: or '' 463 self.name = node.GetName() # FIXME: should just be: or ''
463 # FIXME: AST should use None internally 464 # FIXME: AST should use None internally
464 if self.name == '_unnamed_': 465 if self.name == '_unnamed_':
465 self.name = '' 466 self.name = ''
466 467
467 self.is_static = node.GetProperty('STATIC') or False 468 self.is_static = node.GetProperty('STATIC') or False
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 ext_attributes_node = children[1] 503 ext_attributes_node = children[1]
503 operation.extended_attributes = ext_attributes_node_to_extended_attr ibutes(ext_attributes_node) 504 operation.extended_attributes = ext_attributes_node_to_extended_attr ibutes(ext_attributes_node)
504 505
505 return operation 506 return operation
506 507
507 @classmethod 508 @classmethod
508 def constructor_from_arguments_node(cls, name, arguments_node): 509 def constructor_from_arguments_node(cls, name, arguments_node):
509 constructor = cls() 510 constructor = cls()
510 constructor.name = name 511 constructor.name = name
511 constructor.arguments = arguments_node_to_arguments(arguments_node) 512 constructor.arguments = arguments_node_to_arguments(arguments_node)
513 constructor.is_constructor = True
512 return constructor 514 return constructor
513 515
514 def resolve_typedefs(self, typedefs): 516 def resolve_typedefs(self, typedefs):
515 TypedObject.resolve_typedefs(self, typedefs) 517 TypedObject.resolve_typedefs(self, typedefs)
516 for argument in self.arguments: 518 for argument in self.arguments:
517 argument.resolve_typedefs(typedefs) 519 argument.resolve_typedefs(typedefs)
518 520
519 521
520 ################################################################################ 522 ################################################################################
521 # Arguments 523 # Arguments
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 child_class = child.GetClass() 747 child_class = child.GetClass()
746 if child_class != 'Type': 748 if child_class != 'Type':
747 raise ValueError('Unrecognized node class: %s' % child_class) 749 raise ValueError('Unrecognized node class: %s' % child_class)
748 return type_node_to_type(child) 750 return type_node_to_type(child)
749 751
750 752
751 def union_type_node_to_idl_union_type(node, is_nullable=False): 753 def union_type_node_to_idl_union_type(node, is_nullable=False):
752 member_types = [type_node_to_type(member_type_node) 754 member_types = [type_node_to_type(member_type_node)
753 for member_type_node in node.GetChildren()] 755 for member_type_node in node.GetChildren()]
754 return IdlUnionType(member_types, is_nullable=is_nullable) 756 return IdlUnionType(member_types, is_nullable=is_nullable)
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/scripts/v8_attributes.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698