@@ -2,7 +2,6 @@ import fetch from 'isomorphic-fetch';
22import { ThunkAction as ReduxThunkAction , AnyAction } from '@reduxjs/toolkit' ;
33
44import {
5- codeSelector ,
65 getCrateType ,
76 runAsTest ,
87 wasmLikelyToWork ,
@@ -26,7 +25,6 @@ import {
2625 ProcessAssembly ,
2726 Position ,
2827 makePosition ,
29- Crate ,
3028} from './types' ;
3129
3230import { performCommonExecute , wsExecuteRequest } from './reducers/output/execute' ;
@@ -83,14 +81,6 @@ export enum ActionType {
8381 EnableFeatureGate = 'ENABLE_FEATURE_GATE' ,
8482 GotoPosition = 'GOTO_POSITION' ,
8583 SelectText = 'SELECT_TEXT' ,
86- RequestMiri = 'REQUEST_MIRI' ,
87- MiriSucceeded = 'MIRI_SUCCEEDED' ,
88- MiriFailed = 'MIRI_FAILED' ,
89- RequestMacroExpansion = 'REQUEST_MACRO_EXPANSION' ,
90- MacroExpansionSucceeded = 'MACRO_EXPANSION_SUCCEEDED' ,
91- MacroExpansionFailed = 'MACRO_EXPANSION_FAILED' ,
92- RequestCratesLoad = 'REQUEST_CRATES_LOAD' ,
93- CratesLoadSucceeded = 'CRATES_LOAD_SUCCEEDED' ,
9484 NotificationSeen = 'NOTIFICATION_SEEN' ,
9585 BrowserWidthChanged = 'BROWSER_WIDTH_CHANGED' ,
9686}
@@ -258,10 +248,6 @@ const performTestOnly = (): ThunkAction => (dispatch, getState) => {
258248 return dispatch ( performCommonExecute ( crateType , true ) ) ;
259249} ;
260250
261- interface GenericApiFailure {
262- error : string ;
263- }
264-
265251const performCompileToNightlyHirOnly = ( ) : ThunkAction => dispatch => {
266252 dispatch ( changeChannel ( Channel . Nightly ) ) ;
267253 dispatch ( performCompileToHirOnly ( ) ) ;
@@ -337,107 +323,6 @@ export const gotoPosition = (line: string | number, column: string | number) =>
337323export const selectText = ( start : Position , end : Position ) =>
338324 createAction ( ActionType . SelectText , { start, end } ) ;
339325
340- interface GeneralSuccess {
341- stdout : string ;
342- stderr : string ;
343- }
344-
345- const requestMiri = ( ) =>
346- createAction ( ActionType . RequestMiri ) ;
347-
348- interface MiriRequestBody {
349- code : string ;
350- edition : string ;
351- }
352-
353- interface MiriResponseBody {
354- success : boolean ;
355- stdout : string ;
356- stderr : string ;
357- }
358-
359- type MiriSuccess = GeneralSuccess ;
360-
361- const receiveMiriSuccess = ( { stdout, stderr } : MiriSuccess ) =>
362- createAction ( ActionType . MiriSucceeded , { stdout, stderr } ) ;
363-
364- const receiveMiriFailure = ( { error } : GenericApiFailure ) =>
365- createAction ( ActionType . MiriFailed , { error } ) ;
366-
367- export function performMiri ( ) : ThunkAction {
368- // TODO: Check a cache
369- return function ( dispatch , getState ) {
370- dispatch ( requestMiri ( ) ) ;
371-
372- const state = getState ( ) ;
373- const code = codeSelector ( state ) ;
374- const { configuration : {
375- edition,
376- } } = state ;
377- const body : MiriRequestBody = { code, edition } ;
378-
379- return jsonPost < MiriResponseBody > ( routes . miri , body )
380- . then ( json => dispatch ( receiveMiriSuccess ( json ) ) )
381- . catch ( json => dispatch ( receiveMiriFailure ( json ) ) ) ;
382- } ;
383- }
384-
385- const requestMacroExpansion = ( ) =>
386- createAction ( ActionType . RequestMacroExpansion ) ;
387-
388- interface MacroExpansionRequestBody {
389- code : string ;
390- edition : string ;
391- }
392-
393- interface MacroExpansionResponseBody {
394- success : boolean ;
395- stdout : string ;
396- stderr : string ;
397- }
398-
399- type MacroExpansionSuccess = GeneralSuccess ;
400-
401- const receiveMacroExpansionSuccess = ( { stdout, stderr } : MacroExpansionSuccess ) =>
402- createAction ( ActionType . MacroExpansionSucceeded , { stdout, stderr } ) ;
403-
404- const receiveMacroExpansionFailure = ( { error } : GenericApiFailure ) =>
405- createAction ( ActionType . MacroExpansionFailed , { error } ) ;
406-
407- export function performMacroExpansion ( ) : ThunkAction {
408- // TODO: Check a cache
409- return function ( dispatch , getState ) {
410- dispatch ( requestMacroExpansion ( ) ) ;
411-
412- const state = getState ( ) ;
413- const code = codeSelector ( state ) ;
414- const { configuration : {
415- edition,
416- } } = state ;
417- const body : MacroExpansionRequestBody = { code, edition } ;
418-
419- return jsonPost < MacroExpansionResponseBody > ( routes . macroExpansion , body )
420- . then ( json => dispatch ( receiveMacroExpansionSuccess ( json ) ) )
421- . catch ( json => dispatch ( receiveMacroExpansionFailure ( json ) ) ) ;
422- } ;
423- }
424-
425- const requestCratesLoad = ( ) =>
426- createAction ( ActionType . RequestCratesLoad ) ;
427-
428- const receiveCratesLoadSuccess = ( { crates } : { crates : Crate [ ] } ) =>
429- createAction ( ActionType . CratesLoadSucceeded , { crates } ) ;
430-
431- export function performCratesLoad ( ) : ThunkAction {
432- return function ( dispatch ) {
433- dispatch ( requestCratesLoad ( ) ) ;
434-
435- return jsonGet ( routes . meta . crates )
436- . then ( json => dispatch ( receiveCratesLoadSuccess ( json ) ) ) ;
437- // TODO: Failure case
438- } ;
439- }
440-
441326const notificationSeen = ( notification : Notification ) =>
442327 createAction ( ActionType . NotificationSeen , { notification } ) ;
443328
@@ -557,14 +442,6 @@ export type Action =
557442 | ReturnType < typeof enableFeatureGate >
558443 | ReturnType < typeof gotoPosition >
559444 | ReturnType < typeof selectText >
560- | ReturnType < typeof requestMiri >
561- | ReturnType < typeof receiveMiriSuccess >
562- | ReturnType < typeof receiveMiriFailure >
563- | ReturnType < typeof requestMacroExpansion >
564- | ReturnType < typeof receiveMacroExpansionSuccess >
565- | ReturnType < typeof receiveMacroExpansionFailure >
566- | ReturnType < typeof requestCratesLoad >
567- | ReturnType < typeof receiveCratesLoadSuccess >
568445 | ReturnType < typeof notificationSeen >
569446 | ReturnType < typeof browserWidthChanged >
570447 | ReturnType < typeof wsExecuteRequest >
0 commit comments