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

Side by Side Diff: lib/html/scripts/systemhtml.py

Issue 11086017: Fix some type narrowing (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « lib/html/dart2js/html_dart2js.dart ('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 os 10 import os
(...skipping 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after
1050 1050
1051 def _NarrowToImplementationType(self, type_name): 1051 def _NarrowToImplementationType(self, type_name):
1052 if type_name == 'Dynamic': 1052 if type_name == 'Dynamic':
1053 return type_name 1053 return type_name
1054 return self._type_registry.TypeInfo(type_name).narrow_dart_type() 1054 return self._type_registry.TypeInfo(type_name).narrow_dart_type()
1055 1055
1056 def _NarrowInputType(self, type_name): 1056 def _NarrowInputType(self, type_name):
1057 return self._NarrowToImplementationType(type_name) 1057 return self._NarrowToImplementationType(type_name)
1058 1058
1059 def _NarrowOutputType(self, type_name): 1059 def _NarrowOutputType(self, type_name):
1060 secure_name = SecureOutputType(self, type_name) 1060 secure_name = SecureOutputType(self, type_name, True)
1061 if (type_name == secure_name): 1061 return self._NarrowToImplementationType(secure_name)
1062 return self._NarrowToImplementationType(type_name)
1063 else:
1064 return secure_name
1065 1062
1066 def _FindShadowedAttribute(self, attr, merged_interfaces={}): 1063 def _FindShadowedAttribute(self, attr, merged_interfaces={}):
1067 """Returns (attribute, superinterface) or (None, None).""" 1064 """Returns (attribute, superinterface) or (None, None)."""
1068 def FindInParent(interface): 1065 def FindInParent(interface):
1069 """Returns matching attribute in parent, or None.""" 1066 """Returns matching attribute in parent, or None."""
1070 if interface.parents: 1067 if interface.parents:
1071 parent = interface.parents[0] 1068 parent = interface.parents[0]
1072 if IsDartCollectionType(parent.type.id): 1069 if IsDartCollectionType(parent.type.id):
1073 return (None, None) 1070 return (None, None)
1074 if IsPureInterface(parent.type.id): 1071 if IsPureInterface(parent.type.id):
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1129 1126
1130 library_emitter = self._multiemitter.FileEmitter(library_file_path) 1127 library_emitter = self._multiemitter.FileEmitter(library_file_path)
1131 library_file_dir = os.path.dirname(library_file_path) 1128 library_file_dir = os.path.dirname(library_file_path)
1132 auxiliary_dir = os.path.relpath(auxiliary_dir, library_file_dir) 1129 auxiliary_dir = os.path.relpath(auxiliary_dir, library_file_dir)
1133 imports_emitter = library_emitter.Emit( 1130 imports_emitter = library_emitter.Emit(
1134 self._template, AUXILIARY_DIR=massage_path(auxiliary_dir)) 1131 self._template, AUXILIARY_DIR=massage_path(auxiliary_dir))
1135 for path in sorted(self._path_to_emitter.keys()): 1132 for path in sorted(self._path_to_emitter.keys()):
1136 relpath = os.path.relpath(path, library_file_dir) 1133 relpath = os.path.relpath(path, library_file_dir)
1137 imports_emitter.Emit( 1134 imports_emitter.Emit(
1138 "#source('$PATH');\n", PATH=massage_path(relpath)) 1135 "#source('$PATH');\n", PATH=massage_path(relpath))
OLDNEW
« no previous file with comments | « lib/html/dart2js/html_dart2js.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698