@@ -51,10 +51,28 @@ def bootstrap_repl(which_ns: str) -> types.ModuleType:
51
51
52
52
@cli .command (short_help = 'start the Basilisp REPL' )
53
53
@click .option ('--default-ns' , default = runtime ._REPL_DEFAULT_NS , help = 'default namespace to use for the REPL' )
54
- def repl (default_ns ):
54
+ @click .option ('--use-var-indirection' ,
55
+ default = False ,
56
+ is_flag = True ,
57
+ envvar = 'BASILISP_USE_VAR_INDIRECTION' ,
58
+ help = 'if provided, all Var accesses will be performed via Var indirection' )
59
+ @click .option ('--warn-on-shadowed-name' ,
60
+ default = False ,
61
+ is_flag = True ,
62
+ envvar = 'BASILISP_WARN_ON_SHADOWED_NAME' ,
63
+ help = 'if provided, emit warnings if a local name is shadowed by another local name' )
64
+ @click .option ('--warn-on-shadowed-var' ,
65
+ default = True ,
66
+ is_flag = True ,
67
+ envvar = 'BASILISP_WARN_ON_SHADOWED_VAR' ,
68
+ help = 'if provided, emit warnings if a Var name is shadowed by a local name' )
69
+ def repl (default_ns , use_var_indirection , warn_on_shadowed_name , warn_on_shadowed_var ):
55
70
basilisp .init ()
56
71
repl_module = bootstrap_repl (default_ns )
57
- ctx = compiler .CompilerContext ()
72
+ ctx = compiler .CompilerContext (
73
+ {compiler .USE_VAR_INDIRECTION : use_var_indirection ,
74
+ compiler .WARN_ON_SHADOWED_NAME : warn_on_shadowed_name ,
75
+ compiler .WARN_ON_SHADOWED_VAR : warn_on_shadowed_var })
58
76
ns_var = runtime .set_current_ns (default_ns )
59
77
eof = object ()
60
78
while True :
@@ -95,10 +113,33 @@ def repl(default_ns):
95
113
@click .argument ('file-or-code' )
96
114
@click .option ('-c' , '--code' , is_flag = True , help = 'if provided, treat argument as a string of code' )
97
115
@click .option ('--in-ns' , default = runtime ._REPL_DEFAULT_NS , help = 'namespace to use for the code' )
98
- def run (file_or_code , code , in_ns ):
116
+ @click .option ('--use-var-indirection' ,
117
+ default = False ,
118
+ is_flag = True ,
119
+ envvar = 'BASILISP_USE_VAR_INDIRECTION' ,
120
+ help = 'if provided, all Var accesses will be performed via Var indirection' )
121
+ @click .option ('--warn-on-shadowed-name' ,
122
+ default = False ,
123
+ is_flag = True ,
124
+ envvar = 'BASILISP_WARN_ON_SHADOWED_NAME' ,
125
+ help = 'if provided, emit warnings if a local name is shadowed by another local name' )
126
+ @click .option ('--warn-on-shadowed-var' ,
127
+ default = True ,
128
+ is_flag = True ,
129
+ envvar = 'BASILISP_WARN_ON_SHADOWED_VAR' ,
130
+ help = 'if provided, emit warnings if a Var name is shadowed by a local name' )
131
+ def run (file_or_code , # pylint: disable=too-many-arguments
132
+ code ,
133
+ in_ns ,
134
+ use_var_indirection ,
135
+ warn_on_shadowed_name ,
136
+ warn_on_shadowed_var ):
99
137
"""Run a Basilisp script or a line of code, if it is provided."""
100
138
basilisp .init ()
101
- ctx = compiler .CompilerContext ()
139
+ ctx = compiler .CompilerContext (
140
+ {compiler .USE_VAR_INDIRECTION : use_var_indirection ,
141
+ compiler .WARN_ON_SHADOWED_NAME : warn_on_shadowed_name ,
142
+ compiler .WARN_ON_SHADOWED_VAR : warn_on_shadowed_var })
102
143
eof = object ()
103
144
104
145
with runtime .ns_bindings (in_ns ) as ns :
0 commit comments