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

Unified Diff: grit/node/base.py

Issue 122253002: Simplify how variable_map is initialized. Suggestion by thakis@chromium.org. (Closed) Base URL: https://grit-i18n.googlecode.com/svn/trunk
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: grit/node/base.py
diff --git a/grit/node/base.py b/grit/node/base.py
index b54ba79a164605b4d10f020b8e4ee9924ba329ef..375524050878f1c44a1fc31e7d3f154018e763cb 100644
--- a/grit/node/base.py
+++ b/grit/node/base.py
@@ -469,21 +469,28 @@ class Node(object):
return symbol in defs
def pp_if(symbol):
return defs.get(symbol, False)
- platform_assertion = Node.GetPlatformAssertion(target_platform)
variable_map = {
'defs' : defs,
'os': target_platform,
- 'is_linux': platform_assertion == 'is_linux',
- 'is_macosx': platform_assertion == 'is_macosx',
- 'is_win': platform_assertion == 'is_win',
- 'is_android': platform_assertion == 'is_android',
- 'is_ios': platform_assertion == 'is_ios',
- # is_posix is not mutually exclusive of the others
+
+ # One of these is_xyz assertions gets set to True in the line
+ # following this initializer block.
+ 'is_linux': False,
+ 'is_macosx': False,
+ 'is_win': False,
+ 'is_android': False,
+ 'is_ios': False,
+
+ # is_posix is not mutually exclusive of the others and gets
+ # set here, not below.
'is_posix': (target_platform in ('darwin', 'linux2', 'linux3', 'sunos5')
or 'bsd' in sys.platform),
+
'pp_ifdef' : pp_ifdef,
'pp_if' : pp_if,
}
+ variable_map[Node.GetPlatformAssertion(target_platform)] = True
+
if extra_variables:
variable_map.update(extra_variables)
eval_result = cache_dict[expr] = eval(expr, {}, variable_map)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698