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

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

Issue 11369243: Make Exception a class, not an interface, and remove the const constructor. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated. Moved safeToString to Error. 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sdk/lib/html/dart2js/html_dart2js.dart ('k') | sdk/lib/io/file_impl.dart » ('j') | 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 791 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 GenerateCall(operation, argument_count, checks) 802 GenerateCall(operation, argument_count, checks)
803 803
804 # TODO: Optimize the dispatch to avoid repeated checks. 804 # TODO: Optimize the dispatch to avoid repeated checks.
805 if len(operations) > 1: 805 if len(operations) > 1:
806 for operation in operations: 806 for operation in operations:
807 for position, argument in enumerate(operation.arguments): 807 for position, argument in enumerate(operation.arguments):
808 if self._IsOptional(operation, argument): 808 if self._IsOptional(operation, argument):
809 GenerateChecksAndCall(operation, position) 809 GenerateChecksAndCall(operation, position)
810 GenerateChecksAndCall(operation, len(operation.arguments)) 810 GenerateChecksAndCall(operation, len(operation.arguments))
811 body.Emit( 811 body.Emit(
812 ' throw const Exception("Incorrect number or type of arguments");' 812 ' throw new ArgumentError("Incorrect number or type of arguments"); '
813 '\n'); 813 '\n');
814 else: 814 else:
815 operation = operations[0] 815 operation = operations[0]
816 argument_count = len(operation.arguments) 816 argument_count = len(operation.arguments)
817 for position, argument in list(enumerate(operation.arguments))[::-1]: 817 for position, argument in list(enumerate(operation.arguments))[::-1]:
818 if self._IsOptional(operation, argument): 818 if self._IsOptional(operation, argument):
819 check = '?%s' % parameter_names[position] 819 check = '?%s' % parameter_names[position]
820 GenerateCall(operation, position + 1, [check]) 820 GenerateCall(operation, position + 1, [check])
821 argument_count = position 821 argument_count = position
822 GenerateCall(operation, argument_count, []) 822 GenerateCall(operation, argument_count, [])
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
969 'svg': DartLibrary('svg', template_loader, library_type, output_dir), 969 'svg': DartLibrary('svg', template_loader, library_type, output_dir),
970 'html': DartLibrary('html', template_loader, library_type, output_dir), 970 'html': DartLibrary('html', template_loader, library_type, output_dir),
971 } 971 }
972 972
973 def AddFile(self, basename, library_name, path): 973 def AddFile(self, basename, library_name, path):
974 self._libraries[library_name].AddFile(path) 974 self._libraries[library_name].AddFile(path)
975 975
976 def Emit(self, emitter, auxiliary_dir): 976 def Emit(self, emitter, auxiliary_dir):
977 for lib in self._libraries.values(): 977 for lib in self._libraries.values():
978 lib.Emit(emitter, auxiliary_dir) 978 lib.Emit(emitter, auxiliary_dir)
OLDNEW
« no previous file with comments | « sdk/lib/html/dart2js/html_dart2js.dart ('k') | sdk/lib/io/file_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698