@@ -262,7 +262,7 @@ public final class Compiler {
262262 self . emit ( . pushGlobal( locRef. location!) )
263263 }
264264 case . macroExpansionRequired( _) :
265- throw EvalError . illegalKeywordUsage ( . symbol( sym) )
265+ throw RuntimeError . eval ( . illegalKeywordUsage , . symbol( sym) )
266266 }
267267 }
268268
@@ -393,7 +393,7 @@ public final class Compiler {
393393 . port( _) , . tagged( _, _) , . error( _) :
394394 self . pushConstant ( expr)
395395 case . special( _) :
396- throw EvalError . illegalKeywordUsage ( expr)
396+ throw RuntimeError . eval ( . illegalKeywordUsage , expr)
397397 case . values( _) :
398398 preconditionFailure ( " cannot push multiple values onto stack " )
399399 }
@@ -648,7 +648,7 @@ public final class Compiler {
648648 next = cdr
649649 }
650650 guard next. isNull else {
651- throw EvalError . typeError ( expr, [ . properListType] )
651+ throw RuntimeError . type ( expr, expected : [ . properListType] )
652652 }
653653 return n
654654 }
@@ -687,7 +687,7 @@ public final class Compiler {
687687 }
688688 // Throw error if the sequence is not a proper list
689689 guard next. isNull else {
690- throw EvalError . typeError ( expr, [ . properListType] )
690+ throw RuntimeError . type ( expr, expected : [ . properListType] )
691691 }
692692 // Identify internal definitions
693693 var i = 0
@@ -777,13 +777,13 @@ public final class Compiler {
777777 var prevIndex = - 1
778778 while case . pair( let binding, let rest) = bindings {
779779 guard case . pair( . symbol( let sym) , . pair( let expr, . null) ) = binding else {
780- throw EvalError . malformedBindings ( binding, bindingList)
780+ throw RuntimeError . eval ( . malformedBinding , binding, bindingList)
781781 }
782782 try self . compile ( expr, in: env, inTailPos: false )
783783 self . patchMakeClosure ( sym)
784784 let binding = group. allocBindingFor ( sym)
785785 guard binding. index > prevIndex else {
786- throw EvalError . duplicateBinding ( sym, bindingList)
786+ throw RuntimeError . eval ( . duplicateBinding, . symbol ( sym) , bindingList)
787787 }
788788 if postset {
789789 definitions. append ( binding)
@@ -798,7 +798,7 @@ public final class Compiler {
798798 bindings = rest
799799 }
800800 guard bindings. isNull else {
801- throw EvalError . malformedBindings ( nil , bindingList)
801+ throw RuntimeError . eval ( . malformedBindings , bindingList)
802802 }
803803 for binding in definitions. reversed ( ) {
804804 if binding. isValue {
@@ -822,7 +822,7 @@ public final class Compiler {
822822 var prevIndex = - 1
823823 while case . pair( let binding, let rest) = bindings {
824824 guard case . pair( let variables, . pair( let expr, . null) ) = binding else {
825- throw EvalError . malformedBindings ( binding, bindingList)
825+ throw RuntimeError . eval ( . malformedBinding , binding, bindingList)
826826 }
827827 try self . compile ( expr, in: env, inTailPos: false )
828828 var vars = variables
@@ -844,12 +844,12 @@ public final class Compiler {
844844 }
845845 prevIndex = binding. index
846846 default :
847- throw EvalError . malformedBindings ( binding, bindingList)
847+ throw RuntimeError . eval ( . malformedBinding , binding, bindingList)
848848 }
849849 for sym in syms. reversed ( ) {
850850 let binding = group. allocBindingFor ( sym)
851851 guard binding. index > prevIndex else {
852- throw EvalError . duplicateBinding ( sym, bindingList)
852+ throw RuntimeError . eval ( . duplicateBinding, . symbol ( sym) , bindingList)
853853 }
854854 if binding. isValue {
855855 self . emit ( . setLocal( binding. index) )
@@ -861,7 +861,7 @@ public final class Compiler {
861861 bindings = rest
862862 }
863863 guard bindings. isNull else {
864- throw EvalError . malformedBindings ( nil , bindingList)
864+ throw RuntimeError . eval ( . malformedBindings , bindingList)
865865 }
866866 return group
867867 }
@@ -893,22 +893,22 @@ public final class Compiler {
893893 var bindings = bindingList
894894 while case . pair( let binding, let rest) = bindings {
895895 guard case . pair( . symbol( let sym) , . pair( let transformer, . null) ) = binding else {
896- throw EvalError . malformedBindings ( binding, bindingList)
896+ throw RuntimeError . eval ( . malformedBinding , binding, bindingList)
897897 }
898898 let procExpr = try self . context. machine. compileAndEval ( expr: transformer,
899899 in: env. syntacticalEnv,
900900 usingRulesEnv: env)
901901 guard case . procedure( let proc) = procExpr else {
902- throw EvalError . malformedTransformer ( transformer) //FIXME: Find better error message
902+ throw RuntimeError . eval ( . malformedTransformer , transformer) //FIXME: Find better error message
903903 }
904904 guard group. bindingFor ( sym) == nil else {
905- throw EvalError . duplicateBinding ( sym, bindingList)
905+ throw RuntimeError . eval ( . duplicateBinding, . symbol ( sym) , bindingList)
906906 }
907907 group. defineMacro ( sym, proc: proc)
908908 bindings = rest
909909 }
910910 guard bindings. isNull else {
911- throw EvalError . malformedBindings ( nil , bindingList)
911+ throw RuntimeError . eval ( . malformedBindings , bindingList)
912912 }
913913 return group
914914 }
@@ -933,7 +933,7 @@ public final class Compiler {
933933 closureCompiler. emit ( . collectRest( arguments. count) )
934934 arguments. allocBindingFor ( sym)
935935 default :
936- throw EvalError . malformedArgumentList ( arglist)
936+ throw RuntimeError . eval ( . malformedArgumentList , arglist)
937937 }
938938 closureCompiler. arguments = arguments
939939 closureCompiler. env = . local( arguments)
@@ -990,7 +990,7 @@ public final class Compiler {
990990 closureCompiler. emit ( . collectRest( arguments. count) )
991991 arguments. allocBindingFor ( sym)
992992 default :
993- throw EvalError . malformedArgumentList ( args)
993+ throw RuntimeError . eval ( . malformedArgumentList , args)
994994 }
995995 closureCompiler. arguments = arguments
996996 closureCompiler. env = . local( arguments)
@@ -1016,7 +1016,7 @@ public final class Compiler {
10161016 case . null:
10171017 closureCompiler. emit ( . noMatchingArgCount)
10181018 default :
1019- throw EvalError . malformedCaseLambda ( current)
1019+ throw RuntimeError . eval ( . malformedCaseLambda , current)
10201020 }
10211021 // Link compiled closure in the current compiler
10221022 let codeIndex = self . fragments. count
0 commit comments