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

Side by Side Diff: Source/bindings/scripts/unstable/idl_definitions_builder.py

Issue 116153002: IDL compiler: [NamedConstructor] (basic) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Revised Created 7 years 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 | Annotate | Revision Log
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 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 name = 'NamedConstructor' 431 name = 'NamedConstructor'
432 call_node = extended_attributes['NamedConstructor'] 432 call_node = extended_attributes['NamedConstructor']
433 extended_attributes['NamedConstructor'] = call_node.GetName() 433 extended_attributes['NamedConstructor'] = call_node.GetName()
434 overloaded_index = None # named constructors are not overloaded 434 overloaded_index = None # named constructors are not overloaded
435 children = call_node.GetChildren() 435 children = call_node.GetChildren()
436 if len(children) != 1: 436 if len(children) != 1:
437 raise ValueError('NamedConstructor node expects 1 child, got %s.' % len(children)) 437 raise ValueError('NamedConstructor node expects 1 child, got %s.' % len(children))
438 arguments_node = children[0] 438 arguments_node = children[0]
439 arguments = arguments_node_to_arguments(arguments_node) 439 arguments = arguments_node_to_arguments(arguments_node)
440 named_constructor = IdlOperation(name=name, extended_attributes=extended _attributes, overloaded_index=overloaded_index, arguments=arguments) 440 named_constructor = IdlOperation(name=name, extended_attributes=extended _attributes, overloaded_index=overloaded_index, arguments=arguments)
441 # FIXME: should return named_constructor separately; appended for Perl
441 constructors.append(named_constructor) 442 constructors.append(named_constructor)
442 443
443 return constructors, custom_constructors 444 return constructors, custom_constructors
444 445
445 446
446 def clear_constructor_attributes(extended_attributes): 447 def clear_constructor_attributes(extended_attributes):
447 # Deletes Constructor*s* (plural), sets Constructor (singular) 448 # Deletes Constructor*s* (plural), sets Constructor (singular)
448 if 'Constructors' in extended_attributes: 449 if 'Constructors' in extended_attributes:
449 del extended_attributes['Constructors'] 450 del extended_attributes['Constructors']
450 extended_attributes['Constructor'] = None 451 extended_attributes['Constructor'] = None
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 sequence_type = type_node_to_type(sequence_child) 502 sequence_type = type_node_to_type(sequence_child)
502 return 'sequence<%s>' % sequence_type 503 return 'sequence<%s>' % sequence_type
503 504
504 505
505 def union_type_node_to_idl_union_type(node): 506 def union_type_node_to_idl_union_type(node):
506 union_member_types = [] 507 union_member_types = []
507 for member_type_node in node.GetChildren(): 508 for member_type_node in node.GetChildren():
508 member_type = type_node_to_type(member_type_node) 509 member_type = type_node_to_type(member_type_node)
509 union_member_types.append(member_type) 510 union_member_types.append(member_type)
510 return IdlUnionType(union_member_types=union_member_types) 511 return IdlUnionType(union_member_types=union_member_types)
OLDNEW
« no previous file with comments | « Source/bindings/scripts/code_generator_v8.pm ('k') | Source/bindings/scripts/unstable/v8_interface.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698