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

Side by Side Diff: mojo/public/tools/bindings/pylib/mojom/parse/translate.py

Issue 265793015: Mojo: Replace RemotePtr with InterfacePtr and InterfaceImpl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 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
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Translates parse tree to Mojom IR.""" 5 """Translates parse tree to Mojom IR."""
6 6
7 7
8 import ast 8 import ast
9 9
10 10
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 struct = {} 81 struct = {}
82 struct['name'] = tree[1] 82 struct['name'] = tree[1]
83 struct['attributes'] = _MapAttributes(tree[2]) 83 struct['attributes'] = _MapAttributes(tree[2])
84 struct['fields'] = _MapTree(_MapField, tree[3], 'FIELD') 84 struct['fields'] = _MapTree(_MapField, tree[3], 'FIELD')
85 struct['enums'] = _MapTree(_MapEnum, tree[3], 'ENUM') 85 struct['enums'] = _MapTree(_MapEnum, tree[3], 'ENUM')
86 return struct 86 return struct
87 87
88 def _MapInterface(tree): 88 def _MapInterface(tree):
89 interface = {} 89 interface = {}
90 interface['name'] = tree[1] 90 interface['name'] = tree[1]
91 interface['peer'] = _GetAttribute(tree[2], 'Peer') 91 interface['client'] = _GetAttribute(tree[2], 'Client')
92 interface['methods'] = _MapTree(_MapMethod, tree[3], 'METHOD') 92 interface['methods'] = _MapTree(_MapMethod, tree[3], 'METHOD')
93 interface['enums'] = _MapTree(_MapEnum, tree[3], 'ENUM') 93 interface['enums'] = _MapTree(_MapEnum, tree[3], 'ENUM')
94 return interface 94 return interface
95 95
96 def _MapEnum(tree): 96 def _MapEnum(tree):
97 enum = {} 97 enum = {}
98 enum['name'] = tree[1] 98 enum['name'] = tree[1]
99 enum['fields'] = _MapTree(_MapEnumField, tree[2], 'ENUM_FIELD') 99 enum['fields'] = _MapTree(_MapEnumField, tree[2], 'ENUM_FIELD')
100 return enum 100 return enum
101 101
(...skipping 21 matching lines...) Expand all
123 modules = [_MapModule(item, name) for item in tree if item[0] == 'MODULE'] 123 modules = [_MapModule(item, name) for item in tree if item[0] == 'MODULE']
124 if len(modules) != 1: 124 if len(modules) != 1:
125 raise Exception('A mojom file must contain exactly 1 module.') 125 raise Exception('A mojom file must contain exactly 1 module.')
126 self.mojom = modules[0] 126 self.mojom = modules[0]
127 self.mojom['imports'] = _MapTree(_MapImport, tree, 'IMPORT') 127 self.mojom['imports'] = _MapTree(_MapImport, tree, 'IMPORT')
128 return self.mojom 128 return self.mojom
129 129
130 130
131 def Translate(tree, name): 131 def Translate(tree, name):
132 return _MojomBuilder().Build(tree, name) 132 return _MojomBuilder().Build(tree, name)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698