groovy git commit: GROOVY-7894: Add access to declared variables within VariableScope (closes #370)

2016-07-29 Thread paulk
Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_4_X bd8242fb9 -> ec1f3e3f0


GROOVY-7894: Add access to declared variables within VariableScope (closes #370)


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/ec1f3e3f
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/ec1f3e3f
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/ec1f3e3f

Branch: refs/heads/GROOVY_2_4_X
Commit: ec1f3e3f0fda84dce1ff9992d4a694e295b58ab4
Parents: bd8242f
Author: Natacha Gabbamonte 
Authored: Thu Jul 21 15:32:04 2016 -0400
Committer: paulk 
Committed: Fri Jul 29 20:04:28 2016 +1000

--
 .../org/codehaus/groovy/ast/VariableScope.java  | 24 +++-
 1 file changed, 23 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/ec1f3e3f/src/main/org/codehaus/groovy/ast/VariableScope.java
--
diff --git a/src/main/org/codehaus/groovy/ast/VariableScope.java 
b/src/main/org/codehaus/groovy/ast/VariableScope.java
index b96617e..077c7f1 100644
--- a/src/main/org/codehaus/groovy/ast/VariableScope.java
+++ b/src/main/org/codehaus/groovy/ast/VariableScope.java
@@ -178,4 +178,26 @@ public class VariableScope  {
 public Iterator getReferencedClassVariablesIterator() {
 return getReferencedClassVariables().values().iterator();
 }
-}
\ No newline at end of file
+
+/**
+ * Gets a map containing the variables declared in this scope.
+ * This map cannot be modified.
+ * @return a map containing the declared variable references
+ */
+public Map getDeclaredVariables() {
+if (declaredVariables == Collections.EMPTY_MAP) {
+return declaredVariables;
+} else {
+return Collections.unmodifiableMap(declaredVariables);
+}
+}
+
+/**
+ * Gets an iterator for the declared class variables. The remove
+ * operation is not supported.
+ * @return an iterator for the declared variables
+ */
+public Iterator getDeclaredVariablesIterator() {
+return getDeclaredVariables().values().iterator();
+}
+}



groovy git commit: GROOVY-7894: Add access to declared variables within VariableScope (closes #370)

2016-07-29 Thread paulk
Repository: groovy
Updated Branches:
  refs/heads/master 571e8eea4 -> dc2e10464


GROOVY-7894: Add access to declared variables within VariableScope (closes #370)


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/dc2e1046
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/dc2e1046
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/dc2e1046

Branch: refs/heads/master
Commit: dc2e10464ca6559ba656cfe333a688bdaa7f2186
Parents: 571e8ee
Author: Natacha Gabbamonte 
Authored: Thu Jul 21 15:32:04 2016 -0400
Committer: paulk 
Committed: Fri Jul 29 19:56:15 2016 +1000

--
 .../org/codehaus/groovy/ast/VariableScope.java  | 24 +++-
 1 file changed, 23 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/dc2e1046/src/main/org/codehaus/groovy/ast/VariableScope.java
--
diff --git a/src/main/org/codehaus/groovy/ast/VariableScope.java 
b/src/main/org/codehaus/groovy/ast/VariableScope.java
index b96617e..077c7f1 100644
--- a/src/main/org/codehaus/groovy/ast/VariableScope.java
+++ b/src/main/org/codehaus/groovy/ast/VariableScope.java
@@ -178,4 +178,26 @@ public class VariableScope  {
 public Iterator getReferencedClassVariablesIterator() {
 return getReferencedClassVariables().values().iterator();
 }
-}
\ No newline at end of file
+
+/**
+ * Gets a map containing the variables declared in this scope.
+ * This map cannot be modified.
+ * @return a map containing the declared variable references
+ */
+public Map getDeclaredVariables() {
+if (declaredVariables == Collections.EMPTY_MAP) {
+return declaredVariables;
+} else {
+return Collections.unmodifiableMap(declaredVariables);
+}
+}
+
+/**
+ * Gets an iterator for the declared class variables. The remove
+ * operation is not supported.
+ * @return an iterator for the declared variables
+ */
+public Iterator getDeclaredVariablesIterator() {
+return getDeclaredVariables().values().iterator();
+}
+}