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

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

Issue 368433004: Fix overloading for IDBDatabase transaction (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 5 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 | « sdk/lib/html/dart2js/html_dart2js.dart ('k') | tools/dom/scripts/systemhtml.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 system to generate 6 """This module provides shared functionality for the system to generate
7 dart:html APIs from the IDL database.""" 7 dart:html APIs from the IDL database."""
8 8
9 import emitter 9 import emitter
10 from generator import AnalyzeOperation, ConstantOutputOrder, \ 10 from generator import AnalyzeOperation, ConstantOutputOrder, \
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 351
352 version[0] += 1 352 version[0] += 1
353 generate_call(stmts_emitter, call_emitter, 353 generate_call(stmts_emitter, call_emitter,
354 version[0], signature_index, argument_count) 354 version[0], signature_index, argument_count)
355 355
356 def GenerateChecksAndCall(signature_index, argument_count): 356 def GenerateChecksAndCall(signature_index, argument_count):
357 checks = [] 357 checks = []
358 for i in reversed(range(0, argument_count)): 358 for i in reversed(range(0, argument_count)):
359 argument = signatures[signature_index][i] 359 argument = signatures[signature_index][i]
360 parameter_name = parameter_names[i] 360 parameter_name = parameter_names[i]
361 test_type = self._DartType(argument.type.id) 361
362 test_type = self._NarrowToImplementationType(argument.type.id)
362 363
363 if test_type in ['dynamic', 'Object']: 364 if test_type in ['dynamic', 'Object']:
364 checks.append('%s != null' % parameter_name) 365 checks.append('%s != null' % parameter_name)
365 elif not can_omit_type_check(test_type, i): 366 elif not can_omit_type_check(test_type, i):
366 checks.append('(%s is %s || %s == null)' % ( 367 checks.append('(%s is %s || %s == null)' % (
367 parameter_name, test_type, parameter_name)) 368 parameter_name, test_type, parameter_name))
368 elif i >= number_of_required_in_dart: 369 elif i >= number_of_required_in_dart:
369 checks.append('%s != null' % parameter_name) 370 checks.append('%s != null' % parameter_name)
370 371
371 # There can be multiple presence checks. We need them all since a later 372 # There can be multiple presence checks. We need them all since a later
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 # returned in generated code. 747 # returned in generated code.
747 assert(dart_name != 'HistoryBase' and dart_name != 'LocationBase') 748 assert(dart_name != 'HistoryBase' and dart_name != 'LocationBase')
748 if dart_name == 'Window': 749 if dart_name == 'Window':
749 return _secure_base_types[dart_name] 750 return _secure_base_types[dart_name]
750 return dart_name 751 return dart_name
751 752
752 def SecureBaseName(self, type_name): 753 def SecureBaseName(self, type_name):
753 if type_name in _secure_base_types: 754 if type_name in _secure_base_types:
754 return _secure_base_types[type_name] 755 return _secure_base_types[type_name]
755 756
757 def _NarrowToImplementationType(self, type_name):
758 return self._type_registry.TypeInfo(type_name).narrow_dart_type()
759
760 def _NarrowInputType(self, type_name):
761 return self._NarrowToImplementationType(type_name)
762
756 def _DartType(self, type_name): 763 def _DartType(self, type_name):
757 return self._type_registry.DartType(type_name) 764 return self._type_registry.DartType(type_name)
758 765
759 def _TypeInfo(self, type_name): 766 def _TypeInfo(self, type_name):
760 return self._type_registry.TypeInfo(type_name) 767 return self._type_registry.TypeInfo(type_name)
OLDNEW
« no previous file with comments | « sdk/lib/html/dart2js/html_dart2js.dart ('k') | tools/dom/scripts/systemhtml.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698