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

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: snapshot 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 struct['name'] = tree[1] 76 struct['name'] = tree[1]
77 # TODO(darin): Add support for |attributes| 77 # TODO(darin): Add support for |attributes|
78 #struct['attributes'] = MapAttributes(tree[2]) 78 #struct['attributes'] = MapAttributes(tree[2])
79 struct['fields'] = _MapTree(_MapField, tree[3], 'FIELD') 79 struct['fields'] = _MapTree(_MapField, tree[3], 'FIELD')
80 struct['enums'] = _MapTree(_MapEnum, tree[3], 'ENUM') 80 struct['enums'] = _MapTree(_MapEnum, tree[3], 'ENUM')
81 return struct 81 return struct
82 82
83 def _MapInterface(tree): 83 def _MapInterface(tree):
84 interface = {} 84 interface = {}
85 interface['name'] = tree[1] 85 interface['name'] = tree[1]
86 interface['peer'] = _GetAttribute(tree[2], 'Peer') 86 interface['client'] = _GetAttribute(tree[2], 'Client')
87 interface['methods'] = _MapTree(_MapMethod, tree[3], 'METHOD') 87 interface['methods'] = _MapTree(_MapMethod, tree[3], 'METHOD')
88 interface['enums'] = _MapTree(_MapEnum, tree[3], 'ENUM') 88 interface['enums'] = _MapTree(_MapEnum, tree[3], 'ENUM')
89 return interface 89 return interface
90 90
91 def _MapEnum(tree): 91 def _MapEnum(tree):
92 enum = {} 92 enum = {}
93 enum['name'] = tree[1] 93 enum['name'] = tree[1]
94 enum['fields'] = _MapTree(_MapEnumField, tree[2], 'ENUM_FIELD') 94 enum['fields'] = _MapTree(_MapEnumField, tree[2], 'ENUM_FIELD')
95 return enum 95 return enum
96 96
(...skipping 20 matching lines...) Expand all
117 modules = [_MapModule(item, name) for item in tree if item[0] == 'MODULE'] 117 modules = [_MapModule(item, name) for item in tree if item[0] == 'MODULE']
118 if len(modules) != 1: 118 if len(modules) != 1:
119 raise Exception('A mojom file must contain exactly 1 module.') 119 raise Exception('A mojom file must contain exactly 1 module.')
120 self.mojom = modules[0] 120 self.mojom = modules[0]
121 self.mojom['imports'] = _MapTree(_MapImport, tree, 'IMPORT') 121 self.mojom['imports'] = _MapTree(_MapImport, tree, 'IMPORT')
122 return self.mojom 122 return self.mojom
123 123
124 124
125 def Translate(tree, name): 125 def Translate(tree, name):
126 return _MojomBuilder().Build(tree, name) 126 return _MojomBuilder().Build(tree, name)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698