@NotNull
    @Override
    public Type transform(@NotNull State s) {
        if (locator != null) {
            Type reopened = transformExpr(locator, s);
            if (isStatic) {
                if (body != null) {
                    boolean wasStatic = Analyzer.self.staticContext;
                    Analyzer.self.setStaticContext(true);
                    transformExpr(body, reopened.table);
                    Analyzer.self.setStaticContext(wasStatic);
                }
                return Type.CONT;
            }
        }

        ClassType classType = new ClassType(name.id, s);
        classType.table.setParent(s);

        if (base != null) {
            Type baseType = transformExpr(base, s);
            if (baseType instanceof ClassType) {
                classType.addSuper(baseType);
            } else {
                Analyzer.self.putProblem(base, base + " is not a class");
            }
        }

        // Bind ClassType to name here before resolving the body because the
        // methods need this type as self.
        Binder.bind(s, name, classType, Binding.Kind.CLASS);
        classType.table.insert(Constants.SELFNAME, name, classType, Binding.Kind.SCOPE);

        if (body != null) {
            transformExpr(body, classType.table);
        }
        return Type.CONT;
    }