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.
7 from catapult_base
.refactor
.annotated_symbol
import base_symbol
15 class Class(base_symbol
.AnnotatedSymbol
):
17 def Annotate(cls
, symbol_type
, children
):
18 if symbol_type
!= symbol
.stmt
:
21 compound_statement
= children
[0]
22 if compound_statement
.type != symbol
.compound_stmt
:
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
)
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
)
47 def Paste(self
, child
):
48 self
.suite
.Paste(child
)