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

Side by Side Diff: mojo/public/tools/bindings/pylib/mojom/generate/module.py

Issue 1515423002: [mojo] Add mojom parser support for native-only structs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pickle2
Patch Set: oops Created 5 years 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
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 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 # This module's classes provide an interface to mojo modules. Modules are 5 # This module's classes provide an interface to mojo modules. Modules are
6 # collections of interfaces and structs to be used by mojo ipc clients and 6 # collections of interfaces and structs to be used by mojo ipc clients and
7 # servers. 7 # servers.
8 # 8 #
9 # A simple interface would be created this way: 9 # A simple interface would be created this way:
10 # module = mojom.generate.module.Module('Foo') 10 # module = mojom.generate.module.Module('Foo')
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 195
196 196
197 class StructField(Field): pass 197 class StructField(Field): pass
198 198
199 199
200 class UnionField(Field): pass 200 class UnionField(Field): pass
201 201
202 202
203 class Struct(ReferenceKind): 203 class Struct(ReferenceKind):
204 ReferenceKind.AddSharedProperty('name') 204 ReferenceKind.AddSharedProperty('name')
205 ReferenceKind.AddSharedProperty('native_only')
205 ReferenceKind.AddSharedProperty('module') 206 ReferenceKind.AddSharedProperty('module')
206 ReferenceKind.AddSharedProperty('imported_from') 207 ReferenceKind.AddSharedProperty('imported_from')
207 ReferenceKind.AddSharedProperty('fields') 208 ReferenceKind.AddSharedProperty('fields')
208 ReferenceKind.AddSharedProperty('attributes') 209 ReferenceKind.AddSharedProperty('attributes')
209 210
210 def __init__(self, name=None, module=None, attributes=None): 211 def __init__(self, name=None, module=None, attributes=None):
211 if name is not None: 212 if name is not None:
212 spec = 'x:' + name 213 spec = 'x:' + name
213 else: 214 else:
214 spec = None 215 spec = None
215 ReferenceKind.__init__(self, spec) 216 ReferenceKind.__init__(self, spec)
216 self.name = name 217 self.name = name
218 self.native_only = False
217 self.module = module 219 self.module = module
218 self.imported_from = None 220 self.imported_from = None
219 self.fields = [] 221 self.fields = []
220 self.attributes = attributes 222 self.attributes = attributes
221 223
222 def AddField(self, name, kind, ordinal=None, default=None, attributes=None): 224 def AddField(self, name, kind, ordinal=None, default=None, attributes=None):
223 field = StructField(name, kind, ordinal, default, attributes) 225 field = StructField(name, kind, ordinal, default, attributes)
224 self.fields.append(field) 226 self.fields.append(field)
225 return field 227 return field
226 228
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 visited_kinds = set() 647 visited_kinds = set()
646 for method in interface.methods: 648 for method in interface.methods:
647 for param in method.parameters: 649 for param in method.parameters:
648 if _ContainsAssociatedKinds(param.kind, visited_kinds): 650 if _ContainsAssociatedKinds(param.kind, visited_kinds):
649 return True 651 return True
650 if method.response_parameters != None: 652 if method.response_parameters != None:
651 for param in method.response_parameters: 653 for param in method.response_parameters:
652 if _ContainsAssociatedKinds(param.kind, visited_kinds): 654 if _ContainsAssociatedKinds(param.kind, visited_kinds):
653 return True 655 return True
654 return False 656 return False
OLDNEW
« no previous file with comments | « mojo/public/tools/bindings/pylib/mojom/generate/data.py ('k') | mojo/public/tools/bindings/pylib/mojom/parse/ast.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698