"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/main/java/org/codehaus/groovy/classgen/VariableScopeVisitor.java" between
apache-groovy-src-3.0.8.zip and apache-groovy-src-3.0.9.zip

About: Groovy is an agile dynamic (scripting) language for the Java Platform. It has features similar to those of Python, Ruby, Perl, and Smalltalk. Source release.

VariableScopeVisitor.java  (apache-groovy-src-3.0.8):VariableScopeVisitor.java  (apache-groovy-src-3.0.9)
skipping to change at line 238 skipping to change at line 238
var = scope.getReferencedClassVariable(name); var = scope.getReferencedClassVariable(name);
if (var != null) { if (var != null) {
variable = var; variable = var;
break; break;
} }
ClassNode node = scope.getClassScope(); ClassNode node = scope.getClassScope();
if (node != null) { if (node != null) {
Variable member = findClassMember(node, name); Variable member = findClassMember(node, name);
boolean requireStatic = (crossingStaticContext || inSpecialConst ructorCall);
while (member == null && node.getOuterClass() != null && !isAnon ymous(node)) { while (member == null && node.getOuterClass() != null && !isAnon ymous(node)) {
crossingStaticContext = (crossingStaticContext || isStatic(n ode.getModifiers())); requireStatic = requireStatic || isStatic(node.getModifiers( ));
member = findClassMember((node = node.getOuterClass()), name ); member = findClassMember((node = node.getOuterClass()), name );
} }
if (member != null) { if (member != null) {
boolean staticScope = (crossingStaticContext || inSpecialCon // prevent a static context (e.g. a static method) from acce
structorCall), staticMember = member.isInStaticContext(); ssing a non-static member (e.g. a non-static field)
// prevent a static context (e.g. a static method) from acce if (requireStatic ? member.isInStaticContext() : !node.isScr
ssing a non-static variable (e.g. a non-static field) ipt()) {
if (!(staticScope && !staticMember)) {
variable = member; variable = member;
} }
} }
// GROOVY-5961
if (!isAnonymous(scope.getClassScope())) break; if (!isAnonymous(scope.getClassScope())) break; // GROOVY-5961
} }
scope = scope.getParent(); scope = scope.getParent();
} }
if (variable == null) { if (variable == null) {
variable = new DynamicVariable(name, crossingStaticContext); variable = new DynamicVariable(name, crossingStaticContext);
} }
boolean isClassVariable = (scope.isClassScope() && !scope.isReferencedLo calVariable(name)) boolean isClassVariable = (scope.isClassScope() && !scope.isReferencedLo calVariable(name))
|| (scope.isReferencedClassVariable(name) && scope.getDeclaredVariab le(name) == null); || (scope.isReferencedClassVariable(name) && scope.getDeclaredVariab le(name) == null);
VariableScope end = scope; VariableScope end = scope;
 End of changes. 4 change blocks. 
8 lines changed or deleted 8 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)