Changeset 10342


Ignore:
Timestamp:
11/04/05 10:59:22 (16 years ago)
Author:
piso
Message:

SIMPLE-CONDITION-FORMAT-CONTROL, SIMPLE-CONDITION-FORMAT-ARGUMENTS: arg might not be instanceof Condition.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/j/src/org/armedbear/lisp/SimpleCondition.java

    r10295 r10342  
    33 *
    44 * Copyright (C) 2003-2005 Peter Graves
    5  * $Id: SimpleCondition.java,v 1.14 2005-10-31 12:25:03 piso Exp $
     5 * $Id: SimpleCondition.java,v 1.15 2005-11-04 10:59:22 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    7272        public LispObject execute(LispObject arg) throws ConditionThrowable
    7373        {
    74             if (arg instanceof Condition)
    75                 return ((Condition)arg).getFormatControl();
    76             return signalTypeError(arg, Symbol.CONDITION);
     74            final StandardObject obj;
     75            try {
     76                obj = (StandardObject) arg;
     77            }
     78            catch (ClassCastException e) {
     79                return signalTypeError(arg, Symbol.STANDARD_OBJECT);
     80            }
     81            return obj.getInstanceSlotValue(Symbol.FORMAT_CONTROL);
    7782        }
    7883    };
     
    8489        public LispObject execute(LispObject arg) throws ConditionThrowable
    8590        {
    86             if (arg instanceof Condition)
    87                 return ((Condition)arg).getFormatArguments();
    88             return signalTypeError(arg, Symbol.CONDITION);
     91            final StandardObject obj;
     92            try {
     93                obj = (StandardObject) arg;
     94            }
     95            catch (ClassCastException e) {
     96                return signalTypeError(arg, Symbol.STANDARD_OBJECT);
     97            }
     98            return obj.getInstanceSlotValue(Symbol.FORMAT_ARGUMENTS);
    8999        }
    90100    };
Note: See TracChangeset for help on using the changeset viewer.