Parameterize compiler Config type
This commit is contained in:
@@ -2,11 +2,11 @@ use std::collections::HashSet;
|
||||
use std::time;
|
||||
|
||||
pub trait ProgrammingLanguageInterface {
|
||||
type Options;
|
||||
type Config: Default;
|
||||
fn language_name() -> String;
|
||||
fn source_file_suffix() -> String;
|
||||
|
||||
fn run_computation(&mut self, _request: ComputationRequest) -> ComputationResponse;
|
||||
fn run_computation(&mut self, _request: ComputationRequest<Self::Config>) -> ComputationResponse;
|
||||
|
||||
fn request_meta(&mut self, _request: LangMetaRequest) -> LangMetaResponse {
|
||||
LangMetaResponse::Custom {
|
||||
@@ -23,9 +23,9 @@ struct Options<T> {
|
||||
}
|
||||
*/
|
||||
|
||||
pub struct ComputationRequest<'a> {
|
||||
pub struct ComputationRequest<'a, T> {
|
||||
pub source: &'a str,
|
||||
//pub options: Options<()>,
|
||||
pub config: T,
|
||||
pub debug_requests: HashSet<DebugAsk>,
|
||||
}
|
||||
|
||||
|
||||
@@ -187,6 +187,7 @@ impl<L: ProgrammingLanguageInterface> Repl<L> {
|
||||
|
||||
let request = ComputationRequest {
|
||||
source: input,
|
||||
config: Default::default(),
|
||||
debug_requests,
|
||||
};
|
||||
let response = self.language_state.run_computation(request);
|
||||
|
||||
Reference in New Issue
Block a user