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

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: 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
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 748 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 GenerateCall(operation, argument_count, checks) 759 GenerateCall(operation, argument_count, checks)
760 760
761 # TODO: Optimize the dispatch to avoid repeated checks. 761 # TODO: Optimize the dispatch to avoid repeated checks.
762 if len(operations) > 1: 762 if len(operations) > 1:
763 for operation in operations: 763 for operation in operations:
764 for position, argument in enumerate(operation.arguments): 764 for position, argument in enumerate(operation.arguments):
765 if self._IsOptional(operation, argument): 765 if self._IsOptional(operation, argument):
766 GenerateChecksAndCall(operation, position) 766 GenerateChecksAndCall(operation, position)
767 GenerateChecksAndCall(operation, len(operation.arguments)) 767 GenerateChecksAndCall(operation, len(operation.arguments))
768 body.Emit( 768 body.Emit(
769 ' throw const Exception("Incorrect number or type of arguments");' 769 ' throw new ArgumentError("Incorrect number or type of arguments"); '
770 '\n'); 770 '\n');
771 else: 771 else:
772 operation = operations[0] 772 operation = operations[0]
773 argument_count = len(operation.arguments) 773 argument_count = len(operation.arguments)
774 for position, argument in list(enumerate(operation.arguments))[::-1]: 774 for position, argument in list(enumerate(operation.arguments))[::-1]:
775 if self._IsOptional(operation, argument): 775 if self._IsOptional(operation, argument):
776 check = '?%s' % parameter_names[position] 776 check = '?%s' % parameter_names[position]
777 GenerateCall(operation, position + 1, [check]) 777 GenerateCall(operation, position + 1, [check])
778 argument_count = position 778 argument_count = position
779 GenerateCall(operation, argument_count, []) 779 GenerateCall(operation, argument_count, [])
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
926 'svg': DartLibrary('svg', template_loader, library_type, output_dir), 926 'svg': DartLibrary('svg', template_loader, library_type, output_dir),
927 'html': DartLibrary('html', template_loader, library_type, output_dir), 927 'html': DartLibrary('html', template_loader, library_type, output_dir),
928 } 928 }
929 929
930 def AddFile(self, basename, library_name, path): 930 def AddFile(self, basename, library_name, path):
931 self._libraries[library_name].AddFile(path) 931 self._libraries[library_name].AddFile(path)
932 932
933 def Emit(self, emitter, auxiliary_dir): 933 def Emit(self, emitter, auxiliary_dir):
934 for lib in self._libraries.values(): 934 for lib in self._libraries.values():
935 lib.Emit(emitter, auxiliary_dir) 935 lib.Emit(emitter, auxiliary_dir)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698