From 89141eec1148ba8d578bf295dfeb3f763a636d93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Lemoine?= Date: Mon, 16 Dec 2013 22:31:32 +0100 Subject: [PATCH] Remove export_as handling from generate-exports.py --- bin/generate-exports.py | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/bin/generate-exports.py b/bin/generate-exports.py index e33eba5fc73..3e864df72a6 100755 --- a/bin/generate-exports.py +++ b/bin/generate-exports.py @@ -85,10 +85,9 @@ def typedef(self): class Symbol(Exportable): - def __init__(self, name, export_symbol, export_as=None): + def __init__(self, name, export_symbol): Exportable.__init__(self, name) self.export_symbol = export_symbol - self.export_as = export_as or self.name self.props = set() __repr__ = simplerepr @@ -96,7 +95,7 @@ def __init__(self, name, export_symbol, export_as=None): def export(self): lines = [] if self.export_symbol: - lines.append('\n\ngoog.exportSymbol(\n \'%s\',\n %s);\n' % (self.name, self.export_as)) + lines.append('\n\ngoog.exportSymbol(\n \'%s\',\n %s);\n' % (self.name, self.name)) lines.extend('goog.exportProperty(\n %s,\n \'%s\',\n %s.%s);\n' % (self.name, prop, self.name, prop) for prop in sorted(self.props)) return ''.join(lines) @@ -165,20 +164,18 @@ def main(argv): objects[name] = symbol symbol.props.add(prop) continue - m = re.match(r'@exportSymbol\s+(?P\S+)(?:\s+(?P\S+))?\Z', line) + m = re.match(r'@exportSymbol\s+(?P\S+)\Z', line) if m: name = m.group('name') if name in objects: raise RuntimeError(line) # Name already defined - export_as = m.group('export_as') - symbol = Symbol(name, True, export_as) + symbol = Symbol(name, True) objects[name] = symbol - if not export_as: - components = m.group('name').split('.') - if re.match(r'[A-Z]', components[-1]): - requires.add(name) - elif len(components) > 1: - requires.add('.'.join(components[:-1])) + components = m.group('name').split('.') + if re.match(r'[A-Z]', components[-1]): + requires.add(name) + else: + requires.add('.'.join(components[:-1])) continue raise RuntimeError(line)