From d1d1a2a4a0513fdba208f4bbc4bef7fecbcd80de Mon Sep 17 00:00:00 2001 From: arookas Date: Mon, 28 Dec 2015 01:09:43 -0500 Subject: [PATCH] Added script- and function- roots. --- ssc/scope stack.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ssc/scope stack.cs b/ssc/scope stack.cs index 26376d0..379beca 100644 --- a/ssc/scope stack.cs +++ b/ssc/scope stack.cs @@ -12,7 +12,9 @@ namespace arookas public int Count { get { return Stack.Count; } } - public sunScope Root { get { return this[0]; } } + public sunScope Root { get { return this.FirstOrDefault(i => i.Type == Top.Type); } } + public sunScope Script { get { return this.FirstOrDefault(i => i.Type == sunScopeType.Script); } } + public sunScope Function { get { return this.FirstOrDefault(i => i.Type == sunScopeType.Function); } } public sunScope Top { get { return this[Count - 1]; } } public sunScope this[int index] { get { return Stack[index]; } }