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

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

Issue 1583773003: Support JS$ prefix for dart and fix bug where _operator_getter and the [] operator were used incons… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: remove tests to put with matching dart2js tests Created 4 years, 11 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
« no previous file with comments | « tests/lib/analyzer/analyze_library.status ('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 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 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 # 539 #
540 # - known IDL type 540 # - known IDL type
541 # - type_id is None then it's probably a union type or overloaded 541 # - type_id is None then it's probably a union type or overloaded
542 # it's a dynamic/any type 542 # it's a dynamic/any type
543 # - type is Object 543 # - type is Object
544 # 544 #
545 # JsObject maybe stored in the Dart class. 545 # JsObject maybe stored in the Dart class.
546 if (wrap_unwrap_type_blink(type_id, type_registry)): 546 if (wrap_unwrap_type_blink(type_id, type_registry)):
547 type_is_callback = self.isCallback(type_registry, type_id) 547 type_is_callback = self.isCallback(type_registry, type_id)
548 if (dart_js_interop and type_id == 'EventListener' and 548 if (dart_js_interop and type_id == 'EventListener' and
549 (self.name == 'addEventListener')): 549 self.name in ['addEventListener', 'removeEventListener']):
550 # Events fired need use a JsFunction not a anonymous closure to 550 # Events fired need use a JsFunction not a anonymous closure to
551 # insure the event can really be removed. 551 # insure the event can really be removed.
552 parameters.append('wrap_event_listener(this, %s)' % p.name) 552 parameters.append('unwrap_jso(js.allowInterop(%s))' % p.name)
553 elif (dart_js_interop and type_id == 'EventListener' and
554 (self.name == 'removeEventListener')):
555 # Find the JsFunction that corresponds to this Dart function.
556 parameters.append('_knownListeners[this.hashCode][identityHashCode (%s)]' % p.name)
557 elif dart_js_interop and type_id == 'FontFaceSetForEachCallback': 553 elif dart_js_interop and type_id == 'FontFaceSetForEachCallback':
558 # forEach is supported in the DOM for FontFaceSet as it iterates 554 # forEach is supported in the DOM for FontFaceSet as it iterates
559 # over the Javascript Object the callback parameters are also 555 # over the Javascript Object the callback parameters are also
560 # Javascript objects and must be wrapped. 556 # Javascript objects and must be wrapped.
561 parameters.append('unwrap_jso((fontFace, fontFaceAgain, set) => %s (wrap_jso(fontFace), wrap_jso(fontFaceAgain), wrap_jso(set)))' % p.name) 557 parameters.append('unwrap_jso((fontFace, fontFaceAgain, set) => %s (wrap_jso(fontFace), wrap_jso(fontFaceAgain), wrap_jso(set)))' % p.name)
562 elif dart_js_interop and type_id == 'HeadersForEachCallback': 558 elif dart_js_interop and type_id == 'HeadersForEachCallback':
563 # forEach is supported in the DOM for Headers as it iterates 559 # forEach is supported in the DOM for Headers as it iterates
564 # over the Javascript Object the callback parameters are also 560 # over the Javascript Object the callback parameters are also
565 # Javascript objects and must be wrapped. 561 # Javascript objects and must be wrapped.
566 parameters.append('unwrap_jso((String value, String key, map) => % s(value, key, wrap_jso(map)))' % p.name) 562 parameters.append('unwrap_jso((String value, String key, map) => % s(value, key, wrap_jso(map)))' % p.name)
(...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after
1466 return_type == 'Rectangle') 1462 return_type == 'Rectangle')
1467 1463
1468 def wrap_return_type_blink(return_type, type_name, type_registry): 1464 def wrap_return_type_blink(return_type, type_name, type_registry):
1469 """Returns True if we should wrap the returned value. This checks 1465 """Returns True if we should wrap the returned value. This checks
1470 a number of different variations, calling the more basic functions 1466 a number of different variations, calling the more basic functions
1471 above.""" 1467 above."""
1472 return (wrap_unwrap_type_blink(return_type, type_registry) or 1468 return (wrap_unwrap_type_blink(return_type, type_registry) or
1473 wrap_unwrap_type_blink(type_name, type_registry) or 1469 wrap_unwrap_type_blink(type_name, type_registry) or
1474 wrap_type_blink(return_type, type_registry) or 1470 wrap_type_blink(return_type, type_registry) or
1475 wrap_unwrap_list_blink(return_type, type_registry)) 1471 wrap_unwrap_list_blink(return_type, type_registry))
OLDNEW
« no previous file with comments | « tests/lib/analyzer/analyze_library.status ('k') | tools/dom/scripts/systemhtml.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698