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

Unified Diff: mojo/public/bindings/parser/mojo_translate.py

Issue 65933002: Mojo: Unify the disparate source and header files into 3 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Mistaken /n's Created 7 years, 1 month 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 | « mojo/public/bindings/mojo_idl.py ('k') | mojo/public/bindings/sample/sample_service.mojom » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/bindings/parser/mojo_translate.py
diff --git a/mojo/public/bindings/parser/mojo_translate.py b/mojo/public/bindings/parser/mojo_translate.py
index 46aa071c487504392178dfaceb407b5c21e0a22b..d476ac031625ed75d3714ff409524fc0eaa9c0e2 100755
--- a/mojo/public/bindings/parser/mojo_translate.py
+++ b/mojo/public/bindings/parser/mojo_translate.py
@@ -82,9 +82,9 @@ class MojomBuilder():
interface['methods'] = MapMethods(methods)
self.mojom['interfaces'].append(interface)
- def AddModule(self, name, contents):
+ def AddModule(self, name, namespace, contents):
self.mojom['name'] = name
- self.mojom['namespace'] = name
+ self.mojom['namespace'] = namespace
self.mojom['structs'] = []
self.mojom['interfaces'] = []
for item in contents:
@@ -93,14 +93,14 @@ class MojomBuilder():
elif item[0] == 'INTERFACE':
self.AddInterface(name=item[1], methods=item[2])
- def Build(self, tree):
+ def Build(self, tree, name):
if tree[0] == 'MODULE':
- self.AddModule(name=tree[1], contents=tree[2])
+ self.AddModule(name=name, namespace=tree[1], contents=tree[2])
return self.mojom
-def Translate(tree):
- return MojomBuilder().Build(tree)
+def Translate(tree, name):
+ return MojomBuilder().Build(tree, name)
def Main():
@@ -108,7 +108,8 @@ def Main():
print("usage: %s filename" % (sys.argv[0]))
sys.exit(1)
tree = eval(open(sys.argv[1]).read())
- result = Translate(tree)
+ name = os.path.splitext(os.path.basename(sys.argv[1]))[0]
+ result = Translate(tree, name)
print(result)
« no previous file with comments | « mojo/public/bindings/mojo_idl.py ('k') | mojo/public/bindings/sample/sample_service.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698