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

Side by Side Diff: tools/jsmin.py

Issue 10412022: Fixing python deprecations. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 7 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 | « tools/js2c.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python2.4 1 #!/usr/bin/python2.4
2 2
3 # Copyright 2009 the V8 project authors. All rights reserved. 3 # Copyright 2012 the V8 project authors. All rights reserved.
4 # Redistribution and use in source and binary forms, with or without 4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are 5 # modification, are permitted provided that the following conditions are
6 # met: 6 # met:
7 # 7 #
8 # * Redistributions of source code must retain the above copyright 8 # * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer. 9 # notice, this list of conditions and the following disclaimer.
10 # * Redistributions in binary form must reproduce the above 10 # * Redistributions in binary form must reproduce the above
11 # copyright notice, this list of conditions and the following 11 # copyright notice, this list of conditions and the following
12 # disclaimer in the documentation and/or other materials provided 12 # disclaimer in the documentation and/or other materials provided
13 # with the distribution. 13 # with the distribution.
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 new_identifier = "" 147 new_identifier = ""
148 # Variable names that end in _ are member variables of the global object, 148 # Variable names that end in _ are member variables of the global object,
149 # so they can be visible from code in a different scope. We leave them 149 # so they can be visible from code in a different scope. We leave them
150 # alone. 150 # alone.
151 if var_name in self.map: 151 if var_name in self.map:
152 return self.map[var_name] 152 return self.map[var_name]
153 if self.nesting == 0: 153 if self.nesting == 0:
154 return var_name 154 return var_name
155 while True: 155 while True:
156 identifier_first_char = self.identifier_counter % 52 156 identifier_first_char = self.identifier_counter % 52
157 identifier_second_char = self.identifier_counter / 52 157 identifier_second_char = self.identifier_counter // 52
158 new_identifier = self.CharFromNumber(identifier_first_char) 158 new_identifier = self.CharFromNumber(identifier_first_char)
159 if identifier_second_char != 0: 159 if identifier_second_char != 0:
160 new_identifier = ( 160 new_identifier = (
161 self.CharFromNumber(identifier_second_char - 1) + new_identifier) 161 self.CharFromNumber(identifier_second_char - 1) + new_identifier)
162 self.identifier_counter += 1 162 self.identifier_counter += 1
163 if not new_identifier in self.seen_identifiers: 163 if not new_identifier in self.seen_identifiers:
164 break 164 break
165 165
166 self.map[var_name] = new_identifier 166 self.map[var_name] = new_identifier
167 return new_identifier 167 return new_identifier
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 r"\{", # Curly braces. 273 r"\{", # Curly braces.
274 r"\}", 274 r"\}",
275 r"\bvar [\w$%,]+", # var declarations. 275 r"\bvar [\w$%,]+", # var declarations.
276 function_declaration_regexp, 276 function_declaration_regexp,
277 variable_use_regexp]), 277 variable_use_regexp]),
278 self.Declaration, 278 self.Declaration,
279 line) 279 line)
280 new_lines.append(line) 280 new_lines.append(line)
281 281
282 return "\n".join(new_lines) + "\n" 282 return "\n".join(new_lines) + "\n"
OLDNEW
« no previous file with comments | « tools/js2c.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698