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 systems to generate | 6 """This module provides shared functionality for the systems to generate |
7 frog binding from the IDL database.""" | 7 frog binding from the IDL database.""" |
8 | 8 |
9 import os | 9 import os |
10 from generator import * | 10 from generator import * |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 CTOR=self._interface.id, | 308 CTOR=self._interface.id, |
309 TYPE=element_type) | 309 TYPE=element_type) |
310 | 310 |
311 | 311 |
312 def AddOperation(self, info): | 312 def AddOperation(self, info): |
313 """ | 313 """ |
314 Arguments: | 314 Arguments: |
315 info: An OperationInfo object. | 315 info: An OperationInfo object. |
316 """ | 316 """ |
317 # TODO(vsm): Handle overloads. | 317 # TODO(vsm): Handle overloads. |
| 318 params = info.ParametersImplementationDeclaration( |
| 319 lambda type_name: self._NarrowInputType(type_name)) |
| 320 |
| 321 native_body = dom_frog_native_bodies.get( |
| 322 self._interface.id + '.' + info.name, '') |
| 323 if native_body: |
| 324 native_body = " '''" + native_body + "'''" |
| 325 |
318 self._members_emitter.Emit( | 326 self._members_emitter.Emit( |
319 '\n' | 327 '\n' |
320 ' $TYPE $NAME($PARAMS) native;\n', | 328 ' $TYPE $NAME($PARAMS) native$NATIVESTRING;\n', |
321 TYPE=self._NarrowOutputType(info.type_name), | 329 TYPE=self._NarrowOutputType(info.type_name), |
322 NAME=info.name, | 330 NAME=info.name, |
323 PARAMS=info.ParametersImplementationDeclaration( | 331 PARAMS=params, |
324 lambda type_name: self._NarrowInputType(type_name))) | 332 NATIVESTRING=native_body) |
OLD | NEW |