Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(644)

Side by Side Diff: client/dom/scripts/systemnative.py

Issue 9495014: Support Dart optional arguments which are not dispatched, but instead use default values. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rename Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « client/dom/scripts/fremontcutbuilder.py ('k') | client/dom/scripts/systemwrapping.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 native binding from the IDL database.""" 7 native binding from the IDL database."""
8 8
9 import emitter 9 import emitter
10 import os 10 import os
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 CALLBACK_NAME=callback_name, 671 CALLBACK_NAME=callback_name,
672 BODY=body) 672 BODY=body)
673 673
674 def _GenerateParameterAdapter(self, emitter, idl_argument, index): 674 def _GenerateParameterAdapter(self, emitter, idl_argument, index):
675 type_info = GetIDLTypeInfo(idl_argument.type) 675 type_info = GetIDLTypeInfo(idl_argument.type)
676 (adapter_type, include_name) = type_info.parameter_adapter_info() 676 (adapter_type, include_name) = type_info.parameter_adapter_info()
677 if include_name: 677 if include_name:
678 self._cpp_impl_includes[include_name] = 1 678 self._cpp_impl_includes[include_name] = 1
679 flags = '' 679 flags = ''
680 if (idl_argument.ext_attrs.get('Optional') == 'DefaultIsNullString' or 680 if (idl_argument.ext_attrs.get('Optional') == 'DefaultIsNullString' or
681 ('Optional' in idl_argument.ext_attrs and 'Callback' in idl_argument.ext _attrs)): 681 'RequiredCppParameter' in idl_argument.ext_attrs):
682 flags = ', DartUtilities::ConvertNullToDefaultValue' 682 flags = ', DartUtilities::ConvertNullToDefaultValue'
683 emitter.Emit( 683 emitter.Emit(
684 '\n' 684 '\n'
685 ' const $ADAPTER_TYPE $NAME(Dart_GetNativeArgument(args, $INDEX)$ FLAGS);\n' 685 ' const $ADAPTER_TYPE $NAME(Dart_GetNativeArgument(args, $INDEX)$ FLAGS);\n'
686 ' if (!$NAME.conversionSuccessful()) {\n' 686 ' if (!$NAME.conversionSuccessful()) {\n'
687 ' exception = $NAME.exception();\n' 687 ' exception = $NAME.exception();\n'
688 ' goto fail;\n' 688 ' goto fail;\n'
689 ' }\n', 689 ' }\n',
690 ADAPTER_TYPE=adapter_type, 690 ADAPTER_TYPE=adapter_type,
691 NAME=idl_argument.id, 691 NAME=idl_argument.id,
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 ' goto fail;\n' 783 ' goto fail;\n'
784 ' }\n', 784 ' }\n',
785 INVOCATION=invocation_template) 785 INVOCATION=invocation_template)
786 786
787 if 'ImplementedBy' in attributes: 787 if 'ImplementedBy' in attributes:
788 arguments.insert(0, 'receiver') 788 arguments.insert(0, 'receiver')
789 self._cpp_impl_includes[attributes['ImplementedBy']] = 1 789 self._cpp_impl_includes[attributes['ImplementedBy']] = 1
790 790
791 return emitter.Format(invocation_template, 791 return emitter.Format(invocation_template,
792 FUNCTION_CALL='%s(%s)' % (function_expression, ', '.join(arguments))) 792 FUNCTION_CALL='%s(%s)' % (function_expression, ', '.join(arguments)))
OLDNEW
« no previous file with comments | « client/dom/scripts/fremontcutbuilder.py ('k') | client/dom/scripts/systemwrapping.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698