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:
Junjie Mao 2021-08-09 09:43:27 +08:00 committed by wenlingz
parent d07bd78b13
commit 25cabe14db
2 changed files with 1 additions and 5 deletions

View File

@ -233,10 +233,6 @@ class Context:
else:
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):
assert(self.__scope_history)
self.__current_scope = self.__scope_history.pop()

View File

@ -491,7 +491,7 @@ def DefCreateWordField_hook_named(context, tree, name):
def DefDevice_hook_named(context, tree, name):
sym = DeviceDecl(name, tree)
context.register_symbol(sym)
context.enter_scope(name)
context.change_scope(name)
def DefDevice_hook_post(context, tree):
context.pop_scope()