Changeset 5083


Ignore:
Timestamp:
12/12/03 13:18:28 (17 years ago)
Author:
piso
Message:

TYPE-ERROR-DATUM, TYPE-ERROR-EXPECTED-TYPE

File:
1 edited

Legend:

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

    r5080 r5083  
    33 *
    44 * Copyright (C) 2002-2003 Peter Graves
    5  * $Id: TypeError.java,v 1.10 2003-12-12 13:03:15 piso Exp $
     5 * $Id: TypeError.java,v 1.11 2003-12-12 13:18:28 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    3030    public TypeError()
    3131    {
     32        datum = NIL;
     33        expectedType = NIL;
    3234    }
    3335
     
    111113        return sb.toString();
    112114    }
     115
     116    private static final Primitive1 TYPE_ERROR_DATUM =
     117        new Primitive1("type-error-datum", "condition")
     118    {
     119        public LispObject execute(LispObject arg) throws ConditionThrowable
     120        {
     121            if (arg instanceof TypeError)
     122                return ((TypeError)arg).datum;
     123            throw new ConditionThrowable(new TypeError(arg, Symbol.TYPE_ERROR));
     124        }
     125    };
     126
     127    private static final Primitive1 TYPE_ERROR_EXPECTED_TYPE =
     128        new Primitive1("type-error-expected-type", "condition")
     129    {
     130        public LispObject execute(LispObject arg) throws ConditionThrowable
     131        {
     132            if (arg instanceof TypeError)
     133                return ((TypeError)arg).expectedType;
     134            throw new ConditionThrowable(new TypeError(arg, Symbol.TYPE_ERROR));
     135        }
     136    };
    113137}
Note: See TracChangeset for help on using the changeset viewer.