1 21 22 package org.armedbear.lisp; 23 24 public final class UnboundSlot extends CellError 25 { 26 private LispObject instance = NIL; 27 28 public UnboundSlot(LispObject initArgs) throws ConditionThrowable 29 { 30 super(initArgs); 31 LispObject first, second; 32 while (initArgs != NIL) { 33 first = initArgs.car(); 34 initArgs = initArgs.cdr(); 35 second = initArgs.car(); 36 if (first == Keyword.INSTANCE) { 37 instance = second; 38 break; 39 } 40 initArgs = initArgs.cdr(); 41 } 42 } 43 44 public LispObject getInstance() 45 { 46 return instance; 47 } 48 49 public String getMessage() 50 { 51 StringBuffer sb = new StringBuffer ("The slot "); 52 sb.append(safeWriteToString(getCellName())); 53 sb.append(" is unbound in the object "); 54 sb.append(safeWriteToString(instance)); 55 sb.append('.'); 56 return sb.toString(); 57 } 58 59 public LispObject typeOf() 60 { 61 return Symbol.UNBOUND_SLOT; 62 } 63 64 public LispClass classOf() 65 { 66 return BuiltInClass.UNBOUND_SLOT; 67 } 68 69 public LispObject typep(LispObject type) throws ConditionThrowable 70 { 71 if (type == Symbol.UNBOUND_SLOT) 72 return T; 73 if (type == BuiltInClass.UNBOUND_SLOT) 74 return T; 75 return super.typep(type); 76 } 77 } 78 | Popular Tags |