| OLD | NEW |
| 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 re | 9 import re |
| 10 | 10 |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 type_id: Original type id. None for merged types. | 141 type_id: Original type id. None for merged types. |
| 142 dart_type: DartType of parameter. | 142 dart_type: DartType of parameter. |
| 143 default_value: String holding the expression. None for mandatory parameter. | 143 default_value: String holding the expression. None for mandatory parameter. |
| 144 """ | 144 """ |
| 145 def __init__(self, name, type_id, dart_type, default_value): | 145 def __init__(self, name, type_id, dart_type, default_value): |
| 146 self.name = name | 146 self.name = name |
| 147 self.type_id = type_id | 147 self.type_id = type_id |
| 148 self.dart_type = dart_type | 148 self.dart_type = dart_type |
| 149 self.default_value = default_value | 149 self.default_value = default_value |
| 150 | 150 |
| 151 def __repr__(self): |
| 152 content = 'name = %s, type_id = %s, dart_type = %s, default_value = %s' % ( |
| 153 self.name, self.type_id, self.dart_type, self.default_value)) |
| 154 return '<ParamInfo(%s)>' % content |
| 155 |
| 151 | 156 |
| 152 # Given a list of overloaded arguments, render a dart argument. | 157 # Given a list of overloaded arguments, render a dart argument. |
| 153 def _DartArg(args, interface): | 158 def _DartArg(args, interface): |
| 154 # Given a list of overloaded arguments, choose a suitable name. | 159 # Given a list of overloaded arguments, choose a suitable name. |
| 155 def OverloadedName(args): | 160 def OverloadedName(args): |
| 156 return '_OR_'.join(sorted(set(arg.id for arg in args))) | 161 return '_OR_'.join(sorted(set(arg.id for arg in args))) |
| 157 | 162 |
| 158 # Given a list of overloaded arguments, choose a suitable type. | 163 # Given a list of overloaded arguments, choose a suitable type. |
| 159 def OverloadedType(args): | 164 def OverloadedType(args): |
| 160 type_ids = sorted(set(arg.type.id for arg in args)) | 165 type_ids = sorted(set(arg.type.id for arg in args)) |
| (...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 714 '"SVGAnimatedListPropertyTearOff.h"', | 719 '"SVGAnimatedListPropertyTearOff.h"', |
| 715 '"SVGTransformListPropertyTearOff.h"', | 720 '"SVGTransformListPropertyTearOff.h"', |
| 716 '"SVGPathSegListPropertyTearOff.h"', | 721 '"SVGPathSegListPropertyTearOff.h"', |
| 717 ] | 722 ] |
| 718 | 723 |
| 719 def GetIDLTypeInfo(idl_type_name): | 724 def GetIDLTypeInfo(idl_type_name): |
| 720 match = re.match(r'sequence<(\w+)>$', idl_type_name) | 725 match = re.match(r'sequence<(\w+)>$', idl_type_name) |
| 721 if match: | 726 if match: |
| 722 return SequenceIDLTypeInfo(idl_type_name, GetIDLTypeInfo(match.group(1))) | 727 return SequenceIDLTypeInfo(idl_type_name, GetIDLTypeInfo(match.group(1))) |
| 723 return _idl_type_registry.get(idl_type_name, IDLTypeInfo(idl_type_name)) | 728 return _idl_type_registry.get(idl_type_name, IDLTypeInfo(idl_type_name)) |
| OLD | NEW |