keriwarr / orangejoos

JOOS1W Compiler, written in Crystal
0 stars 1 forks source link

nameres: do not resolve this-fields in static methods #55

Closed lgo closed 6 years ago

lgo commented 6 years ago

Previously, within static methods we would resolve static fields with implicit-this. As it is a static method, there is no implicit-this. For example:

public class A {
  public static int x = 1;
  public static int foo() {
    return x;
  }
}

The x call is not allowed as it is implicitly referencing A there. Instead, it must be used as A.x.

+1 test (in typing, not sure if this would impact A2 tests)