diff --git a/CompilerForCAP/PackageInfo.g b/CompilerForCAP/PackageInfo.g index 984d71a867..2a2c0d32cc 100644 --- a/CompilerForCAP/PackageInfo.g +++ b/CompilerForCAP/PackageInfo.g @@ -10,7 +10,7 @@ SetPackageInfo( rec( PackageName := "CompilerForCAP", Subtitle := "Speed up computations in CAP categories", -Version := "2022.09-06", +Version := "2022.09-07", Date := Concatenation( "01/", ~.Version{[ 6, 7 ]}, "/", ~.Version{[ 1 .. 4 ]} ), License := "GPL-2.0-or-later", diff --git a/CompilerForCAP/gap/InferDataTypes.gi b/CompilerForCAP/gap/InferDataTypes.gi index 604552f255..0417b3c798 100644 --- a/CompilerForCAP/gap/InferDataTypes.gi +++ b/CompilerForCAP/gap/InferDataTypes.gi @@ -866,6 +866,12 @@ CapJitAddTypeSignature( "CreateCapCategoryObjectWithAttributes", [ IsCapCategory end ); +CapJitAddTypeSignature( "CreateCapCategoryObjectWithAttributes", [ IsCapCategory, IsFunction, IsObject, IsFunction, IsObject, IsFunction, IsObject ], function ( input_types ) + + return CapJitDataTypeOfObjectOfCategory( input_types[1].category ); + +end ); + CapJitAddTypeSignature( "CreateCapCategoryMorphismWithAttributes", [ IsCapCategory, IsCapCategoryObject, IsCapCategoryObject ], function ( input_types ) return CapJitDataTypeOfMorphismOfCategory( input_types[1].category ); diff --git a/CompilerForCAP/gap/Tools.gd b/CompilerForCAP/gap/Tools.gd index 276c70ecd9..75627d474a 100644 --- a/CompilerForCAP/gap/Tools.gd +++ b/CompilerForCAP/gap/Tools.gd @@ -142,12 +142,17 @@ DeclareOperation( "ForAllOp", [ IsRecord, IsFunction ] ); DeclareOperation( "ForAnyOp", [ IsRecord, IsFunction ] ); DeclareOperation( "Iterator", [ IsRecord ] ); +#! @Description +#! Prints args... followed by the location of the currently compiled function. +#! @Arguments args... +DeclareGlobalFunction( "PrintWithCurrentlyCompiledFunctionLocation" ); + #! @Description #! Displays obj followed by the location of the currently compiled function. #! @Arguments obj DeclareGlobalFunction( "DisplayWithCurrentlyCompiledFunctionLocation" ); #! @Description -#! Prints obj as an error followed by the location of the currently compiled function. -#! @Arguments obj +#! Prints args... as an error followed by the location of the currently compiled function. +#! @Arguments args... DeclareGlobalFunction( "ErrorWithCurrentlyCompiledFunctionLocation" ); diff --git a/CompilerForCAP/gap/Tools.gi b/CompilerForCAP/gap/Tools.gi index 3bbd12c756..b7d78b3dcb 100644 --- a/CompilerForCAP/gap/Tools.gi +++ b/CompilerForCAP/gap/Tools.gi @@ -820,6 +820,23 @@ InstallMethod( Iterator, end ); +InstallGlobalFunction( PrintWithCurrentlyCompiledFunctionLocation, function ( args... ) + local func; + + # COVERAGE_IGNORE_BLOCK_START + if IsEmpty( CAP_JIT_INTERNAL_COMPILED_FUNCTIONS_STACK ) then + + CallFuncList( Print, Concatenation( args, [ "\nwhile not compiling a function. This should never happen.\n" ] ) ); + + fi; + + func := Last( CAP_JIT_INTERNAL_COMPILED_FUNCTIONS_STACK ); + + CallFuncList( Print, Concatenation( args, [ "\nwhile compiling function with name \"", NameFunction( func ), "\"\nlocated at ", FilenameFunc( func ), ":", StartlineFunc( func ), "\n\n" ] ) ); + # COVERAGE_IGNORE_BLOCK_END + +end ); + InstallGlobalFunction( DisplayWithCurrentlyCompiledFunctionLocation, function ( obj ) local func; @@ -839,19 +856,19 @@ InstallGlobalFunction( DisplayWithCurrentlyCompiledFunctionLocation, function ( end ); -InstallGlobalFunction( ErrorWithCurrentlyCompiledFunctionLocation, function ( obj ) +InstallGlobalFunction( ErrorWithCurrentlyCompiledFunctionLocation, function ( args... ) local func; # COVERAGE_IGNORE_BLOCK_START if IsEmpty( CAP_JIT_INTERNAL_COMPILED_FUNCTIONS_STACK ) then - Error( obj, "\nwhile not compiling a function. This should never happen.\n" ); + CallFuncList( Error, Concatenation( args, [ "\nwhile not compiling a function. This should never happen.\n" ] ) ); fi; func := Last( CAP_JIT_INTERNAL_COMPILED_FUNCTIONS_STACK ); - Error( obj, "\nwhile compiling function with name \"", NameFunction( func ), "\"\nlocated at ", FilenameFunc( func ), ":", StartlineFunc( func ), "\n" ); + CallFuncList( Error, Concatenation( args, [ "\nwhile compiling function with name \"", NameFunction( func ), "\"\nlocated at ", FilenameFunc( func ), ":", StartlineFunc( func ), "\n" ] ) ); # COVERAGE_IGNORE_BLOCK_END end );