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

Unified Diff: sdk/lib/html/scripts/systemhtml.py

Issue 11415067: Add annotations on native fields and methods (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: comment Created 8 years, 1 month 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: sdk/lib/html/scripts/systemhtml.py
diff --git a/sdk/lib/html/scripts/systemhtml.py b/sdk/lib/html/scripts/systemhtml.py
index 9bb8186ba9337b07fa5e299d20fb71734b12ffa9..38ad58ca24f3460238cac30bceca0ab11fe19ae8 100644
--- a/sdk/lib/html/scripts/systemhtml.py
+++ b/sdk/lib/html/scripts/systemhtml.py
@@ -584,13 +584,15 @@ class Dart2JSBackend(HtmlDartGenerator):
if conversion:
return self._AddConvertingGetter(attr, html_name, conversion)
return_type = self.SecureOutputType(attr.type.id)
+ native_type = self._NarrowToImplementationType(attr.type.id)
self._members_emitter.Emit(
# TODO(sra): Use metadata to provide native name.
- '\n $TYPE get $HTML_NAME => JS("$TYPE", "#.$NAME", this);'
+ '\n $TYPE get $HTML_NAME => JS("$NATIVE_TYPE", "#.$NAME", this);'
'\n',
HTML_NAME=html_name,
NAME=attr.id,
- TYPE=return_type)
+ TYPE=return_type,
+ NATIVE_TYPE=native_type)
def _AddRenamingSetter(self, attr, html_name):
self.EmitAttributeDocumentation(attr)
@@ -873,6 +875,10 @@ class Dart2JSBackend(HtmlDartGenerator):
annotations = FindAnnotations(idl_type, self._interface.id, member_name)
if annotations:
return '%s\n ' % annotations
+ return_type = self.SecureOutputType(idl_type)
+ native_type = self._NarrowToImplementationType(idl_type)
+ if native_type != return_type:
+ return "@Returns('%s') @Creates('%s')\n " % (native_type, native_type)
else:
return ''
« no previous file with comments | « sdk/lib/html/scripts/generator.py ('k') | sdk/lib/html/templates/html/dart2js/factoryprovider_MutationObserver.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698