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 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 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 | 387 |
388 def ImplementsMergedMembers(self): | 388 def ImplementsMergedMembers(self): |
389 # We could not add merged functions to implementation class because | 389 # We could not add merged functions to implementation class because |
390 # underlying c++ object doesn't implement them. Merged functions are | 390 # underlying c++ object doesn't implement them. Merged functions are |
391 # generated on merged interface implementation instead. | 391 # generated on merged interface implementation instead. |
392 return False | 392 return False |
393 | 393 |
394 def CustomJSMembers(self): | 394 def CustomJSMembers(self): |
395 return {} | 395 return {} |
396 | 396 |
397 def _InputConversion(self, idl_type, member): | 397 def _InputConversion(self, type_name, info): |
398 return FindConversion(idl_type, 'set', self._interface.id, member) | 398 return None |
399 | 399 |
400 def GenerateCallback(self, info): | 400 def GenerateCallback(self, info): |
401 if IsPureInterface(self._interface.id) or IsCustomType(self._interface.id): | 401 if IsPureInterface(self._interface.id) or IsCustomType(self._interface.id): |
402 return | 402 return |
403 | 403 |
404 interface = self._interface | 404 interface = self._interface |
405 if interface.parents: | 405 if interface.parents: |
406 supertype = '%sClassId' % interface.parents[0].type.id | 406 supertype = '%sClassId' % interface.parents[0].type.id |
407 else: | 407 else: |
408 supertype = '-1' | 408 supertype = '-1' |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
638 | 638 |
639 # Then we emit the impedance matching wrapper to call out to the | 639 # Then we emit the impedance matching wrapper to call out to the |
640 # toplevel wrapper | 640 # toplevel wrapper |
641 if not emit_to_native: | 641 if not emit_to_native: |
642 toplevel_name = \ | 642 toplevel_name = \ |
643 self.DeriveQualifiedBlinkName(self._interface.id, | 643 self.DeriveQualifiedBlinkName(self._interface.id, |
644 dart_native_name) | 644 dart_native_name) |
645 self._members_emitter.Emit( | 645 self._members_emitter.Emit( |
646 '\n @DocsEditable()\n' | 646 '\n @DocsEditable()\n' |
647 ' static $INTERFACE_NAME $FACTORY_METHOD_NAME($PARAMETERS) => ' | 647 ' static $INTERFACE_NAME $FACTORY_METHOD_NAME($PARAMETERS) => ' |
648 'wrap_jso($TOPLEVEL_NAME($OUTPARAMETERS));\n', | 648 '$TOPLEVEL_NAME($OUTPARAMETERS);\n', |
649 INTERFACE_NAME=self._interface_type_info.interface_name(), | 649 INTERFACE_NAME=self._interface_type_info.interface_name(), |
650 FACTORY_METHOD_NAME=factory_method_name, | 650 FACTORY_METHOD_NAME=factory_method_name, |
651 PARAMETERS=typed_formals, | 651 PARAMETERS=typed_formals, |
652 TOPLEVEL_NAME=toplevel_name, | 652 TOPLEVEL_NAME=toplevel_name, |
653 OUTPARAMETERS=parameters) | 653 OUTPARAMETERS=parameters) |
654 | 654 |
655 self._cpp_resolver_emitter.Emit( | 655 self._cpp_resolver_emitter.Emit( |
656 ' if (name == "$ID")\n' | 656 ' if (name == "$ID")\n' |
657 ' return Dart$(WEBKIT_INTERFACE_NAME)Internal::$CPP_CALLBACK;\n', | 657 ' return Dart$(WEBKIT_INTERFACE_NAME)Internal::$CPP_CALLBACK;\n', |
658 ID=constructor_callback_id, | 658 ID=constructor_callback_id, |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
907 | 907 |
908 def _GenerateAutoSetupScope(self, idl_name, native_suffix): | 908 def _GenerateAutoSetupScope(self, idl_name, native_suffix): |
909 return (self._interface.id, idl_name, native_suffix) not in _cpp_no_auto_sco
pe_list | 909 return (self._interface.id, idl_name, native_suffix) not in _cpp_no_auto_sco
pe_list |
910 | 910 |
911 def _AddGetter(self, attr, html_name, read_only): | 911 def _AddGetter(self, attr, html_name, read_only): |
912 # Temporary hack to force dart:scalarlist clamped array for ImageData.data. | 912 # Temporary hack to force dart:scalarlist clamped array for ImageData.data. |
913 # TODO(antonm): solve in principled way. | 913 # TODO(antonm): solve in principled way. |
914 if self._interface.id == 'ImageData' and html_name == 'data': | 914 if self._interface.id == 'ImageData' and html_name == 'data': |
915 html_name = '_data' | 915 html_name = '_data' |
916 type_info = self._TypeInfo(attr.type.id) | 916 type_info = self._TypeInfo(attr.type.id) |
917 return_type = self.SecureOutputType(attr.type.id, False, False if self._dart
_use_blink else True) | 917 return_type = self.SecureOutputType(attr.type.id, False, read_only) |
918 parameters = [] | 918 parameters = [] |
919 dart_declaration = '%s get %s' % (return_type, html_name) | 919 dart_declaration = '%s get %s' % (return_type, html_name) |
920 is_custom = _IsCustom(attr) and (_IsCustomValue(attr, None) or | 920 is_custom = _IsCustom(attr) and (_IsCustomValue(attr, None) or |
921 _IsCustomValue(attr, 'Getter')) | 921 _IsCustomValue(attr, 'Getter')) |
922 | 922 |
923 # Operation uses blink? | 923 # Operation uses blink? |
924 wrap_unwrap_list = []; | 924 wrap_unwrap_list = []; |
925 return_wrap_jso = False | 925 return_wrap_jso = False |
926 if self._dart_use_blink: | 926 if self._dart_use_blink: |
927 # Unwrap the type to get the JsObject if Type is: | 927 # Unwrap the type to get the JsObject if Type is: |
928 # | 928 # |
929 # - known IDL type | 929 # - known IDL type |
930 # - type_id is None then it's probably a union type or overloaded | 930 # - type_id is None then it's probably a union type or overloaded |
931 # it's a dynamic/any type | 931 # it's a dynamic/any type |
932 # - type is Object | 932 # - type is Object |
933 # | 933 # |
934 # JsObject maybe stored in the Dart class. | 934 # JsObject maybe stored in the Dart class. |
935 return_wrap_jso = wrap_return_type_blink(return_type, attr.type.id, self
._type_registry) | 935 return_wrap_jso = (isinstance(type_info, InterfaceIDLTypeInfo) or |
| 936 not(type_info) or attr.type.id == 'Object') |
936 wrap_unwrap_list.append(return_wrap_jso) # wrap_jso the returned objec
t | 937 wrap_unwrap_list.append(return_wrap_jso) # wrap_jso the returned objec
t |
937 wrap_unwrap_list.append(self._dart_use_blink) # this must be unwrap_jso | 938 wrap_unwrap_list.append(self._dart_use_blink) # this must be unwrap_jso |
938 | 939 |
939 # This seems to have been replaced with Custom=Getter (see above), but | 940 # This seems to have been replaced with Custom=Getter (see above), but |
940 # check to be sure we don't see the old syntax | 941 # check to be sure we don't see the old syntax |
941 assert(not ('CustomGetter' in attr.ext_attrs)) | 942 assert(not ('CustomGetter' in attr.ext_attrs)) |
942 native_suffix = 'Getter' | 943 native_suffix = 'Getter' |
943 auto_scope_setup = self._GenerateAutoSetupScope(attr.id, native_suffix) | 944 auto_scope_setup = self._GenerateAutoSetupScope(attr.id, native_suffix) |
944 native_entry = \ | 945 native_entry = \ |
945 self.DeriveNativeEntry(attr.id, 'Getter', None) | 946 self.DeriveNativeEntry(attr.id, 'Getter', None) |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
988 ptype = self._DartType(attr.type.id) | 989 ptype = self._DartType(attr.type.id) |
989 | 990 |
990 type_info = self._TypeInfo(attr.type.id) | 991 type_info = self._TypeInfo(attr.type.id) |
991 | 992 |
992 # Is the setter value a DartClass (that has a JsObject) or the type is | 993 # Is the setter value a DartClass (that has a JsObject) or the type is |
993 # None (it's a dynamic/any type) then unwrap_jso before passing to blink. | 994 # None (it's a dynamic/any type) then unwrap_jso before passing to blink. |
994 parameters = ['unwrap_jso(value)' if (isinstance(type_info, InterfaceIDLType
Info) or | 995 parameters = ['unwrap_jso(value)' if (isinstance(type_info, InterfaceIDLType
Info) or |
995 not(attr.type.id) or ptype == 'Object'
) | 996 not(attr.type.id) or ptype == 'Object'
) |
996 else 'value'] | 997 else 'value'] |
997 | 998 |
998 dart_declaration = 'set %s(%s value)' % (html_name, ptype) | 999 dart_declaration = 'void set %s(%s value)' % (html_name, ptype) |
999 is_custom = _IsCustom(attr) and (_IsCustomValue(attr, None) or | 1000 is_custom = _IsCustom(attr) and (_IsCustomValue(attr, None) or |
1000 _IsCustomValue(attr, 'Setter')) | 1001 _IsCustomValue(attr, 'Setter')) |
1001 # This seems to have been replaced with Custom=Setter (see above), but | 1002 # This seems to have been replaced with Custom=Setter (see above), but |
1002 # check to be sure we don't see the old syntax | 1003 # check to be sure we don't see the old syntax |
1003 assert(not ('CustomSetter' in attr.ext_attrs)) | 1004 assert(not ('CustomSetter' in attr.ext_attrs)) |
1004 assert(not ('V8CustomSetter' in attr.ext_attrs)) | 1005 assert(not ('V8CustomSetter' in attr.ext_attrs)) |
1005 native_suffix = 'Setter' | 1006 native_suffix = 'Setter' |
1006 auto_scope_setup = self._GenerateAutoSetupScope(attr.id, native_suffix) | 1007 auto_scope_setup = self._GenerateAutoSetupScope(attr.id, native_suffix) |
1007 native_entry = \ | 1008 native_entry = \ |
1008 self.DeriveNativeEntry(attr.id, 'Setter', None) | 1009 self.DeriveNativeEntry(attr.id, 'Setter', None) |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1078 # Emit the method which calls the toplevel function, along with | 1079 # Emit the method which calls the toplevel function, along with |
1079 # the [] operator. | 1080 # the [] operator. |
1080 dart_qualified_name = \ | 1081 dart_qualified_name = \ |
1081 self.DeriveQualifiedBlinkName(self._interface.id, | 1082 self.DeriveQualifiedBlinkName(self._interface.id, |
1082 dart_native_name) | 1083 dart_native_name) |
1083 | 1084 |
1084 type_info = self._TypeInfo(element_type) | 1085 type_info = self._TypeInfo(element_type) |
1085 # Does nativeIndexGetter return a DartClass (JsObject) if so wrap_jso. | 1086 # Does nativeIndexGetter return a DartClass (JsObject) if so wrap_jso. |
1086 wrap_jso_start = '' | 1087 wrap_jso_start = '' |
1087 wrap_jso_end = '' | 1088 wrap_jso_end = '' |
1088 if (isinstance(type_info, InterfaceIDLTypeInfo) or | 1089 if isinstance(type_info, InterfaceIDLTypeInfo): |
1089 wrap_type_blink(type_info.narrow_dart_type(), self._type_registry)): | |
1090 wrap_jso_start = 'wrap_jso(' | 1090 wrap_jso_start = 'wrap_jso(' |
1091 wrap_jso_end = ')' | 1091 wrap_jso_end = ')' |
1092 blinkNativeIndexed = """ | 1092 blinkNativeIndexed = """ |
1093 $TYPE operator[](int index) { | 1093 $TYPE operator[](int index) { |
1094 if (index < 0 || index >= length) | 1094 if (index < 0 || index >= length) |
1095 throw new RangeError.index(index, this); | 1095 throw new RangeError.index(index, this); |
1096 return %s$(DART_NATIVE_NAME)(unwrap_jso(this), index)%s; | 1096 return %s$(DART_NATIVE_NAME)(unwrap_jso(this), index)%s; |
1097 } | 1097 } |
1098 | 1098 |
1099 $TYPE _nativeIndexedGetter(int index) => %s$(DART_NATIVE_NAME)(unwrap_jso(this
), index)%s; | 1099 $TYPE _nativeIndexedGetter(int index) => %s$(DART_NATIVE_NAME)(unwrap_jso(this
), index)%s; |
1100 """ % (wrap_jso_start, wrap_jso_end, wrap_jso_start, wrap_jso_end) | 1100 """ % (wrap_jso_start, wrap_jso_end, wrap_jso_start, wrap_jso_end) |
1101 # Wrap the type to store the JsObject if Type is: | 1101 # Wrap the type to store the JsObject if Type is: |
1102 # | 1102 # |
1103 # - known IDL type | 1103 # - known IDL type |
1104 # - type_id is None then it's probably a union type or overloaded | 1104 # - type_id is None then it's probably a union type or overloaded |
1105 # it's a dynamic/any type | 1105 # it's a dynamic/any type |
1106 # - type is Object | 1106 # - type is Object |
1107 # | 1107 # |
1108 # JsObject maybe stored in the Dart class. | 1108 # JsObject maybe stored in the Dart class. |
1109 if isinstance(type_info, InterfaceIDLTypeInfo) or not(type_info) or dart_e
lement_type == 'Object': | 1109 if isinstance(type_info, InterfaceIDLTypeInfo) or not(type_info) or dart_e
lement_type == 'Object': |
1110 blinkNativeIndexedGetter = \ | 1110 blinkNativeIndexedGetter = \ |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1182 dart_declaration = 'void operator[]=(%s)' % formals | 1182 dart_declaration = 'void operator[]=(%s)' % formals |
1183 self._GenerateNativeBinding('numericIndexSetter', 3, | 1183 self._GenerateNativeBinding('numericIndexSetter', 3, |
1184 dart_declaration, False, return_type, parameters, | 1184 dart_declaration, False, return_type, parameters, |
1185 'Callback', True, False) | 1185 'Callback', True, False) |
1186 | 1186 |
1187 def EmitOperation(self, info, html_name, dart_js_interop=False): | 1187 def EmitOperation(self, info, html_name, dart_js_interop=False): |
1188 """ | 1188 """ |
1189 Arguments: | 1189 Arguments: |
1190 info: An OperationInfo object. | 1190 info: An OperationInfo object. |
1191 """ | 1191 """ |
1192 return_type = self.SecureOutputType(info.type_name, False, False if dart_js_
interop else True) | 1192 return_type = self.SecureOutputType(info.type_name, False, True) |
1193 | 1193 |
1194 formals = info.ParametersAsDeclaration(self._DartType) | 1194 formals = info.ParametersAsDeclaration(self._DartType) |
1195 | 1195 |
1196 parameters = info.ParametersAsListOfVariables(None, | 1196 parameters = info.ParametersAsListOfVariables(None, self._type_registry if s
elf._dart_use_blink else None, dart_js_interop) |
1197 self._type_registry if self._d
art_use_blink else None, | |
1198 dart_js_interop) | |
1199 dart_declaration = '%s%s %s(%s)' % ( | 1197 dart_declaration = '%s%s %s(%s)' % ( |
1200 'static ' if info.IsStatic() else '', | 1198 'static ' if info.IsStatic() else '', |
1201 return_type, | 1199 return_type, |
1202 html_name, | 1200 html_name, |
1203 formals) | 1201 formals) |
1204 | 1202 |
1205 operation = info.operations[0] | 1203 operation = info.operations[0] |
1206 | 1204 |
1207 is_custom = _IsCustom(operation) | 1205 is_custom = _IsCustom(operation) |
1208 has_optional_arguments = any(IsOptional(argument) for argument in operation.
arguments) | 1206 has_optional_arguments = any(IsOptional(argument) for argument in operation.
arguments) |
1209 needs_dispatcher = not is_custom and (len(info.operations) > 1 or has_option
al_arguments) | 1207 needs_dispatcher = not is_custom and (len(info.operations) > 1 or has_option
al_arguments) |
1210 | 1208 |
1211 # Operation uses blink? | 1209 # Operation uses blink? |
1212 wrap_unwrap_list = []; | 1210 wrap_unwrap_list = []; |
1213 return_wrap_jso = False | 1211 return_wrap_jso = False |
1214 # return type wrapped? | 1212 # return type wrapped? |
1215 if self._dart_use_blink: | 1213 if self._dart_use_blink: |
1216 # Wrap the type to store the JsObject if Type is: | 1214 # Wrap the type to store the JsObject if Type is: |
1217 # | 1215 # |
1218 # - known IDL type | 1216 # - known IDL type |
1219 # - type_id is None then it's probably a union type or overloaded | 1217 # - type_id is None then it's probably a union type or overloaded |
1220 # it's a dynamic/any type | 1218 # it's a dynamic/any type |
1221 # - type is Object | 1219 # - type is Object |
1222 # | 1220 # |
1223 # JsObject maybe stored in the Dart class. | 1221 # JsObject maybe stored in the Dart class. |
1224 return_wrap_jso = wrap_return_type_blink(return_type, info.type_name, se
lf._type_registry) | 1222 return_wrap_jso = (info.wrap_unwrap_type_blink(return_type, self._type_r
egistry) or |
1225 return_type_info = self._type_registry.TypeInfo(info.type_name) | 1223 return_type == 'Rectangle' or |
1226 if (isinstance(return_type_info, SequenceIDLTypeInfo) and | 1224 info.wrap_unwrap_list_blink(return_type, self._type_r
egistry)) |
1227 not isinstance(return_type_info._item_info, PrimitiveIDLTypeInfo)): | 1225 wrap_unwrap_list.append(return_wrap_jso) # wrap_jso the returned objec
t |
1228 return_wrap_jso = True | 1226 wrap_unwrap_list.append(self._dart_use_blink) # The 'this' parameter must b
e unwrap_jso |
1229 # wrap_jso the returned object | |
1230 wrap_unwrap_list.append(return_wrap_jso) | |
1231 # The 'this' parameter must be unwrap_jso | |
1232 wrap_unwrap_list.append(self._dart_use_blink) | |
1233 | 1227 |
1234 if info.callback_args: | 1228 if info.callback_args: |
1235 self._AddFutureifiedOperation(info, html_name) | 1229 self._AddFutureifiedOperation(info, html_name) |
1236 elif not needs_dispatcher: | 1230 elif not needs_dispatcher: |
1237 # Bind directly to native implementation | 1231 # Bind directly to native implementation |
1238 argument_count = (0 if info.IsStatic() else 1) + len(info.param_infos) | 1232 argument_count = (0 if info.IsStatic() else 1) + len(info.param_infos) |
1239 native_suffix = 'Callback' | 1233 native_suffix = 'Callback' |
1240 auto_scope_setup = self._GenerateAutoSetupScope(info.name, native_suffix) | 1234 auto_scope_setup = self._GenerateAutoSetupScope(info.name, native_suffix) |
1241 native_entry = \ | 1235 native_entry = \ |
1242 self.DeriveNativeEntry(operation.id, 'Method', len(info.param_infos)) | 1236 self.DeriveNativeEntry(operation.id, 'Method', len(info.param_infos)) |
(...skipping 15 matching lines...) Expand all Loading... |
1258 native_suffix = 'Callback' | 1252 native_suffix = 'Callback' |
1259 actuals = info.ParametersAsListOfVariables(argument_count, | 1253 actuals = info.ParametersAsListOfVariables(argument_count, |
1260 self._type_registry if self._da
rt_use_blink else None, | 1254 self._type_registry if self._da
rt_use_blink else None, |
1261 self._dart_js_interop) | 1255 self._dart_js_interop) |
1262 actuals_s = ", ".join(actuals) | 1256 actuals_s = ", ".join(actuals) |
1263 formals=actuals | 1257 formals=actuals |
1264 return_type = self.SecureOutputType(operation.type.id) | 1258 return_type = self.SecureOutputType(operation.type.id) |
1265 | 1259 |
1266 return_wrap_jso = False | 1260 return_wrap_jso = False |
1267 if self._dart_use_blink: | 1261 if self._dart_use_blink: |
1268 return_wrap_jso = wrap_return_type_blink(return_type, info.type_name,
self._type_registry) | 1262 return_wrap_jso = self._type_registry.HasInterface(return_type) |
1269 | 1263 |
1270 native_suffix = 'Callback' | 1264 native_suffix = 'Callback' |
1271 is_custom = _IsCustom(operation) | 1265 is_custom = _IsCustom(operation) |
1272 base_name = '_%s_%s' % (operation.id, version) | 1266 base_name = '_%s_%s' % (operation.id, version) |
1273 static = True | 1267 static = True |
1274 if not operation.is_static: | 1268 if not operation.is_static: |
1275 actuals = ['unwrap_jso(this)' if self._dart_use_blink else 'this'] + act
uals | 1269 actuals = ['unwrap_jso(this)' if self._dart_use_blink else 'this'] + act
uals |
1276 formals = ['mthis'] + formals | 1270 formals = ['mthis'] + formals |
1277 actuals_s = ", ".join(actuals) | 1271 actuals_s = ", ".join(actuals) |
1278 formals_s = ", ".join(formals) | 1272 formals_s = ", ".join(formals) |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1741 else: | 1735 else: |
1742 emit_template = ''' | 1736 emit_template = ''' |
1743 $METADATA$DART_DECLARATION => $DART_NAME($ACTUALS); | 1737 $METADATA$DART_DECLARATION => $DART_NAME($ACTUALS); |
1744 ''' | 1738 ''' |
1745 if wrap_unwrap_list and wrap_unwrap_list[0]: | 1739 if wrap_unwrap_list and wrap_unwrap_list[0]: |
1746 emit_jso_template = ''' | 1740 emit_jso_template = ''' |
1747 $METADATA$DART_DECLARATION => %s($DART_NAME($ACTUALS)); | 1741 $METADATA$DART_DECLARATION => %s($DART_NAME($ACTUALS)); |
1748 ''' | 1742 ''' |
1749 if return_type == 'Rectangle': | 1743 if return_type == 'Rectangle': |
1750 jso_util_method = 'make_dart_rectangle' | 1744 jso_util_method = 'make_dart_rectangle' |
1751 elif wrap_unwrap_list[0]: | 1745 # TODO(terry): More checks that the return is a List<Node>. |
| 1746 elif return_type.startswith('List<'): |
| 1747 jso_util_method = 'wrap_jso_list' |
| 1748 else: |
1752 jso_util_method = 'wrap_jso' | 1749 jso_util_method = 'wrap_jso' |
1753 | |
1754 # Always return List<String> unwrapped. | 1750 # Always return List<String> unwrapped. |
1755 if return_type != 'List<String>': | 1751 if return_type != 'List<String>': |
1756 emit_template = emit_jso_template % jso_util_method | 1752 emit_template = emit_jso_template % jso_util_method |
1757 | 1753 caller_emitter.Emit(emit_template, |
1758 if caller_emitter: | 1754 METADATA=metadata, |
1759 caller_emitter.Emit(emit_template, | 1755 DART_DECLARATION=dart_declaration, |
1760 METADATA=metadata, | 1756 DART_NAME=full_dart_name, |
1761 DART_DECLARATION=dart_declaration, | 1757 ACTUALS=actuals) |
1762 DART_NAME=full_dart_name, | |
1763 ACTUALS=actuals) | |
1764 cpp_callback_name = '%s%s' % (idl_name, native_suffix) | 1758 cpp_callback_name = '%s%s' % (idl_name, native_suffix) |
1765 | 1759 |
1766 self._cpp_resolver_emitter.Emit( | 1760 self._cpp_resolver_emitter.Emit( |
1767 ' if (argumentCount == $ARGC && name == "$NATIVE_BINDING") {\n' | 1761 ' if (argumentCount == $ARGC && name == "$NATIVE_BINDING") {\n' |
1768 ' *autoSetupScope = $AUTO_SCOPE_SETUP;\n' | 1762 ' *autoSetupScope = $AUTO_SCOPE_SETUP;\n' |
1769 ' return Dart$(INTERFACE_NAME)Internal::$CPP_CALLBACK_NAME;\n' | 1763 ' return Dart$(INTERFACE_NAME)Internal::$CPP_CALLBACK_NAME;\n' |
1770 ' }\n', | 1764 ' }\n', |
1771 ARGC=argument_count, | 1765 ARGC=argument_count, |
1772 NATIVE_BINDING=native_binding, | 1766 NATIVE_BINDING=native_binding, |
1773 INTERFACE_NAME=self._interface.id, | 1767 INTERFACE_NAME=self._interface.id, |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2032 | 2026 |
2033 def _IsCustom(op_or_attr): | 2027 def _IsCustom(op_or_attr): |
2034 assert(isinstance(op_or_attr, IDLMember)) | 2028 assert(isinstance(op_or_attr, IDLMember)) |
2035 return 'Custom' in op_or_attr.ext_attrs or 'DartCustom' in op_or_attr.ext_attr
s | 2029 return 'Custom' in op_or_attr.ext_attrs or 'DartCustom' in op_or_attr.ext_attr
s |
2036 | 2030 |
2037 def _IsCustomValue(op_or_attr, value): | 2031 def _IsCustomValue(op_or_attr, value): |
2038 if _IsCustom(op_or_attr): | 2032 if _IsCustom(op_or_attr): |
2039 return op_or_attr.ext_attrs.get('Custom') == value \ | 2033 return op_or_attr.ext_attrs.get('Custom') == value \ |
2040 or op_or_attr.ext_attrs.get('DartCustom') == value | 2034 or op_or_attr.ext_attrs.get('DartCustom') == value |
2041 return False | 2035 return False |
OLD | NEW |