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 from catapult_base
.refactor
import snippet
8 class AnnotatedSymbol(snippet
.Symbol
):
9 def __init__(self
, symbol_type
, children
):
10 super(AnnotatedSymbol
, self
).__init
__(symbol_type
, children
)
11 self
._modified
= False
17 return super(AnnotatedSymbol
, self
).modified
19 def __setattr__(self
, name
, value
):
20 if (hasattr(self
.__class
__, name
) and
21 isinstance(getattr(self
.__class
__, name
), property)):
23 return super(AnnotatedSymbol
, self
).__setattr
__(name
, value
)
26 for i
in xrange(len(self
._children
)):
27 if self
._children
[i
] == child
:
32 raise ValueError('%s is not in %s.' % (child
, self
))
34 def Paste(self
, child
):
36 self
._children
.append(child
)