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

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

Issue 1539673003: Generate Mojom Types in Dart (Take 2) (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: All Short Names use unsafe GetElementForName Created 4 years, 11 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 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 462
463 463
464 def IsBoolKind(kind): 464 def IsBoolKind(kind):
465 return kind.spec == BOOL.spec 465 return kind.spec == BOOL.spec
466 466
467 467
468 def IsFloatKind(kind): 468 def IsFloatKind(kind):
469 return kind.spec == FLOAT.spec 469 return kind.spec == FLOAT.spec
470 470
471 471
472 def IsDoubleKind(kind):
473 return kind.spec == DOUBLE.spec
474
475
472 def IsIntegralKind(kind): 476 def IsIntegralKind(kind):
473 return (kind.spec == BOOL.spec or 477 return (kind.spec == BOOL.spec or
474 kind.spec == INT8.spec or 478 kind.spec == INT8.spec or
475 kind.spec == INT16.spec or 479 kind.spec == INT16.spec or
476 kind.spec == INT32.spec or 480 kind.spec == INT32.spec or
477 kind.spec == INT64.spec or 481 kind.spec == INT64.spec or
478 kind.spec == UINT8.spec or 482 kind.spec == UINT8.spec or
479 kind.spec == UINT16.spec or 483 kind.spec == UINT16.spec or
480 kind.spec == UINT32.spec or 484 kind.spec == UINT32.spec or
481 kind.spec == UINT64.spec) 485 kind.spec == UINT64.spec)
482 486
487 def IsNumericalKind(kind):
488 return (IsBoolKind(kind) or
489 IsFloatKind(kind) or
490 IsDoubleKind(kind) or
491 IsIntegralKind(kind))
483 492
484 def IsStringKind(kind): 493 def IsStringKind(kind):
485 return kind.spec == STRING.spec or kind.spec == NULLABLE_STRING.spec 494 return kind.spec == STRING.spec or kind.spec == NULLABLE_STRING.spec
486 495
487 496
488 def IsGenericHandleKind(kind): 497 def IsGenericHandleKind(kind):
489 return kind.spec == HANDLE.spec or kind.spec == NULLABLE_HANDLE.spec 498 return kind.spec == HANDLE.spec or kind.spec == NULLABLE_HANDLE.spec
490 499
491 500
492 def IsDataPipeConsumerKind(kind): 501 def IsDataPipeConsumerKind(kind):
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 return False 597 return False
589 598
590 return not ContainsHandles(kind, set()) 599 return not ContainsHandles(kind, set())
591 600
592 601
593 def HasCallbacks(interface): 602 def HasCallbacks(interface):
594 for method in interface.methods: 603 for method in interface.methods:
595 if method.response_parameters != None: 604 if method.response_parameters != None:
596 return True 605 return True
597 return False 606 return False
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698