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

Side by Side Diff: tools/dom/scripts/generator.py

Issue 14426006: Rename dart:typeddata to dart:typed_data. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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 | « tools/create_sdk.py ('k') | tools/dom/scripts/htmlrenamer.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 systems to generate 6 """This module provides shared functionality for systems to generate
7 Dart APIs from the IDL database.""" 7 Dart APIs from the IDL database."""
8 8
9 import copy 9 import copy
10 import json 10 import json
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 is_static = self.overloads[0].is_static 378 is_static = self.overloads[0].is_static
379 assert any([is_static == o.is_static for o in self.overloads]) 379 assert any([is_static == o.is_static for o in self.overloads])
380 return is_static 380 return is_static
381 381
382 def _ConstructorFullName(self, rename_type): 382 def _ConstructorFullName(self, rename_type):
383 if self.constructor_name: 383 if self.constructor_name:
384 return rename_type(self.type_name) + '.' + self.constructor_name 384 return rename_type(self.type_name) + '.' + self.constructor_name
385 else: 385 else:
386 # TODO(antonm): temporary ugly hack. 386 # TODO(antonm): temporary ugly hack.
387 # While in transition phase we allow both DOM's ArrayBuffer 387 # While in transition phase we allow both DOM's ArrayBuffer
388 # and dart:typeddata's ByteBuffer for IDLs' ArrayBuffers, 388 # and dart:typed_data's ByteBuffer for IDLs' ArrayBuffers,
389 # hence ArrayBuffer is mapped to dynamic in arguments and return 389 # hence ArrayBuffer is mapped to dynamic in arguments and return
390 # values. To compensate for that when generating ArrayBuffer itself, 390 # values. To compensate for that when generating ArrayBuffer itself,
391 # we need to lie a bit: 391 # we need to lie a bit:
392 if self.type_name == 'ArrayBuffer': return 'ByteBuffer' 392 if self.type_name == 'ArrayBuffer': return 'ByteBuffer'
393 return rename_type(self.type_name) 393 return rename_type(self.type_name)
394 394
395 def ConstantOutputOrder(a, b): 395 def ConstantOutputOrder(a, b):
396 """Canonical output ordering for constants.""" 396 """Canonical output ordering for constants."""
397 return cmp(a.id, b.id) 397 return cmp(a.id, b.id)
398 398
(...skipping 973 matching lines...) Expand 10 before | Expand all | Expand 10 after
1372 self.webcore_getter_name = webcore_getter_name 1372 self.webcore_getter_name = webcore_getter_name
1373 self.webcore_setter_name = webcore_setter_name 1373 self.webcore_setter_name = webcore_setter_name
1374 self.item_type = item_type 1374 self.item_type = item_type
1375 self.suppress_interface = suppress_interface 1375 self.suppress_interface = suppress_interface
1376 self.is_typed_array = is_typed_array 1376 self.is_typed_array = is_typed_array
1377 1377
1378 1378
1379 def TypedListTypeData(item_type): 1379 def TypedListTypeData(item_type):
1380 return TypeData( 1380 return TypeData(
1381 clazz='TypedList', 1381 clazz='TypedList',
1382 dart_type='List<%s>' % item_type, # TODO(antonm): proper typeddata interfa ces. 1382 dart_type='List<%s>' % item_type, # TODO(antonm): proper typed_data interf aces.
1383 item_type=item_type, 1383 item_type=item_type,
1384 is_typed_array=True) 1384 is_typed_array=True)
1385 1385
1386 1386
1387 _idl_type_registry = monitored.Dict('generator._idl_type_registry', { 1387 _idl_type_registry = monitored.Dict('generator._idl_type_registry', {
1388 'boolean': TypeData(clazz='Primitive', dart_type='bool', native_type='bool', 1388 'boolean': TypeData(clazz='Primitive', dart_type='bool', native_type='bool',
1389 webcore_getter_name='hasAttribute', 1389 webcore_getter_name='hasAttribute',
1390 webcore_setter_name='setBooleanAttribute'), 1390 webcore_setter_name='setBooleanAttribute'),
1391 'byte': TypeData(clazz='Primitive', dart_type='int', native_type='int'), 1391 'byte': TypeData(clazz='Primitive', dart_type='int', native_type='int'),
1392 'octet': TypeData(clazz='Primitive', dart_type='int', native_type='int'), 1392 'octet': TypeData(clazz='Primitive', dart_type='int', native_type='int'),
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
1587 type_name, type_data, dart_interface_name, self) 1587 type_name, type_data, dart_interface_name, self)
1588 1588
1589 if type_data.clazz == 'BasicTypedList': 1589 if type_data.clazz == 'BasicTypedList':
1590 dart_interface_name = self._renamer.RenameInterface( 1590 dart_interface_name = self._renamer.RenameInterface(
1591 self._database.GetInterface(type_name)) 1591 self._database.GetInterface(type_name))
1592 return BasicTypedListIDLTypeInfo( 1592 return BasicTypedListIDLTypeInfo(
1593 type_name, type_data, dart_interface_name, self) 1593 type_name, type_data, dart_interface_name, self)
1594 1594
1595 class_name = '%sIDLTypeInfo' % type_data.clazz 1595 class_name = '%sIDLTypeInfo' % type_data.clazz
1596 return globals()[class_name](type_name, type_data) 1596 return globals()[class_name](type_name, type_data)
OLDNEW
« no previous file with comments | « tools/create_sdk.py ('k') | tools/dom/scripts/htmlrenamer.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698