| Index: lib/dom/scripts/generator.py
|
| diff --git a/lib/dom/scripts/generator.py b/lib/dom/scripts/generator.py
|
| index 6f231591cf4ef416ebf8af6e1106ae29c3562159..6c867f9311721e595e5f7da88f229a89a8fc2c2c 100644
|
| --- a/lib/dom/scripts/generator.py
|
| +++ b/lib/dom/scripts/generator.py
|
| @@ -466,39 +466,25 @@ class IDLTypeInfo(object):
|
| def requires_v8_scope(self):
|
| return self._data.requires_v8_scope
|
|
|
| - def emit_to_native(self, emitter, idl_node, accept_null, name, handle):
|
| + def to_native_info(self, idl_node, accept_null, name, interface_name):
|
| + cls = 'Dart%s' % self.idl_type()
|
| +
|
| if 'Callback' in idl_node.ext_attrs:
|
| function_name = 'create'
|
| if accept_null:
|
| function_name += 'WithNullCheck'
|
| - emitter.Emit(
|
| - '\n'
|
| - ' RefPtr<$TYPE> $NAME = Dart$IDL_TYPE::$FUNCTION_NAME($HANDLE, exception);\n'
|
| - ' if (exception)\n'
|
| - ' goto fail;\n',
|
| - TYPE=self.native_type(),
|
| - NAME=name,
|
| - FUNCTION_NAME=function_name,
|
| - IDL_TYPE=self.idl_type(),
|
| - HANDLE=handle)
|
| - return
|
| + return name, 'RefPtr<%s>' % self.native_type(), cls, function_name
|
|
|
| if self.custom_to_native():
|
| type = 'RefPtr<%s>' % self.native_type()
|
| + argument = '%s.get()' % name
|
| else:
|
| type = '%s*' % self.native_type()
|
| - emitter.Emit(
|
| - '\n'
|
| - ' $TYPE $NAME = Dart$IDL_TYPE::toNative($HANDLE, exception);\n'
|
| - ' if (exception)\n'
|
| - ' goto fail;\n',
|
| - TYPE=type,
|
| - NAME=name,
|
| - IDL_TYPE=self.idl_type(),
|
| - HANDLE=handle)
|
| -
|
| - def argument_expression(self, name, interface_name):
|
| - return '%s.get()' % name if self.custom_to_native() else name
|
| + if isinstance(self, SVGTearOffIDLTypeInfo) and not interface_name.endswith('List'):
|
| + argument = '%s->propertyReference()' % name
|
| + else:
|
| + argument = name
|
| + return argument, type, cls, 'toNative'
|
|
|
| def custom_to_native(self):
|
| return self._data.custom_to_native
|
| @@ -542,9 +528,6 @@ class IDLTypeInfo(object):
|
| includes = [self._idl_type] + (self._data.conversion_includes or [])
|
| return ['"Dart%s.h"' % include for include in includes]
|
|
|
| - def to_native_includes(self):
|
| - return ['"Dart%s.h"' % self.idl_type()]
|
| -
|
| def to_dart_conversion(self, value, interface_name=None, attributes=None):
|
| return 'Dart%s::toDart(%s)' % (self._idl_type, value)
|
|
|
| @@ -576,25 +559,16 @@ class DOMStringArrayTypeInfo(SequenceIDLTypeInfo):
|
| def __init__(self, data, item_info):
|
| super(DOMStringArrayTypeInfo, self).__init__('DOMString[]', data, item_info)
|
|
|
| - def emit_to_native(self, emitter, idl_node, accept_null, name, handle):
|
| + def to_native_info(self, idl_node, accept_null, name, interface_name):
|
| assert not accept_null
|
| - emitter.Emit(
|
| - '\n'
|
| - ' RefPtr<DOMStringList> $NAME = DartDOMStringList::toNative($HANDLE, exception);\n'
|
| - ' if (exception)\n'
|
| - ' goto fail;\n',
|
| - NAME=name,
|
| - HANDLE=handle)
|
| -
|
| - def to_native_includes(self):
|
| - return ['"DartDOMStringList.h"']
|
| + return name, 'RefPtr<DOMStringList>', 'DartDOMStringList', 'toNative'
|
|
|
|
|
| class PrimitiveIDLTypeInfo(IDLTypeInfo):
|
| def __init__(self, idl_type, data):
|
| super(PrimitiveIDLTypeInfo, self).__init__(idl_type, data)
|
|
|
| - def emit_to_native(self, emitter, idl_node, accept_null, name, handle):
|
| + def to_native_info(self, idl_node, accept_null, name, interface_name):
|
| function_name = 'dartTo%s' % self._capitalized_native_type()
|
| if accept_null:
|
| function_name += 'WithNullCheck'
|
| @@ -603,15 +577,7 @@ class PrimitiveIDLTypeInfo(IDLTypeInfo):
|
| type = 'RefPtr<%s>' % type
|
| if type == 'String':
|
| type = 'DartStringAdapter'
|
| - emitter.Emit(
|
| - '\n'
|
| - ' $TYPE $NAME = DartUtilities::$FUNCTION_NAME($HANDLE, exception);\n'
|
| - ' if (exception)\n'
|
| - ' goto fail;\n',
|
| - TYPE=type,
|
| - NAME=name,
|
| - FUNCTION_NAME=function_name,
|
| - HANDLE=handle)
|
| + return name, type, 'DartUtilities', function_name
|
|
|
| def parameter_type(self):
|
| if self.native_type() == 'String':
|
| @@ -621,9 +587,6 @@ class PrimitiveIDLTypeInfo(IDLTypeInfo):
|
| def conversion_includes(self):
|
| return []
|
|
|
| - def to_native_includes(sefl):
|
| - return []
|
| -
|
| def to_dart_conversion(self, value, interface_name=None, attributes=None):
|
| function_name = self._capitalized_native_type()
|
| function_name = function_name[0].lower() + function_name[1:]
|
|
|