| 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 from generator import AnalyzeOperation, ConstantOutputOrder, \ | 10 from generator import AnalyzeOperation, ConstantOutputOrder, \ |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 ' }\n', | 421 ' }\n', |
| 422 CTOR=constructor_info._ConstructorFullName(self._DartType), | 422 CTOR=constructor_info._ConstructorFullName(self._DartType), |
| 423 PARAMS=constructor_info.ParametersDeclaration(self._DartType), | 423 PARAMS=constructor_info.ParametersDeclaration(self._DartType), |
| 424 FACTORY=factory_name, | 424 FACTORY=factory_name, |
| 425 ANNOTATIONS=annotations, | 425 ANNOTATIONS=annotations, |
| 426 FACTORY_PARAMS=constructor_info.ParametersAsArgumentList()) | 426 FACTORY_PARAMS=constructor_info.ParametersAsArgumentList()) |
| 427 | 427 |
| 428 for index, param_info in enumerate(constructor_info.param_infos): | 428 for index, param_info in enumerate(constructor_info.param_infos): |
| 429 if param_info.is_optional: | 429 if param_info.is_optional: |
| 430 dispatcher_emitter.Emit( | 430 dispatcher_emitter.Emit( |
| 431 ' if (!?$OPT_PARAM_NAME) {\n' | 431 ' if ($OPT_PARAM_NAME == null) {\n' |
| 432 ' return $FACTORY._create($FACTORY_PARAMS);\n' | 432 ' return $FACTORY._create($FACTORY_PARAMS);\n' |
| 433 ' }\n', | 433 ' }\n', |
| 434 OPT_PARAM_NAME=param_info.name, | 434 OPT_PARAM_NAME=param_info.name, |
| 435 FACTORY=factory_name, | 435 FACTORY=factory_name, |
| 436 FACTORY_PARAMS=constructor_info.ParametersAsArgumentList(index)) | 436 FACTORY_PARAMS=constructor_info.ParametersAsArgumentList(index)) |
| 437 else: | 437 else: |
| 438 inits = self._members_emitter.Emit( | 438 inits = self._members_emitter.Emit( |
| 439 '\n $(ANNOTATIONS)' | 439 '\n $(ANNOTATIONS)' |
| 440 'factory $CONSTRUCTOR($PARAMS) {\n' | 440 'factory $CONSTRUCTOR($PARAMS) {\n' |
| 441 ' var e = $FACTORY.$CTOR_FACTORY_NAME($FACTORY_PARAMS);\n' | 441 ' var e = $FACTORY.$CTOR_FACTORY_NAME($FACTORY_PARAMS);\n' |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 634 walk(interface.parents) | 634 walk(interface.parents) |
| 635 else: | 635 else: |
| 636 walk(interface.parents[1:]) | 636 walk(interface.parents[1:]) |
| 637 return result | 637 return result |
| 638 | 638 |
| 639 def _DartType(self, type_name): | 639 def _DartType(self, type_name): |
| 640 return self._type_registry.DartType(type_name) | 640 return self._type_registry.DartType(type_name) |
| 641 | 641 |
| 642 def _IsPrivate(self, name): | 642 def _IsPrivate(self, name): |
| 643 return name.startswith('_') | 643 return name.startswith('_') |
| OLD | NEW |