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

Side by Side Diff: mojo/public/tools/bindings/pylib/mojom/parse/ast.py

Issue 396243006: Mojo: Mojom: Remove redundant line. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 | « no previous file | 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 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Node classes for the AST for a Mojo IDL file.""" 5 """Node classes for the AST for a Mojo IDL file."""
6 6
7 # Note: For convenience of testing, you probably want to define __eq__() methods 7 # Note: For convenience of testing, you probably want to define __eq__() methods
8 # for all node types; it's okay to be slightly lax (e.g., not compare filename 8 # for all node types; it's okay to be slightly lax (e.g., not compare filename
9 # and lineno). You may also define __repr__() to help with analyzing test 9 # and lineno). You may also define __repr__() to help with analyzing test
10 # failures, especially for more complex types. 10 # failures, especially for more complex types.
(...skipping 14 matching lines...) Expand all
25 class NodeListBase(NodeBase): 25 class NodeListBase(NodeBase):
26 """Represents a list of other nodes, all having the same type. (This is meant 26 """Represents a list of other nodes, all having the same type. (This is meant
27 to be subclassed, with subclasses defining _list_item_type to be the class (or 27 to be subclassed, with subclasses defining _list_item_type to be the class (or
28 classes, in a tuple) of the members of the list.)""" 28 classes, in a tuple) of the members of the list.)"""
29 29
30 def __init__(self, item_or_items=None, **kwargs): 30 def __init__(self, item_or_items=None, **kwargs):
31 super(NodeListBase, self).__init__(**kwargs) 31 super(NodeListBase, self).__init__(**kwargs)
32 self.items = [] 32 self.items = []
33 if item_or_items is None: 33 if item_or_items is None:
34 pass 34 pass
35 self.items = []
36 elif isinstance(item_or_items, list): 35 elif isinstance(item_or_items, list):
37 for item in item_or_items: 36 for item in item_or_items:
38 assert isinstance(item, self._list_item_type) 37 assert isinstance(item, self._list_item_type)
39 self.Append(item) 38 self.Append(item)
40 else: 39 else:
41 assert isinstance(item_or_items, self._list_item_type) 40 assert isinstance(item_or_items, self._list_item_type)
42 self.Append(item_or_items) 41 self.Append(item_or_items)
43 42
44 # Support iteration. For everything else, users should just access |items| 43 # Support iteration. For everything else, users should just access |items|
45 # directly. (We intentionally do NOT supply |__len__()| or |__nonzero__()|, so 44 # directly. (We intentionally do NOT supply |__len__()| or |__nonzero__()|, so
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 self.ordinal == other.ordinal and \ 342 self.ordinal == other.ordinal and \
344 self.typename == other.typename and \ 343 self.typename == other.typename and \
345 self.default_value == other.default_value 344 self.default_value == other.default_value
346 345
347 346
348 # This needs to be declared after |StructField|. 347 # This needs to be declared after |StructField|.
349 class StructBody(NodeListBase): 348 class StructBody(NodeListBase):
350 """Represents the body of (i.e., list of definitions inside) a struct.""" 349 """Represents the body of (i.e., list of definitions inside) a struct."""
351 350
352 _list_item_type = (Const, Enum, StructField) 351 _list_item_type = (Const, Enum, StructField)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698