Skip to content

Commit eb93dea

Browse files
authored
Merge pull request swiftlang#38769 from gottesmm/pr-b89358c8a643806e06a6aaa2b1181d3ba3ac9b93
[build-script] Add the ability to set a value on StageArgs
2 parents a3ba517 + d0ad980 commit eb93dea

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

utils/swift_build_support/swift_build_support/compiler_stage.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,25 @@
1212

1313
class StageArgs(object):
1414
def __init__(self, stage, args):
15-
self.stage = stage
16-
self.args = args
15+
self.__dict__['postfix'] = stage.postfix
16+
self.__dict__['stage'] = stage
17+
self.__dict__['args'] = args
18+
assert(not isinstance(self.args, StageArgs))
19+
20+
def _get_stage_prefix(self):
21+
return self.__dict__['postfix']
1722

1823
def __getattr__(self, key):
19-
real_key = '{}{}'.format(key, self.stage.postfix)
20-
if not hasattr(self.args, real_key):
24+
real_key = '{}{}'.format(key, self._get_stage_prefix())
25+
args = self.__dict__['args']
26+
if not hasattr(args, real_key):
2127
return None
22-
return getattr(self.args, real_key)
28+
return getattr(args, real_key)
29+
30+
def __setattr__(self, key, value):
31+
real_key = '{}{}'.format(key, self._get_stage_prefix())
32+
args = self.__dict__['args']
33+
setattr(args, real_key, value)
2334

2435

2536
class Stage(object):

0 commit comments

Comments
 (0)