| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 3 # for details. All rights reserved. Use of this source code is governed by a | 3 # for details. All rights reserved. Use of this source code is governed by a |
| 4 # BSD-style license that can be found in the LICENSE file. | 4 # BSD-style license that can be found in the LICENSE file. |
| 5 | 5 |
| 6 """This module provides shared functionality for the system to generate | 6 """This module provides shared functionality for the system to generate |
| 7 Dart:html APIs from the IDL database.""" | 7 Dart:html APIs from the IDL database.""" |
| 8 | 8 |
| 9 from systemfrog import * | 9 from systemfrog import * |
| 10 from systeminterface import * | 10 from systeminterface import * |
| (...skipping 1559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1570 | 1570 |
| 1571 # Process in order of ascending number of arguments to ensure missing | 1571 # Process in order of ascending number of arguments to ensure missing |
| 1572 # optional arguments are processed early. | 1572 # optional arguments are processed early. |
| 1573 overloads = sorted(info.overloads, | 1573 overloads = sorted(info.overloads, |
| 1574 key=lambda overload: len(overload.arguments)) | 1574 key=lambda overload: len(overload.arguments)) |
| 1575 self._native_version = 0 | 1575 self._native_version = 0 |
| 1576 fallthrough = self.GenerateDispatch(body, info, ' ', 0, overloads) | 1576 fallthrough = self.GenerateDispatch(body, info, ' ', 0, overloads) |
| 1577 if fallthrough: | 1577 if fallthrough: |
| 1578 body.Emit(' throw "Incorrect number or type of arguments";\n'); | 1578 body.Emit(' throw "Incorrect number or type of arguments";\n'); |
| 1579 | 1579 |
| 1580 def AddStaticOperation(self, info): |
| 1581 pass |
| 1582 |
| 1580 def GenerateSingleOperation(self, emitter, info, indent, operation): | 1583 def GenerateSingleOperation(self, emitter, info, indent, operation): |
| 1581 """Generates a call to a single operation. | 1584 """Generates a call to a single operation. |
| 1582 | 1585 |
| 1583 Arguments: | 1586 Arguments: |
| 1584 emitter: an Emitter for the body of a block of code. | 1587 emitter: an Emitter for the body of a block of code. |
| 1585 info: the compound information about the operation and its overloads. | 1588 info: the compound information about the operation and its overloads. |
| 1586 indent: an indentation string for generated code. | 1589 indent: an indentation string for generated code. |
| 1587 operation: the IDLOperation to call. | 1590 operation: the IDLOperation to call. |
| 1588 """ | 1591 """ |
| 1589 argument_expressions = self._UnwrappedParameters( | 1592 argument_expressions = self._UnwrappedParameters( |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1697 # dispatch has removed f(X), leaving only f(Y), but there is no guarantee | 1700 # dispatch has removed f(X), leaving only f(Y), but there is no guarantee |
| 1698 # that Y = Z-X, so we need to check for Y. | 1701 # that Y = Z-X, so we need to check for Y. |
| 1699 true_code = emitter.Emit( | 1702 true_code = emitter.Emit( |
| 1700 '$(INDENT)if ($COND) {\n' | 1703 '$(INDENT)if ($COND) {\n' |
| 1701 '$!TRUE' | 1704 '$!TRUE' |
| 1702 '$(INDENT)}\n', | 1705 '$(INDENT)}\n', |
| 1703 COND=test, INDENT=indent) | 1706 COND=test, INDENT=indent) |
| 1704 self.GenerateDispatch( | 1707 self.GenerateDispatch( |
| 1705 true_code, info, indent + ' ', position + 1, positive) | 1708 true_code, info, indent + ' ', position + 1, positive) |
| 1706 return True | 1709 return True |
| OLD | NEW |