OLD | NEW |
---|---|
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 """Generates java source files from a mojom.Module.""" | 5 """Generates java source files from a mojom.Module.""" |
6 | 6 |
7 import argparse | 7 import argparse |
8 import ast | 8 import ast |
9 import os | 9 import os |
10 import re | 10 import re |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
371 "method_ordinal_name": GetMethodOrdinalName, | 371 "method_ordinal_name": GetMethodOrdinalName, |
372 "name": GetNameForElement, | 372 "name": GetNameForElement, |
373 "new_array": NewArray, | 373 "new_array": NewArray, |
374 "response_struct_from_method": GetResponseStructFromMethod, | 374 "response_struct_from_method": GetResponseStructFromMethod, |
375 "struct_from_method": GetStructFromMethod, | 375 "struct_from_method": GetStructFromMethod, |
376 "struct_size": lambda ps: ps.GetTotalSize() + _HEADER_SIZE, | 376 "struct_size": lambda ps: ps.GetTotalSize() + _HEADER_SIZE, |
377 } | 377 } |
378 | 378 |
379 def GetJinjaExports(self): | 379 def GetJinjaExports(self): |
380 return { | 380 return { |
381 "module": self.module, | |
382 "package": GetPackage(self.module), | 381 "package": GetPackage(self.module), |
383 } | 382 } |
384 | 383 |
385 def GetJinjaExportsForInterface(self, interface): | 384 def GetJinjaExportsForInterface(self, interface): |
386 exports = self.GetJinjaExports() | 385 exports = self.GetJinjaExports() |
387 exports.update({"interface": interface}) | 386 exports.update({"interface": interface}) |
388 if interface.client: | 387 if interface.client: |
389 for client in self.module.interfaces: | 388 for client in self.module.interfaces: |
390 if client.name == interface.client: | 389 if client.name == interface.client: |
391 exports.update({"client": client}) | 390 exports.update({"client": client}) |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
451 "%s.java" % GetConstantsMainEntityName(self.module)) | 450 "%s.java" % GetConstantsMainEntityName(self.module)) |
452 | 451 |
453 def GetJinjaParameters(self): | 452 def GetJinjaParameters(self): |
454 return { | 453 return { |
455 'lstrip_blocks': True, | 454 'lstrip_blocks': True, |
456 'trim_blocks': True, | 455 'trim_blocks': True, |
457 } | 456 } |
458 | 457 |
459 def GetGlobals(self): | 458 def GetGlobals(self): |
460 return { | 459 return { |
460 "namespace": self.module.namespace, | |
ppi
2014/09/04 15:32:42
nit: use single quotes to match 'module' below
qsr
2014/09/04 15:48:20
Done.
| |
461 'module': self.module, | 461 'module': self.module, |
462 } | 462 } |
OLD | NEW |