raven-compiler/src/main/java/org/raven/compiler/Method.java
/**
     * Access a locally defined field or variable
     *
     * @param name The field name
     * @param load whether we are reading or writing to the field
     */
Access a locally defined field or variable
@param name The field name
@param load whether we are reading or writing to the field
Access a locally defined field or variable @param name The field name @param load whether we are reading or writing to the field
private void accessLocalField(final String name, final boolean load) {
        final VarDecl decl = SymbolMap.resolveField(ctx.getOwner(), ctx.getOwner(), name);
        final VarDecl var = ctx.getClassDef().findVar(name);
        if (ctx.isStatic()) {
            if (decl != null && decl.hasModifier(Modifier.STATIC)) {
                accessStaticField(ctx.getOwner(), decl.getName().toString(), load);
            } else if (decl != null) {
                Errors.put("Use of non-static variable " + name + " in a static context");
            } else {
                Errors.put("Variable " + name + " has not been defined.");
            }
        } else if ((decl != null && decl.hasModifier(Modifier.STATIC))) {
            accessStaticField(ctx.getOwner(), decl.getName().toString(), load);
        } else if (var != null && var.hasModifier(Modifier.STATIC)) {
            accessStaticField(var.getTypeDesc(), var.getName().toString(), load);
        } else {
            if (var != null) {
                accessVirtualField(decl, load);
            } else if (decl != null) {
                visitVarInsn(ALOAD, getLocal("this"));
                visitMethodInsn(INVOKESTATIC, getInternalName(Intrinsics.class), "wrap", getDesc(Intrinsics.class, "wrap", Object.class), false);
                visitTypeInsn(CHECKCAST, getInternalName(TObject.class));
                accessVirtualField(name, load);
            } else {
                Errors.put("Variable " + name + " has not been defined.");
            }
        }
    }
private void accessLocalField ( final String name , final boolean load ) { final VarDecl decl = SymbolMap . resolveField ( ctx . getOwner ( ) , ctx . getOwner ( ) , name ) ; final VarDecl var = ctx . getClassDef ( ) . findVar ( name ) ; if ( ctx . isStatic ( ) ) { if ( decl != null && decl . hasModifier ( Modifier . STATIC ) ) { accessStaticField ( ctx . getOwner ( ) , decl . getName ( ) . toString ( ) , load ) ; } else if ( decl != null ) { Errors . put ( "Use of non-static variable " + name + " in a static context" ) ; } else { Errors . put ( "Variable " + name + " has not been defined." ) ; } } else if ( ( decl != null && decl . hasModifier ( Modifier . STATIC ) ) ) { accessStaticField ( ctx . getOwner ( ) , decl . getName ( ) . toString ( ) , load ) ; } else if ( var != null && var . hasModifier ( Modifier . STATIC ) ) { accessStaticField ( var . getTypeDesc ( ) , var . getName ( ) . toString ( ) , load ) ; } else { if ( var != null ) { accessVirtualField ( decl , load ) ; } else if ( decl != null ) { visitVarInsn ( ALOAD , getLocal ( "this" ) ) ; visitMethodInsn ( INVOKESTATIC , getInternalName ( Intrinsics . class ) , "wrap" , getDesc ( Intrinsics . class , "wrap" , Object . class ) , false ) ; visitTypeInsn ( CHECKCAST , getInternalName ( TObject . class ) ) ; accessVirtualField ( name , load ) ; } else { Errors . put ( "Variable " + name + " has not been defined." ) ; } } }
Access a locally defined field or variable
 @param name The field name
 @param load whether we are reading or writing to the field
Access a locally defined field or variable @param name The field name @param load whether we are reading or writing to the field
// static field access in the same class