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

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

Issue 2857143003: dart2js_html: Fix for issue 29538 - some returned lists may be null (Closed)
Patch Set: Created 3 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 unified diff | Download patch
« no previous file with comments | « tools/dom/scripts/dartmetadata.py ('k') | no next file » | 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 the system to generate 6 """This module provides shared functionality for the system to generate
7 Dart:html APIs from the IDL database.""" 7 Dart:html APIs from the IDL database."""
8 8
9 import emitter 9 import emitter
10 import logging 10 import logging
(...skipping 1224 matching lines...) Expand 10 before | Expand all | Expand 10 after
1235 anns = self._metadata.GetDart2JSMetadata( 1235 anns = self._metadata.GetDart2JSMetadata(
1236 idl_type, self._library_name, self._interface, idl_member_name) 1236 idl_type, self._library_name, self._interface, idl_member_name)
1237 1237
1238 if not self._metadata.AnyConversionAnnotations( 1238 if not self._metadata.AnyConversionAnnotations(
1239 idl_type, self._interface.id, idl_member_name): 1239 idl_type, self._interface.id, idl_member_name):
1240 return_type = self.SecureOutputType(idl_type) 1240 return_type = self.SecureOutputType(idl_type)
1241 native_type = self._NarrowToImplementationType(idl_type) 1241 native_type = self._NarrowToImplementationType(idl_type)
1242 1242
1243 if native_type != return_type: 1243 if native_type != return_type:
1244 anns = anns + [ 1244 anns = anns + [
1245 "@Returns('%s')" % native_type, 1245 "@Returns('%s|Null')" % native_type,
1246 "@Creates('%s')" % native_type, 1246 "@Creates('%s')" % native_type,
1247 ] 1247 ]
1248 if dart_type == 'dynamic' or dart_type == 'Object': 1248 if dart_type == 'dynamic' or dart_type == 'Object':
1249 def js_type_annotation(ann): 1249 def js_type_annotation(ann):
1250 return re.search('^@.*Returns', ann) or re.search('^@.*Creates', ann) 1250 return re.search('^@.*Returns', ann) or re.search('^@.*Creates', ann)
1251 if not filter(js_type_annotation, anns): 1251 if not filter(js_type_annotation, anns):
1252 _logger.warn('Member with wildcard native type: %s.%s' % 1252 _logger.warn('Member with wildcard native type: %s.%s' %
1253 (self._interface.id, idl_member_name)) 1253 (self._interface.id, idl_member_name))
1254 1254
1255 return self._metadata.FormatMetadata(anns, indent); 1255 return self._metadata.FormatMetadata(anns, indent);
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
1379 1379
1380 def AddFile(self, basename, library_name, path): 1380 def AddFile(self, basename, library_name, path):
1381 self._libraries[library_name].AddFile(path) 1381 self._libraries[library_name].AddFile(path)
1382 1382
1383 def AddTypeEntry(self, library_name, idl_name, dart_name): 1383 def AddTypeEntry(self, library_name, idl_name, dart_name):
1384 self._libraries[library_name].AddTypeEntry(idl_name, dart_name) 1384 self._libraries[library_name].AddTypeEntry(idl_name, dart_name)
1385 1385
1386 def Emit(self, emitter, auxiliary_dir): 1386 def Emit(self, emitter, auxiliary_dir):
1387 for lib in self._libraries.values(): 1387 for lib in self._libraries.values():
1388 lib.Emit(emitter, auxiliary_dir) 1388 lib.Emit(emitter, auxiliary_dir)
OLDNEW
« no previous file with comments | « tools/dom/scripts/dartmetadata.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698