From 59b176c24ed2ed18e7dcc2a9d27d4ca4edd4eaf1 Mon Sep 17 00:00:00 2001
From: Connor Wood <connorwood71@gmail.com>
Date: Mon, 24 Jul 2017 09:09:07 +0100
Subject: [PATCH] Implemented path parent character "^" when calculating scope
 paths

---
 src/acpi/aml/namespace.rs | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/acpi/aml/namespace.rs b/src/acpi/aml/namespace.rs
index 9c7f5645..8c18f1a3 100644
--- a/src/acpi/aml/namespace.rs
+++ b/src/acpi/aml/namespace.rs
@@ -1,5 +1,6 @@
 use alloc::boxed::Box;
 use collections::string::String;
+use collections::string::ToString;
 use collections::vec::Vec;
 
 use core::fmt::{Debug, Formatter, Error};
@@ -174,7 +175,7 @@ impl Method {
 
 pub fn get_namespace_string(current: String, modifier_v: AmlValue) -> String {
     // TODO: Type error if modifier not string
-    let modifier = if let Ok(s) = modifier_v.get_as_string() {
+    let mut modifier = if let Ok(s) = modifier_v.get_as_string() {
         s
     } else {
         return current;
@@ -192,12 +193,15 @@ pub fn get_namespace_string(current: String, modifier_v: AmlValue) -> String {
         return modifier;
     }
 
+    let mut namespace = current.clone();
+
     if modifier.starts_with("^") {
-        // TODO
+        while modifier.starts_with("^") {
+            modifier = modifier[1..].to_string();
+            while namespace.pop() != Some('.') { }
+        }
     }
 
-    let mut namespace = current.clone();
-
     if !namespace.ends_with("\\") {
         namespace.push('.');
     }
-- 
GitLab