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 import emitter | 9 import emitter |
10 import monitored | 10 import monitored |
(...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1004 | 1004 |
1005 declaration = '%s%s%s %s(%s)' % ( | 1005 declaration = '%s%s%s %s(%s)' % ( |
1006 self._Metadata(info.type_name, info.declared_name), | 1006 self._Metadata(info.type_name, info.declared_name), |
1007 'static ' if info.IsStatic() else '', | 1007 'static ' if info.IsStatic() else '', |
1008 return_type, | 1008 return_type, |
1009 html_name, | 1009 html_name, |
1010 info.ParametersDeclaration(InputType)) | 1010 info.ParametersDeclaration(InputType)) |
1011 self._GenerateDispatcherBody( | 1011 self._GenerateDispatcherBody( |
1012 operations, | 1012 operations, |
1013 parameter_names, | 1013 parameter_names, |
| 1014 info.NumberOfRequiredInDart(), |
1014 declaration, | 1015 declaration, |
1015 GenerateCall, | 1016 GenerateCall, |
1016 lambda _, argument: IsOptional(argument), | 1017 lambda _, argument: IsOptional(argument), |
1017 can_omit_type_check=lambda type, pos: type == parameter_types[pos]) | 1018 can_omit_type_check=lambda type, pos: type == parameter_types[pos]) |
1018 | 1019 |
1019 def _AddInterfaceOperation(self, info, html_name): | 1020 def _AddInterfaceOperation(self, info, html_name): |
1020 self._members_emitter.Emit( | 1021 self._members_emitter.Emit( |
1021 '\n' | 1022 '\n' |
1022 ' $TYPE $NAME($PARAMS);\n', | 1023 ' $TYPE $NAME($PARAMS);\n', |
1023 TYPE=self.SecureOutputType(info.type_name), | 1024 TYPE=self.SecureOutputType(info.type_name), |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1174 for library_name in libraries: | 1175 for library_name in libraries: |
1175 self._libraries[library_name] = DartLibrary( | 1176 self._libraries[library_name] = DartLibrary( |
1176 library_name, template_loader, library_type, output_dir) | 1177 library_name, template_loader, library_type, output_dir) |
1177 | 1178 |
1178 def AddFile(self, basename, library_name, path): | 1179 def AddFile(self, basename, library_name, path): |
1179 self._libraries[library_name].AddFile(path) | 1180 self._libraries[library_name].AddFile(path) |
1180 | 1181 |
1181 def Emit(self, emitter, auxiliary_dir): | 1182 def Emit(self, emitter, auxiliary_dir): |
1182 for lib in self._libraries.values(): | 1183 for lib in self._libraries.values(): |
1183 lib.Emit(emitter, auxiliary_dir) | 1184 lib.Emit(emitter, auxiliary_dir) |
OLD | NEW |