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

Unified Diff: tools/dom/scripts/systemnative.py

Issue 14373013: Proper support for ForceOptional. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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
« no previous file with comments | « sdk/lib/indexed_db/dartium/indexed_db_dartium.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/dom/scripts/systemnative.py
diff --git a/tools/dom/scripts/systemnative.py b/tools/dom/scripts/systemnative.py
index b86e0fe5a44f2722413930587c5ee026f4acf434..60ab06215c8377f94fc2fec50749f8e09cfb3ace 100644
--- a/tools/dom/scripts/systemnative.py
+++ b/tools/dom/scripts/systemnative.py
@@ -261,16 +261,28 @@ class DartiumBackend(HtmlDartGenerator):
def _GenerateCPPHeader(self):
to_native_emitter = emitter.Emitter()
if self._interface_type_info.custom_to_native():
- to_native_emitter.Emit(
- ' static PassRefPtr<NativeType> toNative(Dart_Handle handle, Dart_Handle& exception);\n')
+ return_type = 'PassRefPtr<NativeType>'
+ to_native_body = ';'
else:
- to_native_emitter.Emit(
- ' static NativeType* toNative(Dart_Handle handle, Dart_Handle& exception)\n'
+ return_type = 'NativeType*'
+ to_native_body = emitter.Format(
+ '\n'
' {\n'
' return DartDOMWrapper::unwrapDartWrapper<Dart$INTERFACE>(handle, exception);\n'
- ' }\n',
+ ' }',
INTERFACE=self._interface.id)
+ to_native_emitter.Emit(
+ ' static $RETURN_TYPE toNative(Dart_Handle handle, Dart_Handle& exception)$TO_NATIVE_BODY\n'
+ '\n'
+ ' static $RETURN_TYPE toNativeWithNullCheck(Dart_Handle handle, Dart_Handle& exception)\n'
+ ' {\n'
+ ' return Dart_IsNull(handle) ? 0 : toNative(handle, exception);\n'
+ ' }\n',
+ RETURN_TYPE=return_type,
+ TO_NATIVE_BODY=to_native_body,
+ INTERFACE=self._interface.id)
+
to_dart_emitter = emitter.Emitter()
ext_attrs = self._interface.ext_attrs
@@ -851,9 +863,7 @@ class DartiumBackend(HtmlDartGenerator):
return False
if operation.id in ['addEventListener', 'removeEventListener'] and argument.id == 'useCapture':
return False
- # Another option would be to adjust in IDLs, but let's keep it here for now
- # as it's a single instance.
- if self._interface.id == 'CSSStyleDeclaration' and operation.id == 'setProperty' and argument.id == 'priority':
+ if 'ForceOptional' in argument.ext_attrs:
return False
if argument.type.id == 'Dictionary':
return False
« no previous file with comments | « sdk/lib/indexed_db/dartium/indexed_db_dartium.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698