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

Unified Diff: lib/dom/scripts/generator.py

Issue 10388084: Better support for the case of typed arrays inheriting from other typed arrays. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: lib/dom/scripts/generator.py
diff --git a/lib/dom/scripts/generator.py b/lib/dom/scripts/generator.py
index 8d72a6c024459201352f46a8d717b078d2417b26..a5bf05c5477381af7dbf4f0ab393e21c145a7b97 100644
--- a/lib/dom/scripts/generator.py
+++ b/lib/dom/scripts/generator.py
@@ -108,10 +108,26 @@ def MaybeTypedArrayElementType(interface):
"""
# Typed arrays implement ArrayBufferView and List<T>.
for parent in interface.parents:
- if parent.type.id == 'ArrayBufferView':
+ if parent.type.id == 'ArrayBufferView':
return MaybeListElementType(interface)
return None
+def MaybeTypedArrayElementTypeInHierarchy(interface, database):
+ """Returns the typed array element type, or None in interface is not a
+ TypedArray. Checks the whole parent hierarchy.
+ """
+ element_type = MaybeTypedArrayElementType(interface)
+ if element_type:
+ return element_type
+ for parent in interface.parents:
+ if database.HasInterface(parent.type.id):
+ parent_interface = database.GetInterface(parent.type.id)
+ element_type = MaybeTypedArrayElementType(parent_interface)
+ if element_type:
+ return element_type
+
+ return None
+
def MakeNativeSpec(javascript_binding_name):
if javascript_binding_name in _frog_dom_custom_native_specs:
return _frog_dom_custom_native_specs[javascript_binding_name]

Powered by Google App Engine
This is Rietveld 408576698