Add long running gmail memory benchmark for background tab.
[chromium-blink-merge.git] / tools / telemetry / catapult_base / refactor / annotated_symbol / class_definition.py
blob8254aad9368de0d8f8db8fbd86c61c5fbdb5673c
1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 import symbol
7 from catapult_base.refactor.annotated_symbol import base_symbol
10 __all__ = [
11 'Class',
15 class Class(base_symbol.AnnotatedSymbol):
16 @classmethod
17 def Annotate(cls, symbol_type, children):
18 if symbol_type != symbol.stmt:
19 return None
21 compound_statement = children[0]
22 if compound_statement.type != symbol.compound_stmt:
23 return None
25 statement = compound_statement.children[0]
26 if statement.type == symbol.classdef:
27 return cls(statement.type, statement.children)
28 elif (statement.type == symbol.decorated and
29 statement.children[-1].type == symbol.classdef):
30 return cls(statement.type, statement.children)
31 else:
32 return None
34 @property
35 def suite(self):
36 raise NotImplementedError()
38 def FindChild(self, snippet_type, **kwargs):
39 return self.suite.FindChild(snippet_type, **kwargs)
41 def FindChildren(self, snippet_type):
42 return self.suite.FindChildren(snippet_type)
44 def Cut(self, child):
45 self.suite.Cut(child)
47 def Paste(self, child):
48 self.suite.Paste(child)