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

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

Issue 514293002: Mojo: validate nullability in Java bindings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
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 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 370
371 371
372 def IsInterfaceRequestKind(kind): 372 def IsInterfaceRequestKind(kind):
373 return isinstance(kind, InterfaceRequest) 373 return isinstance(kind, InterfaceRequest)
374 374
375 375
376 def IsEnumKind(kind): 376 def IsEnumKind(kind):
377 return isinstance(kind, Enum) 377 return isinstance(kind, Enum)
378 378
379 379
380 def IsReferenceKind(kind):
381 return isinstance(kind, ReferenceKind)
382
383
380 def IsNullableKind(kind): 384 def IsNullableKind(kind):
381 return isinstance(kind, ReferenceKind) and kind.is_nullable 385 return isinstance(kind, ReferenceKind) and kind.is_nullable
qsr 2014/08/29 07:56:20 Maybe reuse your new method here.
ppi 2014/08/29 14:03:34 Done.
382 386
383 387
384 def IsAnyArrayKind(kind): 388 def IsAnyArrayKind(kind):
385 return IsArrayKind(kind) or IsFixedArrayKind(kind) 389 return IsArrayKind(kind) or IsFixedArrayKind(kind)
386 390
387 391
388 def IsObjectKind(kind): 392 def IsObjectKind(kind):
389 return IsStructKind(kind) or IsAnyArrayKind(kind) or IsStringKind(kind) 393 return IsStructKind(kind) or IsAnyArrayKind(kind) or IsStringKind(kind)
390 394
391 395
(...skipping 14 matching lines...) Expand all
406 def IsMoveOnlyKind(kind): 410 def IsMoveOnlyKind(kind):
407 return IsObjectKind(kind) or IsAnyHandleKind(kind) 411 return IsObjectKind(kind) or IsAnyHandleKind(kind)
408 412
409 413
410 def HasCallbacks(interface): 414 def HasCallbacks(interface):
411 for method in interface.methods: 415 for method in interface.methods:
412 if method.response_parameters != None: 416 if method.response_parameters != None:
413 return True 417 return True
414 return False 418 return False
415 419
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698