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

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

Issue 13201004: Support nullable attributes and return types in Dartium. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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 | « tools/dom/idl/dart/dart.idl ('k') | tools/dom/scripts/idlrenderer.py » ('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) 2011, the Dart project authors. Please see the AUTHORS file 2 # Copyright (c) 2011, 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 import os 6 import os
7 import sys 7 import sys
8 8
9 9
10 class IDLNode(object): 10 class IDLNode(object):
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 self.arguments = self._convert_all(arg_list_ast, 'Argument', IDLArgument) 326 self.arguments = self._convert_all(arg_list_ast, 'Argument', IDLArgument)
327 327
328 328
329 class IDLType(IDLNode): 329 class IDLType(IDLNode):
330 """IDLType is used to describe constants, attributes and operations' 330 """IDLType is used to describe constants, attributes and operations'
331 return and input types. IDLType matches AST labels such as ScopedName, 331 return and input types. IDLType matches AST labels such as ScopedName,
332 StringType, VoidType, IntegerType, etc.""" 332 StringType, VoidType, IntegerType, etc."""
333 333
334 def __init__(self, ast): 334 def __init__(self, ast):
335 IDLNode.__init__(self, ast) 335 IDLNode.__init__(self, ast)
336 self.nullable = self._has(ast, 'Nullable')
336 # Search for a 'ScopedName' or any label ending with 'Type'. 337 # Search for a 'ScopedName' or any label ending with 'Type'.
337 if isinstance(ast, list): 338 if isinstance(ast, list):
338 self.id = self._find_first(ast, 'ScopedName') 339 self.id = self._find_first(ast, 'ScopedName')
339 if not self.id: 340 if not self.id:
340 # FIXME: use regexp search instead 341 # FIXME: use regexp search instead
341 def findType(ast): 342 def findType(ast):
342 for label, childAst in ast: 343 for label, childAst in ast:
343 if label.endswith('Type'): 344 if label.endswith('Type'):
344 type = self._label_to_type(label, ast) 345 type = self._label_to_type(label, ast)
345 if type != 'sequence': 346 if type != 'sequence':
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 """IDLDictNode specialization for one annotation.""" 527 """IDLDictNode specialization for one annotation."""
527 def __init__(self, ast=None): 528 def __init__(self, ast=None):
528 IDLDictNode.__init__(self, ast) 529 IDLDictNode.__init__(self, ast)
529 self.id = None 530 self.id = None
530 if not ast: 531 if not ast:
531 return 532 return
532 for arg in self._find_all(ast, 'AnnotationArg'): 533 for arg in self._find_all(ast, 'AnnotationArg'):
533 name = self._find_first(arg, 'Id') 534 name = self._find_first(arg, 'Id')
534 value = self._find_first(arg, 'AnnotationArgValue') 535 value = self._find_first(arg, 'AnnotationArgValue')
535 self[name] = value 536 self[name] = value
OLDNEW
« no previous file with comments | « tools/dom/idl/dart/dart.idl ('k') | tools/dom/scripts/idlrenderer.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698