Changeset 8424


Ignore:
Timestamp:
01/31/05 17:19:35 (17 years ago)
Author:
piso
Message:

%DEFUN, FSET: call checkRedefinition().

File:
1 edited

Legend:

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

    r8369 r8424  
    22 * Primitives.java
    33 *
    4  * Copyright (C) 2002-2004 Peter Graves
    5  * $Id: Primitives.java,v 1.727 2005-01-19 01:46:16 piso Exp $
     4 * Copyright (C) 2002-2005 Peter Graves
     5 * $Id: Primitives.java,v 1.728 2005-01-31 17:19:35 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    758758
    759759    // ### fboundp
    760     private static final Primitive FBOUNDP = new Primitive("fboundp","name")
     760    private static final Primitive FBOUNDP = new Primitive("fboundp", "name")
    761761    {
    762762        public LispObject execute(LispObject arg) throws ConditionThrowable
     
    775775
    776776    // ### fmakunbound
    777     private static final Primitive FMAKUNBOUND = new Primitive("fmakunbound","name")
     777    private static final Primitive FMAKUNBOUND =
     778        new Primitive("fmakunbound", "name")
    778779    {
    779780        public LispObject execute(LispObject arg) throws ConditionThrowable
     
    790791
    791792    // ### remprop
    792     private static final Primitive REMPROP = new Primitive("remprop","symbol indicator")
     793    private static final Primitive REMPROP =
     794        new Primitive("remprop", "symbol indicator")
    793795    {
    794796        public LispObject execute(LispObject first, LispObject second)
     
    14341436        internSpecial("*SIMPLE-FORMAT-FUNCTION*", PACKAGE_SYS, _FORMAT);
    14351437
     1438    private static void checkRedefinition(LispObject arg)
     1439        throws ConditionThrowable
     1440    {
     1441        if (_WARN_ON_REDEFINITION_.symbolValue() != NIL) {
     1442            if (arg instanceof Symbol) {
     1443                LispObject oldDefinition = arg.getSymbolFunction();
     1444                if (oldDefinition != null && !(oldDefinition instanceof Autoload))
     1445                    Symbol.STYLE_WARN.execute(new SimpleString("redefining ~S"),
     1446                                              arg);
     1447            }
     1448        }
     1449    }
     1450
    14361451    // ### %defun
    14371452    // %defun name arglist body &optional environment => name
     
    14691484                return signal(new TypeError(first.writeToString() +
    14701485                                            " is not a valid function name."));
     1486            checkRedefinition(first);
    14711487            LispObject arglist = checkList(second);
    14721488            LispObject body = checkList(third);
     
    28882904        {
    28892905            if (first instanceof Symbol) {
     2906                checkRedefinition(first);
    28902907                Symbol symbol = (Symbol) first;
    28912908                symbol.setSymbolFunction(second);
     
    28992916            } else if (first instanceof Cons && first.car() == Symbol.SETF) {
    29002917                // SETF function
     2918                checkRedefinition(first);
    29012919                Symbol symbol = checkSymbol(first.cadr());
    29022920                put(symbol, Symbol._SETF_FUNCTION, second);
Note: See TracChangeset for help on using the changeset viewer.