@@ -6,6 +6,7 @@ import { getCrateType, isEditionAvailable, runAsTest } from './selectors';
6
6
import State from './state' ;
7
7
import {
8
8
AssemblyFlavor ,
9
+ Backtrace ,
9
10
Channel ,
10
11
DemangleAssembly ,
11
12
Edition ,
@@ -51,6 +52,7 @@ export enum ActionType {
51
52
ChangeProcessAssembly = 'CHANGE_PROCESS_ASSEMBLY' ,
52
53
ChangeMode = 'CHANGE_MODE' ,
53
54
ChangeEdition = 'CHANGE_EDITION' ,
55
+ ChangeBacktrace = 'CHANGE_BACKTRACE' ,
54
56
ChangeFocus = 'CHANGE_FOCUS' ,
55
57
ExecuteRequest = 'EXECUTE_REQUEST' ,
56
58
ExecuteSucceeded = 'EXECUTE_SUCCEEDED' ,
@@ -131,6 +133,14 @@ export const changeNightlyEdition = (edition: Edition): ThunkAction => dispatch
131
133
dispatch ( changeEdition ( edition ) ) ;
132
134
} ;
133
135
136
+ export const changeBacktrace = ( backtrace : Backtrace ) =>
137
+ createAction ( ActionType . ChangeBacktrace , { backtrace } ) ;
138
+
139
+ export const reExecuteWithBacktrace = ( ) : ThunkAction => dispatch => {
140
+ dispatch ( changeBacktrace ( Backtrace . Enabled ) ) ;
141
+ dispatch ( performExecute ( ) ) ;
142
+ } ;
143
+
134
144
export const changeFocus = focus =>
135
145
createAction ( ActionType . ChangeFocus , { focus } ) ;
136
146
@@ -184,6 +194,7 @@ interface ExecuteRequestBody {
184
194
tests : boolean ;
185
195
code : string ;
186
196
edition ?: string ;
197
+ backtrace : boolean ;
187
198
}
188
199
189
200
export function performExecute ( ) : ThunkAction {
@@ -195,8 +206,9 @@ export function performExecute(): ThunkAction {
195
206
const { code, configuration : { channel, mode, edition } } = state ;
196
207
const crateType = getCrateType ( state ) ;
197
208
const tests = runAsTest ( state ) ;
209
+ const backtrace = state . configuration . backtrace === Backtrace . Enabled ;
198
210
199
- const body : ExecuteRequestBody = { channel, mode, crateType, tests, code } ;
211
+ const body : ExecuteRequestBody = { channel, mode, crateType, tests, code, backtrace } ;
200
212
if ( isEditionAvailable ( state ) ) {
201
213
body . edition = edition ;
202
214
}
@@ -230,6 +242,7 @@ function performCompile(target, { request, success, failure }): ThunkAction {
230
242
} } = state ;
231
243
const crateType = getCrateType ( state ) ;
232
244
const tests = runAsTest ( state ) ;
245
+ const backtrace = state . configuration . backtrace === Backtrace . Enabled ;
233
246
const body : CompileRequestBody = {
234
247
channel,
235
248
mode,
@@ -240,6 +253,7 @@ function performCompile(target, { request, success, failure }): ThunkAction {
240
253
assemblyFlavor,
241
254
demangleAssembly,
242
255
processAssembly,
256
+ backtrace,
243
257
} ;
244
258
if ( isEditionAvailable ( state ) ) {
245
259
body . edition = edition ;
@@ -569,6 +583,7 @@ export type Action =
569
583
| ReturnType < typeof changeKeybinding >
570
584
| ReturnType < typeof changeMode >
571
585
| ReturnType < typeof changeEdition >
586
+ | ReturnType < typeof changeBacktrace >
572
587
| ReturnType < typeof changeOrientation >
573
588
| ReturnType < typeof changeTheme >
574
589
| ReturnType < typeof requestExecute >
0 commit comments