File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ class HLL::Compiler does HLL::Backend::Default {
11
11
has @ ! cli-arguments ;
12
12
has % ! cli-options ;
13
13
has $ ! backend ;
14
+ has $ ! save_ctx ;
14
15
15
16
method BUILD () {
16
17
# Backend is set to the default one, by default.
@@ -56,6 +57,10 @@ class HLL::Compiler does HLL::Backend::Default {
56
57
return nqp ::readlinefh($ stdin );
57
58
}
58
59
60
+ method context () {
61
+ $ ! save_ctx # XXX starting value?
62
+ }
63
+
59
64
method interactive (* % adverbs ) {
60
65
nqp ::printfh(nqp ::getstderr(), self . interactive_banner);
61
66
@@ -67,7 +72,6 @@ class HLL::Compiler does HLL::Backend::Default {
67
72
}
68
73
69
74
my $ target := nqp :: lc (% adverbs <target >);
70
- my $ save_ctx ;
71
75
my $ prompt := self . interactive_prompt // ' > ' ;
72
76
my $ code ;
73
77
while 1 {
@@ -100,13 +104,13 @@ class HLL::Compiler does HLL::Backend::Default {
100
104
$ code := $ code ~ " \n " ;
101
105
my $ output ;
102
106
{
103
- $ output := self . eval($ code , : outer_ctx($ save_ctx ), | % adverbs );
107
+ $ output := self . eval($ code , : outer_ctx($ ! save_ctx ), | % adverbs );
104
108
CATCH {
105
109
self . interactive_exception($! );
106
110
}
107
111
};
108
112
if nqp :: defined ($ * MAIN_CTX ) {
109
- $ save_ctx := $ * MAIN_CTX ;
113
+ $ ! save_ctx := $ * MAIN_CTX ;
110
114
}
111
115
112
116
$ code := " " ;
You can’t perform that action at this time.
0 commit comments