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 copy | 9 import copy |
10 import json | 10 import json |
(...skipping 1429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1440 """Returns True if the type is a blink type that requires wrap_jso or | 1440 """Returns True if the type is a blink type that requires wrap_jso or |
1441 unwrap_jso""" | 1441 unwrap_jso""" |
1442 if return_type and return_type.startswith('Html'): | 1442 if return_type and return_type.startswith('Html'): |
1443 return_type = return_type.replace('Html', 'HTML', 1) | 1443 return_type = return_type.replace('Html', 'HTML', 1) |
1444 return (type_registry.HasInterface(return_type) or not(return_type) or | 1444 return (type_registry.HasInterface(return_type) or not(return_type) or |
1445 return_type == 'Object' or | 1445 return_type == 'Object' or |
1446 return_type == 'Future' or | 1446 return_type == 'Future' or |
1447 return_type == 'SqlDatabase' or # renamed to Database | 1447 return_type == 'SqlDatabase' or # renamed to Database |
1448 return_type == 'HTMLElement' or | 1448 return_type == 'HTMLElement' or |
1449 return_type == 'MutationObserver' or | 1449 return_type == 'MutationObserver' or |
1450 return_type.endswith('[]')) | 1450 (return_type.endswith('[]') and return_type != 'DOMString[]')) |
1451 | 1451 |
1452 def wrap_type_blink(return_type, type_registry): | 1452 def wrap_type_blink(return_type, type_registry): |
1453 """Returns True if the type is a blink type that requires wrap_jso but | 1453 """Returns True if the type is a blink type that requires wrap_jso but |
1454 NOT unwrap_jso""" | 1454 NOT unwrap_jso""" |
1455 return (return_type == 'Map' or | 1455 return (return_type == 'Map' or |
1456 return_type == 'Rectangle') | 1456 return_type == 'Rectangle') |
1457 | 1457 |
1458 def wrap_return_type_blink(return_type, type_name, type_registry): | 1458 def wrap_return_type_blink(return_type, type_name, type_registry): |
1459 """Returns True if we should wrap the returned value. This checks | 1459 """Returns True if we should wrap the returned value. This checks |
1460 a number of different variations, calling the more basic functions | 1460 a number of different variations, calling the more basic functions |
1461 above.""" | 1461 above.""" |
1462 return (wrap_unwrap_type_blink(return_type, type_registry) or | 1462 return (wrap_unwrap_type_blink(return_type, type_registry) or |
1463 wrap_unwrap_type_blink(type_name, type_registry) or | 1463 wrap_unwrap_type_blink(type_name, type_registry) or |
1464 wrap_type_blink(return_type, type_registry) or | 1464 wrap_type_blink(return_type, type_registry) or |
1465 wrap_unwrap_list_blink(return_type, type_registry)) | 1465 wrap_unwrap_list_blink(return_type, type_registry)) |
OLD | NEW |