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

Side by Side Diff: lib/dom/scripts/systemnative.py

Issue 10451054: Fix a bug in overload dispatch. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 6 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 | « no previous file | tests/html/audiocontext_test.dart » ('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 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 1004 matching lines...) Expand 10 before | Expand all | Expand 10 after
1015 overloads) 1015 overloads)
1016 1016
1017 # Match each operation in turn. 1017 # Match each operation in turn.
1018 # TODO: Optimize the dispatch to avoid repeated tests. 1018 # TODO: Optimize the dispatch to avoid repeated tests.
1019 fallthrough = True 1019 fallthrough = True
1020 for operation in overloads: 1020 for operation in overloads:
1021 tests = [] 1021 tests = []
1022 for (position, param) in enumerate(info.param_infos): 1022 for (position, param) in enumerate(info.param_infos):
1023 if position < len(operation.arguments): 1023 if position < len(operation.arguments):
1024 arg = operation.arguments[position] 1024 arg = operation.arguments[position]
1025 dart_type = DartType(arg.type.id) 1025 dart_type = self._DartType(arg.type.id)
podivilov 2012/05/28 13:00:09 DOM interfaces named after idl interfaces have gon
1026 if dart_type == param.dart_type: 1026 if dart_type == param.dart_type:
1027 # The overload type matches the method parameter type exactly. We 1027 # The overload type matches the method parameter type exactly. We
1028 # will have already tested this type in checked mode, and the target 1028 # will have already tested this type in checked mode, and the target
1029 # will expect (i.e. check) this type. This case happens when all 1029 # will expect (i.e. check) this type. This case happens when all
1030 # the overloads have the same type in this position, including the 1030 # the overloads have the same type in this position, including the
1031 # trivial case of one overload. 1031 # trivial case of one overload.
1032 test = None 1032 test = None
1033 else: 1033 else:
1034 test = TypeCheck(param.name, dart_type) 1034 test = TypeCheck(param.name, dart_type)
1035 if IsNullable(dart_type) or arg.is_optional: 1035 if IsNullable(dart_type) or arg.is_optional:
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
1299 for parent in interface.parents: 1299 for parent in interface.parents:
1300 parent_name = parent.type.id 1300 parent_name = parent.type.id
1301 if not database.HasInterface(parent.type.id): 1301 if not database.HasInterface(parent.type.id):
1302 continue 1302 continue
1303 parent_interface = database.GetInterface(parent.type.id) 1303 parent_interface = database.GetInterface(parent.type.id)
1304 if callback(parent_interface): 1304 if callback(parent_interface):
1305 return parent_interface 1305 return parent_interface
1306 parent_interface = _FindParent(parent_interface, database, callback) 1306 parent_interface = _FindParent(parent_interface, database, callback)
1307 if parent_interface: 1307 if parent_interface:
1308 return parent_interface 1308 return parent_interface
OLDNEW
« no previous file with comments | « no previous file | tests/html/audiocontext_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698