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

Side by Side Diff: lib/dom/scripts/systemwrapping.py

Issue 10334003: Rework static method support. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Introducing AddStaticOperation Created 8 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 | Annotate | Revision Log
« no previous file with comments | « lib/dom/scripts/systemnative.py ('k') | lib/dom/src/native_FactoryProvidersImplementation.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 systems to generate 6 """This module provides shared functionality for the systems to generate
7 wrapping binding from the IDL database.""" 7 wrapping binding from the IDL database."""
8 8
9 import os 9 import os
10 from generator import * 10 from generator import *
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 369
370 # Process in order of ascending number of arguments to ensure missing 370 # Process in order of ascending number of arguments to ensure missing
371 # optional arguments are processed early. 371 # optional arguments are processed early.
372 overloads = sorted(info.overloads, 372 overloads = sorted(info.overloads,
373 key=lambda overload: len(overload.arguments)) 373 key=lambda overload: len(overload.arguments))
374 self._native_version = 0 374 self._native_version = 0
375 fallthrough = self.GenerateDispatch(body, info, ' ', 0, overloads) 375 fallthrough = self.GenerateDispatch(body, info, ' ', 0, overloads)
376 if fallthrough: 376 if fallthrough:
377 body.Emit(' throw "Incorrect number or type of arguments";\n'); 377 body.Emit(' throw "Incorrect number or type of arguments";\n');
378 378
379 def GenerateSingleOperation(self, emitter, info, indent, operation): 379 def AddStaticOperation(self, info):
380 pass
381
382 def GenerateSingleOperation(self, emitter, info, indent, operation):
380 """Generates a call to a single operation. 383 """Generates a call to a single operation.
381 384
382 Arguments: 385 Arguments:
383 emitter: an Emitter for the body of a block of code. 386 emitter: an Emitter for the body of a block of code.
384 info: the compound information about the operation and its overloads. 387 info: the compound information about the operation and its overloads.
385 indent: an indentation string for generated code. 388 indent: an indentation string for generated code.
386 operation: the IDLOperation to call. 389 operation: the IDLOperation to call.
387 """ 390 """
388 # TODO(sra): Do we need to distinguish calling with missing optional 391 # TODO(sra): Do we need to distinguish calling with missing optional
389 # arguments from passing 'null' which is represented as 'undefined'? 392 # arguments from passing 'null' which is represented as 'undefined'?
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 # dispatch has removed f(X), leaving only f(Y), but there is no guarantee 537 # dispatch has removed f(X), leaving only f(Y), but there is no guarantee
535 # that Y = Z-X, so we need to check for Y. 538 # that Y = Z-X, so we need to check for Y.
536 true_code = emitter.Emit( 539 true_code = emitter.Emit(
537 '$(INDENT)if ($COND) {\n' 540 '$(INDENT)if ($COND) {\n'
538 '$!TRUE' 541 '$!TRUE'
539 '$(INDENT)}\n', 542 '$(INDENT)}\n',
540 COND=test, INDENT=indent) 543 COND=test, INDENT=indent)
541 self.GenerateDispatch( 544 self.GenerateDispatch(
542 true_code, info, indent + ' ', position + 1, positive) 545 true_code, info, indent + ' ', position + 1, positive)
543 return True 546 return True
OLDNEW
« no previous file with comments | « lib/dom/scripts/systemnative.py ('k') | lib/dom/src/native_FactoryProvidersImplementation.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698