base/threading: remove ScopedTracker placed for experiments
[chromium-blink-merge.git] / tools / telemetry / catapult_base / refactor / annotated_symbol / function_definition.py
blobd6accab1d3aa7cf19579d221b20c00a6eae3db74
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 'Function',
15 class Function(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.funcdef:
27 return cls(statement.type, statement.children)
28 elif (statement.type == symbol.decorated and
29 statement.children[-1].type == symbol.funcdef):
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)