From 7291f59cdc664b5f5c7a1765cfec2459c4e708ef Mon Sep 17 00:00:00 2001 From: "antonm@google.com" Date: Thu, 25 Apr 2013 12:14:26 +0000 Subject: [PATCH] Some more cleanups. R=ager@google.com, vsm@google.com Review URL: https://codereview.chromium.org//14367047 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@22026 260f80e4-7a28-3924-810f-c04153c831b5 --- tools/dom/scripts/generator.py | 21 +--------- tools/dom/scripts/htmldartgenerator.py | 42 +------------------ .../immutable_list_mixin.darttemplate | 4 -- 3 files changed, 3 insertions(+), 64 deletions(-) diff --git a/tools/dom/scripts/generator.py b/tools/dom/scripts/generator.py index 517c66ac3c7..4ace8f656c1 100644 --- a/tools/dom/scripts/generator.py +++ b/tools/dom/scripts/generator.py @@ -545,11 +545,6 @@ def FindConversion(idl_type, direction, interface, member): dart2js_annotations = monitored.Dict('generator.dart2js_annotations', { - 'ArrayBuffer': [ - "@Creates('ByteBuffer')", - "@Returns('ByteBuffer|Null')", - ], - 'ArrayBufferView': [ "@Creates('TypedData')", "@Returns('TypedData|Null')", @@ -765,8 +760,6 @@ _webkit_experimental_annotations = [ # INTERFACE: annotations to be added to the interface declaration # INTERFACE.MEMBER: annotation to be added to the member declaration dart_annotations = monitored.Dict('generator.dart_annotations', { - 'ArrayBuffer': _all_but_ie9_annotations, - 'ArrayBufferView': _all_but_ie9_annotations, 'CSSHostRule': _shadow_dom_annotations, 'Crypto': _webkit_experimental_annotations, 'Database': _web_sql_annotations, @@ -1029,9 +1022,6 @@ class IDLTypeInfo(object): def list_item_type(self): raise NotImplementedError() - def is_typed_array(self): - raise NotImplementedError() - def merged_interface(self): return None @@ -1158,9 +1148,6 @@ class InterfaceIDLTypeInfo(IDLTypeInfo): def list_item_type(self): return self._data.item_type - def is_typed_array(self): - return self._data.is_typed_array - def merged_interface(self): # All constants, attributes, and operations of merged interface should be # added to this interface. Merged idl interface does not have corresponding @@ -1362,7 +1349,7 @@ class TypeData(object): conversion_includes=None, webcore_getter_name='getAttribute', webcore_setter_name='setAttribute', - item_type=None, suppress_interface=False, is_typed_array=False): + item_type=None, suppress_interface=False): self.clazz = clazz self.dart_type = dart_type self.native_type = native_type @@ -1375,23 +1362,19 @@ class TypeData(object): self.webcore_setter_name = webcore_setter_name self.item_type = item_type self.suppress_interface = suppress_interface - self.is_typed_array = is_typed_array def TypedListTypeData(item_type): return TypeData( clazz='TypedList', dart_type='List<%s>' % item_type, # TODO(antonm): proper typed_data interfaces. - item_type=item_type, - is_typed_array=True) + item_type=item_type) _idl_type_registry = monitored.Dict('generator._idl_type_registry', { 'boolean': TypeData(clazz='Primitive', dart_type='bool', native_type='bool', webcore_getter_name='hasAttribute', webcore_setter_name='setBooleanAttribute'), - 'byte': TypeData(clazz='Primitive', dart_type='int', native_type='int'), - 'octet': TypeData(clazz='Primitive', dart_type='int', native_type='int'), 'short': TypeData(clazz='Primitive', dart_type='int', native_type='int'), 'unsigned short': TypeData(clazz='Primitive', dart_type='int', native_type='int'), diff --git a/tools/dom/scripts/htmldartgenerator.py b/tools/dom/scripts/htmldartgenerator.py index 06c2cc6d4d2..8c2699269c0 100644 --- a/tools/dom/scripts/htmldartgenerator.py +++ b/tools/dom/scripts/htmldartgenerator.py @@ -320,10 +320,7 @@ class HtmlDartGenerator(object): def AdditionalImplementedInterfaces(self): # TODO: Include all implemented interfaces, including other Lists. implements = [] - if self._interface_type_info.is_typed_array(): - element_type = self._interface_type_info.list_item_type() - implements.append('List<%s>' % element_type) - elif self._interface_type_info.list_item_type(): + if self._interface_type_info.list_item_type(): item_type_info = self._type_registry.TypeInfo( self._interface_type_info.list_item_type()) implements.append('List<%s>' % item_type_info.dart_type()) @@ -343,41 +340,6 @@ class HtmlDartGenerator(object): self._AddConstructor( constructor_info, factory_name, factory_constructor_name) - typed_array_type = None - for interface in self._database.Hierarchy(self._interface): - type_info = self._type_registry.TypeInfo(interface.id) - if type_info.is_typed_array(): - typed_array_type = type_info.list_item_type() - break - - annotations = FormatAnnotationsAndComments( - GetAnnotationsAndComments(self._library_name, self._interface.id, - self._interface.id), ' ') - - fromListAnnotations = FormatAnnotationsAndComments( - GetAnnotationsAndComments(self._library_name, self._interface.id, - 'fromList'), ' ') - - fromBufferAnnotations = FormatAnnotationsAndComments( - GetAnnotationsAndComments(self._library_name, self._interface.id, - 'fromBuffer'), ' ') - - if typed_array_type: - self._members_emitter.Emit( - '\n $(ANNOTATIONS)factory $CTOR(int length) =>\n' - ' $FACTORY.create$(CTOR)(length);\n' - '\n $(LIST_ANNOTATIONS)factory $CTOR.fromList(List<$TYPE> list) =>\n' - ' $FACTORY.create$(CTOR)_fromList(list);\n' - '\n $(BUFFER_ANNOTATIONS)factory $CTOR.view(ByteBuffer buffer, ' - '[int byteOffset, int length]) => \n' - ' $FACTORY.create$(CTOR)_fromBuffer(buffer, byteOffset, length);\n', - CTOR=self._renamer.RenameInterface(interface), - ANNOTATIONS=annotations, - LIST_ANNOTATIONS=fromListAnnotations, - BUFFER_ANNOTATIONS=fromBufferAnnotations, - TYPE=self._DartType(typed_array_type), - FACTORY=factory_name) - def _AddConstructor(self, constructor_info, factory_name, factory_constructor_name): if self.GenerateCustomFactory(constructor_info): @@ -567,7 +529,6 @@ class HtmlDartGenerator(object): has_clear = any(op.id == 'clear' for op in self._interface.operations) has_length = False has_length_setter = False - typed_array = self._interface_type_info.is_typed_array() for attr in self._interface.attributes: if attr.id == 'length': @@ -582,7 +543,6 @@ class HtmlDartGenerator(object): { 'DEFINE_CONTAINS': not has_contains, 'DEFINE_CLEAR': not has_clear, - 'DEFINE_IMMUTABLE': not typed_array, 'DEFINE_LENGTH_AS_NUM_ITEMS': not has_length and has_num_items, 'DEFINE_LENGTH_SETTER': not has_length_setter, }) diff --git a/tools/dom/templates/immutable_list_mixin.darttemplate b/tools/dom/templates/immutable_list_mixin.darttemplate index ea886ac2bbc..a984eabf838 100644 --- a/tools/dom/templates/immutable_list_mixin.darttemplate +++ b/tools/dom/templates/immutable_list_mixin.darttemplate @@ -172,11 +172,7 @@ $endif } void setRange(int start, int end, Iterable<$E> iterable, [int skipCount=0]) { -$if DEFINE_IMMUTABLE throw new UnsupportedError("Cannot setRange on immutable List."); -$else - IterableMixinWorkaround.setRangeList(this, start, end, iterable, skipCount); -$endif } void removeRange(int start, int end) {