board-inspector: replace enter_scope with change_scope
The method `enter_scope` of class `Context` is a reduced implementation of `change_scope` which assumes that the given name is simply a NameSeg. This method is currently only used when a new named scope is opened by a DefDevice object for historical reasons. As the other named-scope-opening objects all use `change_scope` which can handle arbitrary NameString, this patch unifies the code by removing `enter_scope` and replacing the only occurrence with `change_scope`. This also resolves the parsing of AML templates in board XMLs where device names can be more than a simple NameSeg. Tracked-On: #6287 Signed-off-by: Junjie Mao <junjie.mao@intel.com>
This commit is contained in:
parent
d07bd78b13
commit
25cabe14db
|
@ -233,10 +233,6 @@ class Context:
|
||||||
else:
|
else:
|
||||||
raise InvalidPath(new_scope)
|
raise InvalidPath(new_scope)
|
||||||
|
|
||||||
def enter_scope(self, name):
|
|
||||||
self.__scope_history.append(copy(self.__current_scope))
|
|
||||||
self.__current_scope.append(name)
|
|
||||||
|
|
||||||
def pop_scope(self):
|
def pop_scope(self):
|
||||||
assert(self.__scope_history)
|
assert(self.__scope_history)
|
||||||
self.__current_scope = self.__scope_history.pop()
|
self.__current_scope = self.__scope_history.pop()
|
||||||
|
|
|
@ -491,7 +491,7 @@ def DefCreateWordField_hook_named(context, tree, name):
|
||||||
def DefDevice_hook_named(context, tree, name):
|
def DefDevice_hook_named(context, tree, name):
|
||||||
sym = DeviceDecl(name, tree)
|
sym = DeviceDecl(name, tree)
|
||||||
context.register_symbol(sym)
|
context.register_symbol(sym)
|
||||||
context.enter_scope(name)
|
context.change_scope(name)
|
||||||
|
|
||||||
def DefDevice_hook_post(context, tree):
|
def DefDevice_hook_post(context, tree):
|
||||||
context.pop_scope()
|
context.pop_scope()
|
||||||
|
|
Loading…
Reference in New Issue