Skip to content

Commit

Permalink
Merge pull request #835 from bh11/DeclareSynonym
Browse files Browse the repository at this point in the history
allow repeated use of same DeclareSynonym call
  • Loading branch information
bh11 authored Jun 25, 2016
2 parents 03a5c5d + 53149ae commit 3acf246
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions lib/coll.gd
Original file line number Diff line number Diff line change
Expand Up @@ -337,18 +337,24 @@ end );
## <#/GAPDoc>
##
BIND_GLOBAL( "DeclareSynonym", function( name, value )
BIND_GLOBAL( name, value );
if ISBOUND_GLOBAL(name) and IS_IDENTICAL_OBJ(VALUE_GLOBAL(name), value) then
if not REREADING then
INFO_DEBUG( 1, "multiple declarations for synonym `", name, "'\n" );
fi;
else
BIND_GLOBAL( name, value );
fi;
end );

BIND_GLOBAL( "DeclareSynonymAttr", function( name, value )
local nname;
BIND_GLOBAL( name, value );
DeclareSynonym( name, value );
nname:= "Set";
APPEND_LIST_INTR( nname, name );
BIND_GLOBAL( nname, Setter( value ) );
DeclareSynonym( nname, Setter( value ) );
nname:= "Has";
APPEND_LIST_INTR( nname, name );
BIND_GLOBAL( nname, Tester( value ) );
DeclareSynonym( nname, Tester( value ) );
end );


Expand Down

0 comments on commit 3acf246

Please sign in to comment.