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

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

Issue 11968047: Fixing formatting of dart:html's dart2js annotations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
Index: tools/dom/scripts/systemhtml.py
diff --git a/tools/dom/scripts/systemhtml.py b/tools/dom/scripts/systemhtml.py
index df952caad4e91f41952e9d1ece68cd3bcaedf9db..feda7d4498c5c2434af1672b3e7944130257f898 100644
--- a/tools/dom/scripts/systemhtml.py
+++ b/tools/dom/scripts/systemhtml.py
@@ -393,15 +393,13 @@ class HtmlDartInterfaceGenerator(object):
if implements:
implements_str = ' implements ' + ', '.join(set(implements))
- annotations = FindCommonAnnotations(self._interface.doc_js_name)
- annotations_str = ''
- if annotations:
- annotations_str = '\n' + '\n'.join(annotations)
+ annotations = FormatAnnotations(
+ FindCommonAnnotations(self._interface.doc_js_name), '')
self._implementation_members_emitter = implementation_emitter.Emit(
self._backend.ImplementationTemplate(),
LIBRARYNAME=self._library_name,
- ANNOTATIONS=annotations_str,
+ ANNOTATIONS=annotations,
CLASSNAME=self._interface_type_info.implementation_name(),
EXTENDS=' extends %s' % base_class if base_class else '',
IMPLEMENTS=implements_str,
@@ -922,19 +920,20 @@ class Dart2JSBackend(HtmlDartGenerator):
return "@JSName('%s')\n " % idl_name
return ''
- def _Annotations(self, idl_type, idl_member_name):
- out = ''
+ def _Annotations(self, idl_type, idl_member_name, indent=' '):
annotations = FindDart2JSAnnotations(idl_type, self._interface.id,
idl_member_name)
- if annotations:
- out = '%s\n ' % annotations
+
if not AnyConversionAnnotations(idl_type, self._interface.id,
idl_member_name):
return_type = self.SecureOutputType(idl_type)
native_type = self._NarrowToImplementationType(idl_type)
if native_type != return_type:
- out += "@Returns('%s') @Creates('%s')\n " % (native_type, native_type)
- return out
+ annotations.extend([
+ "@Returns('%s')" % native_type,
+ "@Creates('%s')" % native_type,
+ ])
+ return FormatAnnotations(annotations, indent);
def CustomJSMembers(self):
return _js_custom_members

Powered by Google App Engine
This is Rietveld 408576698