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

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

Issue 36793003: IDL compiler: constructor attributes (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « Source/bindings/scripts/unstable/v8_types.py ('k') | Source/bindings/templates/interface.cpp » ('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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 56
57 def capitalize(name): 57 def capitalize(name):
58 """Capitalize first letter or initial acronym (used in setter names).""" 58 """Capitalize first letter or initial acronym (used in setter names)."""
59 for acronym in ACRONYMS: 59 for acronym in ACRONYMS:
60 if name.startswith(acronym.lower()): 60 if name.startswith(acronym.lower()):
61 return name.replace(acronym.lower(), acronym) 61 return name.replace(acronym.lower(), acronym)
62 return name[0].upper() + name[1:] 62 return name[0].upper() + name[1:]
63 63
64 64
65 def strip_suffix(string, suffix):
66 if not suffix or not string.endswith(suffix):
67 return string
68 return string[:-len(suffix)]
69
70
65 def uncapitalize(name): 71 def uncapitalize(name):
66 """Uncapitalizes first letter or initial acronym (* with some exceptions). 72 """Uncapitalizes first letter or initial acronym (* with some exceptions).
67 73
68 E.g., 'SetURL' becomes 'setURL', but 'URLFoo' becomes 'urlFoo'. 74 E.g., 'SetURL' becomes 'setURL', but 'URLFoo' becomes 'urlFoo'.
69 Used in method names; exceptions differ from capitalize(). 75 Used in method names; exceptions differ from capitalize().
70 """ 76 """
71 for acronym in ACRONYMS: 77 for acronym in ACRONYMS:
72 if name.startswith(acronym): 78 if name.startswith(acronym):
73 name.replace(acronym, acronym.lower()) 79 name.replace(acronym, acronym.lower())
74 return name 80 return name
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 def cpp_name(definition_or_member): 188 def cpp_name(definition_or_member):
183 return definition_or_member.extended_attributes.get('ImplementedAs', definit ion_or_member.name) 189 return definition_or_member.extended_attributes.get('ImplementedAs', definit ion_or_member.name)
184 190
185 191
186 # [MeasureAs] 192 # [MeasureAs]
187 def generate_measure_as(definition_or_member, contents): 193 def generate_measure_as(definition_or_member, contents):
188 if 'MeasureAs' not in definition_or_member.extended_attributes: 194 if 'MeasureAs' not in definition_or_member.extended_attributes:
189 return 195 return
190 contents['measure_as'] = definition_or_member.extended_attributes['MeasureAs '] 196 contents['measure_as'] = definition_or_member.extended_attributes['MeasureAs ']
191 includes.add('core/page/UseCounter.h') 197 includes.add('core/page/UseCounter.h')
OLDNEW
« no previous file with comments | « Source/bindings/scripts/unstable/v8_types.py ('k') | Source/bindings/templates/interface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698