// Path: src/stone/StoneException.java
// public class StoneException extends RuntimeException {
//     public StoneException(String m) { super(m); }
//     public StoneException(String m, ASTree t) {
//         super(m + " " + t.location());
//     }
// }
// 
// Path: src/stone/ast/ClassBody.java
// public class ClassBody extends ASTList {
//     public ClassBody(List<ASTree> c) { super(c); }
// }
// 
// Path: src/stone/ast/ClassStmnt.java
// public class ClassStmnt extends ASTList {
//     public ClassStmnt(List<ASTree> c) { super(c); }
//     public String name() { return ((ASTLeaf)child(0)).token().getText(); }
//     public String superClass() {
//         if (numChildren() < 3)
//             return null;
//         else
//             return ((ASTLeaf)child(1)).token().getText();
//     }
//     public ClassBody body() { return (ClassBody)child(numChildren() - 1); }
//     public String toString() {
//         String parent = superClass();
//         if (parent == null)
//             parent = "*";
//         return "(class " + name() + " " + parent + " " + body() + ")";
//     }
// }
// 
// Path: src/chap6/Environment.java
// public interface Environment {
//     void put(String name, Object value);
//     Object get(String name);
// }


import stone.StoneException;
import stone.ast.ClassBody;
import stone.ast.ClassStmnt;
import chap6.Environment;
package chap9;

public class ClassInfo {
    protected ClassStmnt definition;
    protected Environment environment;
    protected ClassInfo superClass;
    public ClassInfo(ClassStmnt cs, Environment env) {
        definition = cs;
        environment = env;
        Object obj = env.get(cs.superClass());
        if (obj == null)
            superClass = null;
        else if (obj instanceof ClassInfo)
            superClass = (ClassInfo)obj;
        else
            throw new StoneException("unknown super class: " + cs.superClass(),
                                     cs);
    }
    public String name() { return definition.name(); }
    public ClassInfo superClass() { return superClass; }
// Path: src/stone/StoneException.java
// public class StoneException extends RuntimeException {
//     public StoneException(String m) { super(m); }
//     public StoneException(String m, ASTree t) {
//         super(m + " " + t.location());
//     }
// }
// 
// Path: src/stone/ast/ClassBody.java
// public class ClassBody extends ASTList {
//     public ClassBody(List<ASTree> c) { super(c); }
// }
// 
// Path: src/stone/ast/ClassStmnt.java
// public class ClassStmnt extends ASTList {
//     public ClassStmnt(List<ASTree> c) { super(c); }
//     public String name() { return ((ASTLeaf)child(0)).token().getText(); }
//     public String superClass() {
//         if (numChildren() < 3)
//             return null;
//         else
//             return ((ASTLeaf)child(1)).token().getText();
//     }
//     public ClassBody body() { return (ClassBody)child(numChildren() - 1); }
//     public String toString() {
//         String parent = superClass();
//         if (parent == null)
//             parent = "*";
//         return "(class " + name() + " " + parent + " " + body() + ")";
//     }
// }
// 
// Path: src/chap6/Environment.java
// public interface Environment {
//     void put(String name, Object value);
//     Object get(String name);
// }


// Path: src/chap9/ClassInfo.java
import stone.StoneException;
import stone.ast.ClassBody;
import stone.ast.ClassStmnt;
import chap6.Environment;

package chap9;

public class ClassInfo {
    protected ClassStmnt definition;
    protected Environment environment;
    protected ClassInfo superClass;
    public ClassInfo(ClassStmnt cs, Environment env) {
        definition = cs;
        environment = env;
        Object obj = env.get(cs.superClass());
        if (obj == null)
            superClass = null;
        else if (obj instanceof ClassInfo)
            superClass = (ClassInfo)obj;
        else
            throw new StoneException("unknown super class: " + cs.superClass(),
                                     cs);
    }
    public String name() { return definition.name(); }
    public ClassInfo superClass() { return superClass; }
    public ClassBody body() { return definition.body(); }