From f49457a7146675a0bcd144b60f816830e8a622a9 Mon Sep 17 00:00:00 2001 From: Michael Mauderer Date: Tue, 4 Apr 2023 12:27:53 +0100 Subject: [PATCH 01/23] Immplement shortcut handling. --- app/gui/src/presenter/project.rs | 8 +- .../view/execution-mode-selector/src/lib.rs | 6 ++ .../view/graph-editor/src/execution_mode.rs | 62 ++++++++++++ app/gui/view/graph-editor/src/lib.rs | 94 ++----------------- app/gui/view/graph-editor/src/shortcuts.rs | 64 +++++++++++++ 5 files changed, 147 insertions(+), 87 deletions(-) create mode 100644 app/gui/view/graph-editor/src/execution_mode.rs create mode 100644 app/gui/view/graph-editor/src/shortcuts.rs diff --git a/app/gui/src/presenter/project.rs b/app/gui/src/presenter/project.rs index edee5de83639..3e8aa5bffd44 100644 --- a/app/gui/src/presenter/project.rs +++ b/app/gui/src/presenter/project.rs @@ -278,6 +278,10 @@ impl Model { view.show_graph_editor(); }) } + + fn execution_mode_changed(&self, mode: &ide_view::execution_mode_selector::ExecutionMode) { + error!("Execution mode changed: {mode}"); + } } @@ -374,6 +378,8 @@ impl Project { eval_ view.execution_context_interrupt(model.execution_context_interrupt()); eval_ view.execution_context_restart(model.execution_context_restart()); + + eval graph_view.execution_mode((mode) model.execution_mode_changed(mode)); } let graph_controller = self.model.graph_controller.clone_ref(); @@ -388,7 +394,7 @@ impl Project { /// implementation of #5930. fn init_execution_modes(self) -> Self { let graph = &self.model.view.graph(); - let entries = Rc::new(vec!["development".to_string(), "production".to_string()]); + let entries = Rc::new(vec!["design".to_string(), "live".to_string()]); graph.set_available_execution_modes(entries); self } diff --git a/app/gui/view/execution-mode-selector/src/lib.rs b/app/gui/view/execution-mode-selector/src/lib.rs index a5a4caa9bb10..bff8fb7612d4 100644 --- a/app/gui/view/execution-mode-selector/src/lib.rs +++ b/app/gui/view/execution-mode-selector/src/lib.rs @@ -97,6 +97,7 @@ pub type ExecutionModes = Rc>; ensogl::define_endpoints_2! { Input { set_available_execution_modes (ExecutionModes), + set_execution_mode (ExecutionMode), } Output { selected_execution_mode (ExecutionMode), @@ -253,6 +254,11 @@ impl component::Frp for Frp { eval input.set_available_execution_modes ((entries) model.set_entries(entries.clone())); + update_selected_entry <- input.set_execution_mode.map2(&input.set_available_execution_modes, |entry, entries| { + entries.iter().position(|mode| mode == entry) + }); + dropdown.frp.set_selected <+ update_selected_entry; + selected_id <- dropdown.frp.chosen_entry.unwrap(); selection <- all(input.set_available_execution_modes, selected_id); selected_entry <- selection.map(|(entries, entry_id)| entries[*entry_id].clone()); diff --git a/app/gui/view/graph-editor/src/execution_mode.rs b/app/gui/view/graph-editor/src/execution_mode.rs new file mode 100644 index 000000000000..92f010148b47 --- /dev/null +++ b/app/gui/view/graph-editor/src/execution_mode.rs @@ -0,0 +1,62 @@ +//! This module contains the logic for the execution mode selector. + +use super::*; + +use crate::Frp; + +use ide_view_execution_mode_selector::ExecutionMode; + + + +fn get_next_execution_mode( + current: &ExecutionMode, + available: &[ExecutionMode], +) -> Option { + let index = available.iter().position(|mode| mode == current)?; + let next_index = (index + 1) % available.len(); + Some(available[next_index].clone()) +} + +/// Initialise the FRP logic for the execution mode selector. +pub fn init_frp(frp: &Frp, model: &GraphEditorModelWithNetwork) { + let out = &frp.private.output; + let network = frp.network(); + let inputs = &model.frp; + let execution_mode_selector = &model.execution_mode_selector; + + frp::extend! { network + // === Execution Mode Changes === + + execution_mode_selector.set_available_execution_modes <+ frp.set_available_execution_modes; + execution_mode_selector.set_execution_mode <+ frp.set_execution_mode; + execution_mode_state <- all(out.execution_mode,frp.set_available_execution_modes); + + execution_mode_toggled <- execution_mode_state.sample(&frp.toggle_execution_mode); + toggled_execution_mode <- execution_mode_toggled.map(|(mode,available)| get_next_execution_mode(mode,available)).unwrap(); + + external_execution_mode_update <- any(frp.set_execution_mode,toggled_execution_mode); + execution_mode_selector.set_execution_mode <+ external_execution_mode_update; + + execution_mode_update <- any(execution_mode_selector.selected_execution_mode,external_execution_mode_update); + out.execution_mode <+ execution_mode_update; + out.execution_mode_play_button_pressed <+ execution_mode_selector.play_press; + + + // === Layout === + init <- source::<()>(); + size_update <- all(init,execution_mode_selector.size,inputs.space_for_window_buttons); + eval size_update ([model]((_,size,gap_size)) { + let y_offset = MACOS_TRAFFIC_LIGHTS_VERTICAL_CENTER; + let traffic_light_width = traffic_lights_gap_width(); + + let execution_mode_selector_x = gap_size.x + traffic_light_width; + model.execution_mode_selector.set_x(execution_mode_selector_x); + let breadcrumb_gap_width = execution_mode_selector_x + size.x + TOP_BAR_ITEM_MARGIN; + model.breadcrumbs.gap_width(breadcrumb_gap_width); + + model.execution_mode_selector.set_y(y_offset + size.y / 2.0); + model.breadcrumbs.set_y(y_offset + component::breadcrumbs::HEIGHT / 2.0); + }); + } + init.emit(()); +} diff --git a/app/gui/view/graph-editor/src/lib.rs b/app/gui/view/graph-editor/src/lib.rs index 2fbd9f829720..b2aeededafc2 100644 --- a/app/gui/view/graph-editor/src/lib.rs +++ b/app/gui/view/graph-editor/src/lib.rs @@ -34,6 +34,7 @@ pub mod component; pub mod automation; pub mod builtin; pub mod data; +pub mod execution_mode; pub mod new_node_position; #[warn(missing_docs)] pub mod profiling; @@ -42,6 +43,7 @@ pub mod view; #[warn(missing_docs)] mod selection; +mod shortcuts; use crate::application::command::FrpNetworkProvider; use crate::component::node; @@ -56,7 +58,6 @@ use application::tooltip; use enso_config::ARGS; use enso_frp as frp; use ensogl::application; -use ensogl::application::shortcut; use ensogl::application::Application; use ensogl::data::color; use ensogl::display; @@ -654,6 +655,9 @@ ensogl::define_endpoints_2! { /// Set the execution modes available to the graph. set_available_execution_modes (Rc>), + set_execution_mode (execution_mode_selector::ExecutionMode), + toggle_execution_mode(), + } @@ -2657,67 +2661,8 @@ impl application::View for GraphEditor { } fn default_shortcuts() -> Vec { - use shortcut::ActionType::*; - [ - (Press, "!node_editing", "tab", "start_node_creation"), - (Press, "!node_editing", "enter", "start_node_creation"), - // === Drag === - (Press, "", "left-mouse-button", "node_press"), - (Release, "", "left-mouse-button", "node_release"), - (Press, "!node_editing", "backspace", "remove_selected_nodes"), - (Press, "!node_editing", "delete", "remove_selected_nodes"), - (Press, "has_detached_edge", "escape", "drop_dragged_edge"), - (Press, "", "cmd g", "collapse_selected_nodes"), - // === Visualization === - (Press, "!node_editing", "space", "press_visualization_visibility"), - (DoublePress, "!node_editing", "space", "double_press_visualization_visibility"), - (Release, "!node_editing", "space", "release_visualization_visibility"), - (Press, "", "cmd i", "reload_visualization_registry"), - (Press, "is_fs_visualization_displayed", "space", "close_fullscreen_visualization"), - (Press, "", "cmd", "enable_quick_visualization_preview"), - (Release, "", "cmd", "disable_quick_visualization_preview"), - // === Selection === - (Press, "", "shift", "enable_node_multi_select"), - (Press, "", "shift left-mouse-button", "enable_node_multi_select"), - (Release, "", "shift", "disable_node_multi_select"), - (Release, "", "shift left-mouse-button", "disable_node_multi_select"), - (Press, "", "shift ctrl", "toggle_node_merge_select"), - (Release, "", "shift ctrl", "toggle_node_merge_select"), - (Press, "", "shift alt", "toggle_node_subtract_select"), - (Release, "", "shift alt", "toggle_node_subtract_select"), - (Press, "", "shift ctrl alt", "toggle_node_inverse_select"), - (Release, "", "shift ctrl alt", "toggle_node_inverse_select"), - // === Navigation === - ( - Press, - "!is_fs_visualization_displayed", - "ctrl space", - "cycle_visualization_for_selected_node", - ), - (DoublePress, "", "left-mouse-button", "enter_hovered_node"), - (DoublePress, "", "left-mouse-button", "start_node_creation_from_port"), - (Press, "", "right-mouse-button", "start_node_creation_from_port"), - (Press, "!node_editing", "cmd enter", "enter_selected_node"), - (Press, "", "alt enter", "exit_node"), - // === Node Editing === - (Press, "", "cmd", "edit_mode_on"), - (Release, "", "cmd", "edit_mode_off"), - (Press, "", "cmd left-mouse-button", "edit_mode_on"), - (Release, "", "cmd left-mouse-button", "edit_mode_off"), - (Press, "node_editing", "cmd enter", "stop_editing"), - // === Profiling Mode === - (Press, "", "cmd p", "toggle_profiling_mode"), - // === Debug === - (Press, "debug_mode", "ctrl d", "debug_set_test_visualization_data_for_selected_node"), - (Press, "debug_mode", "ctrl shift enter", "debug_push_breadcrumb"), - (Press, "debug_mode", "ctrl shift up", "debug_pop_breadcrumb"), - (Press, "debug_mode", "ctrl n", "add_node_at_cursor"), - // TODO(#5930): Temporary shortcut for testing different execution environments - (Press, "", "cmd shift c", "toggle_execution_environment"), - ] - .iter() - .map(|(a, b, c, d)| Self::self_shortcut_when(*a, *c, *d, *b)) - .collect() + use crate::shortcuts::SHORTCUTS; + SHORTCUTS.iter().map(|(a, b, c, d)| Self::self_shortcut_when(*a, *c, *d, *b)).collect() } } @@ -3880,30 +3825,7 @@ fn new_graph_editor(app: &Application) -> GraphEditor { // === Execution Mode Selection === // ================================ - let execution_mode_selector = &model.execution_mode_selector; - frp::extend! { network - - execution_mode_selector.set_available_execution_modes <+ frp.set_available_execution_modes; - out.execution_mode <+ execution_mode_selector.selected_execution_mode; - out.execution_mode_play_button_pressed <+ execution_mode_selector.play_press; - - // === Layout === - init <- source::<()>(); - size_update <- all(init,execution_mode_selector.size,inputs.space_for_window_buttons); - eval size_update ([model]((_,size,gap_size)) { - let y_offset = MACOS_TRAFFIC_LIGHTS_VERTICAL_CENTER; - let traffic_light_width = traffic_lights_gap_width(); - - let execution_mode_selector_x = gap_size.x + traffic_light_width; - model.execution_mode_selector.set_x(execution_mode_selector_x); - let breadcrumb_gap_width = execution_mode_selector_x + size.x + TOP_BAR_ITEM_MARGIN; - model.breadcrumbs.gap_width(breadcrumb_gap_width); - - model.execution_mode_selector.set_y(y_offset + size.y / 2.0); - model.breadcrumbs.set_y(y_offset + component::breadcrumbs::HEIGHT / 2.0); - }); - } - init.emit(()); + execution_mode::init_frp(&frp, &model); // ================== diff --git a/app/gui/view/graph-editor/src/shortcuts.rs b/app/gui/view/graph-editor/src/shortcuts.rs new file mode 100644 index 000000000000..daa40795b22b --- /dev/null +++ b/app/gui/view/graph-editor/src/shortcuts.rs @@ -0,0 +1,64 @@ +//! Shortcuts used in the graph editor. + +use ensogl::application::shortcut::ActionType::*; + + + +/// The list of all shortcuts used in the graph editor. +pub const SHORTCUTS: &[(ensogl::application::shortcut::ActionType, &str, &str, &str)] = &[ + (Press, "!node_editing", "tab", "start_node_creation"), + (Press, "!node_editing", "enter", "start_node_creation"), + // === Drag === + (Press, "", "left-mouse-button", "node_press"), + (Release, "", "left-mouse-button", "node_release"), + (Press, "!node_editing", "backspace", "remove_selected_nodes"), + (Press, "!node_editing", "delete", "remove_selected_nodes"), + (Press, "has_detached_edge", "escape", "drop_dragged_edge"), + (Press, "", "cmd g", "collapse_selected_nodes"), + // === Visualization === + (Press, "!node_editing", "space", "press_visualization_visibility"), + (DoublePress, "!node_editing", "space", "double_press_visualization_visibility"), + (Release, "!node_editing", "space", "release_visualization_visibility"), + (Press, "", "cmd i", "reload_visualization_registry"), + (Press, "is_fs_visualization_displayed", "space", "close_fullscreen_visualization"), + (Press, "", "cmd", "enable_quick_visualization_preview"), + (Release, "", "cmd", "disable_quick_visualization_preview"), + // === Selection === + (Press, "", "shift", "enable_node_multi_select"), + (Press, "", "shift left-mouse-button", "enable_node_multi_select"), + (Release, "", "shift", "disable_node_multi_select"), + (Release, "", "shift left-mouse-button", "disable_node_multi_select"), + (Press, "", "shift ctrl", "toggle_node_merge_select"), + (Release, "", "shift ctrl", "toggle_node_merge_select"), + (Press, "", "shift alt", "toggle_node_subtract_select"), + (Release, "", "shift alt", "toggle_node_subtract_select"), + (Press, "", "shift ctrl alt", "toggle_node_inverse_select"), + (Release, "", "shift ctrl alt", "toggle_node_inverse_select"), + // === Navigation === + ( + Press, + "!is_fs_visualization_displayed", + "ctrl space", + "cycle_visualization_for_selected_node", + ), + (DoublePress, "", "left-mouse-button", "enter_hovered_node"), + (DoublePress, "", "left-mouse-button", "start_node_creation_from_port"), + (Press, "", "right-mouse-button", "start_node_creation_from_port"), + (Press, "!node_editing", "cmd enter", "enter_selected_node"), + (Press, "", "alt enter", "exit_node"), + // === Node Editing === + (Press, "", "cmd", "edit_mode_on"), + (Release, "", "cmd", "edit_mode_off"), + (Press, "", "cmd left-mouse-button", "edit_mode_on"), + (Release, "", "cmd left-mouse-button", "edit_mode_off"), + (Press, "node_editing", "cmd enter", "stop_editing"), + // === Profiling Mode === + (Press, "", "cmd p", "toggle_profiling_mode"), + // === Execution Mode === + (Press, "", "shift ctrl e", "toggle_execution_mode"), + // === Debug === + (Press, "debug_mode", "ctrl d", "debug_set_test_visualization_data_for_selected_node"), + (Press, "debug_mode", "ctrl shift enter", "debug_push_breadcrumb"), + (Press, "debug_mode", "ctrl shift up", "debug_pop_breadcrumb"), + (Press, "debug_mode", "ctrl n", "add_node_at_cursor"), +]; From 877d2a9e6750a220283ce816ef6a770871aa589b Mon Sep 17 00:00:00 2001 From: Michael Mauderer Date: Thu, 6 Apr 2023 10:31:55 +0100 Subject: [PATCH 02/23] Implement controller handling. --- .../engine-protocol/src/language_server.rs | 7 +++- .../src/language_server/types.rs | 42 +++++++++++++++++++ app/gui/src/controller/graph/executed.rs | 17 ++++++++ app/gui/src/model/execution_context.rs | 5 +++ app/gui/src/model/execution_context/plain.rs | 10 +++++ .../model/execution_context/synchronized.rs | 17 +++++++- app/gui/src/presenter/graph.rs | 7 ++++ app/gui/src/presenter/project.rs | 3 +- .../execution-mode-dropdown/src/lib.rs | 2 +- app/gui/view/examples/interface/src/lib.rs | 6 ++- .../view/execution-mode-selector/src/lib.rs | 2 +- 11 files changed, 110 insertions(+), 8 deletions(-) diff --git a/app/gui/controller/engine-protocol/src/language_server.rs b/app/gui/controller/engine-protocol/src/language_server.rs index 574933da6da6..ed01065ca1e4 100644 --- a/app/gui/controller/engine-protocol/src/language_server.rs +++ b/app/gui/controller/engine-protocol/src/language_server.rs @@ -157,7 +157,7 @@ trait API { /// Restart the program execution. #[MethodInput=RecomputeInput, rpc_name="executionContext/recompute"] - fn recompute(&self, context_id: ContextId, invalidated_expressions: InvalidatedExpressions) -> (); + fn recompute(&self, context_id: ContextId, invalidated_expressions: InvalidatedExpressions, mode: Option) -> (); /// Obtain the full suggestions database. #[MethodInput=GetSuggestionsDatabaseInput, rpc_name="search/getSuggestionsDatabase"] @@ -205,6 +205,11 @@ trait API { /// VCS snapshot if no `commit_id` is provided. #[MethodInput=VcsRestoreInput, rpc_name="vcs/restore"] fn restore_vcs(&self, root: Path, commit_id: Option) -> response::RestoreVcs; + + /// Set the execution mode of the context for future evaluations. + #[MethodInput=SetModeInput, rpc_name="executionContext/setMode"] + fn set_mode(&self, context_id: ContextId, mode: ExecutionEnvironment) -> (); + }} diff --git a/app/gui/controller/engine-protocol/src/language_server/types.rs b/app/gui/controller/engine-protocol/src/language_server/types.rs index 5a580451cdd9..84aabb98dc19 100644 --- a/app/gui/controller/engine-protocol/src/language_server/types.rs +++ b/app/gui/controller/engine-protocol/src/language_server/types.rs @@ -1155,6 +1155,48 @@ pub struct LibraryComponentGroup { } + +// ============================= +// === Execution Environment === +// ============================= + +#[derive(Hash, Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Display)] +#[serde(rename_all = "camelCase")] +#[allow(missing_docs)] +pub enum ExecutionEnvironment { + Design, + Live, +} + +impl Default for ExecutionEnvironment { + fn default() -> Self { + ExecutionEnvironment::Design + } +} + +impl ExecutionEnvironment { + pub fn list_all() -> Vec { + vec![ExecutionEnvironment::Design, ExecutionEnvironment::Live] + } + + pub fn list_all_as_imstrings() -> Vec { + Self::list_all().iter().map(|env| ImString::new(env.to_string())).collect() + } +} + +impl TryFrom<&str> for ExecutionEnvironment { + type Error = (); + + fn try_from(value: &str) -> core::result::Result { + match value { + "design" => Ok(ExecutionEnvironment::Design), + "live" => Ok(ExecutionEnvironment::Live), + _ => Err(()), + } + } +} + + // ====================== // === Test Utilities === // ====================== diff --git a/app/gui/src/controller/graph/executed.rs b/app/gui/src/controller/graph/executed.rs index 3635a8128760..a30f4a5341d7 100644 --- a/app/gui/src/controller/graph/executed.rs +++ b/app/gui/src/controller/graph/executed.rs @@ -16,6 +16,7 @@ use crate::model::execution_context::VisualizationId; use crate::model::execution_context::VisualizationUpdateData; use double_representation::name::QualifiedName; +use engine_protocol::language_server::ExecutionEnvironment; use engine_protocol::language_server::MethodPointer; use span_tree::generate::context::CalledMethodInfo; use span_tree::generate::context::Context; @@ -318,6 +319,11 @@ impl Handle { pub fn disconnect(&self, connection: &Connection) -> FallibleResult> { self.graph.borrow().disconnect(connection, self) } + + /// Set the execution mode. + pub fn set_mode(&self, mode: ExecutionEnvironment) { + self.execution_ctx.set_mode(mode); + } } @@ -454,4 +460,15 @@ pub mod tests { notifications.expect_pending(); } + + /// Test that the execution mode is properly set on the execution context. + #[wasm_bindgen_test] + fn execution_mode() { + use crate::test::mock::Fixture; + // Setup the controller. + let mut fixture = crate::test::mock::Unified::new().fixture(); + let Fixture { executed_graph, execution, executor, .. } = &mut fixture; + + executed_graph.set_mode(ExecutionEnvironment::Live); + } } diff --git a/app/gui/src/model/execution_context.rs b/app/gui/src/model/execution_context.rs index 7a7682c538c4..ab08ebadf7f6 100644 --- a/app/gui/src/model/execution_context.rs +++ b/app/gui/src/model/execution_context.rs @@ -6,6 +6,7 @@ use double_representation::identifier::Identifier; use double_representation::name::project; use double_representation::name::QualifiedName; use engine_protocol::language_server; +use engine_protocol::language_server::ExecutionEnvironment; use engine_protocol::language_server::ExpressionUpdate; use engine_protocol::language_server::ExpressionUpdatePayload; use engine_protocol::language_server::MethodPointer; @@ -503,6 +504,10 @@ pub trait API: Debug { /// Adjust method pointers after the project rename action. fn rename_method_pointers(&self, old_project_name: String, new_project_name: String); + + /// Set the execution mode of the context. + #[allow(clippy::needless_lifetimes)] + fn set_mode<'a>(&'a self, mode: ExecutionEnvironment) -> BoxFuture<'a, FallibleResult>; } // Note: Needless lifetimes diff --git a/app/gui/src/model/execution_context/plain.rs b/app/gui/src/model/execution_context/plain.rs index cf5123f2a3b7..bc06efccce56 100644 --- a/app/gui/src/model/execution_context/plain.rs +++ b/app/gui/src/model/execution_context/plain.rs @@ -11,6 +11,7 @@ use crate::model::execution_context::Visualization; use crate::model::execution_context::VisualizationId; use crate::model::execution_context::VisualizationUpdateData; +use engine_protocol::language_server::ExecutionEnvironment; use engine_protocol::language_server::MethodPointer; use engine_protocol::language_server::VisualisationConfiguration; use futures::future::LocalBoxFuture; @@ -61,6 +62,8 @@ pub struct ExecutionContext { pub is_ready: crate::sync::Synchronized, /// Component groups defined in libraries imported into the execution context. pub component_groups: RefCell>>, + /// Execution environment of the context. + pub execution_environment: Rc>, } impl ExecutionContext { @@ -72,6 +75,7 @@ impl ExecutionContext { let computed_value_info_registry = default(); let is_ready = default(); let component_groups = default(); + let execution_environment = default(); Self { entry_point, stack, @@ -79,6 +83,7 @@ impl ExecutionContext { computed_value_info_registry, is_ready, component_groups, + execution_environment, } } @@ -273,6 +278,11 @@ impl model::execution_context::API for ExecutionContext { local_call.definition = update_method_pointer(&mut local_call.definition) }); } + + fn set_mode(&self, mode: ExecutionEnvironment) -> BoxFuture { + self.execution_environment.set(mode); + futures::future::ready(Ok(())).boxed_local() + } } diff --git a/app/gui/src/model/execution_context/synchronized.rs b/app/gui/src/model/execution_context/synchronized.rs index d20e79634a77..6176e3739d6c 100644 --- a/app/gui/src/model/execution_context/synchronized.rs +++ b/app/gui/src/model/execution_context/synchronized.rs @@ -11,7 +11,7 @@ use crate::model::execution_context::VisualizationId; use crate::model::execution_context::VisualizationUpdateData; use engine_protocol::language_server; - +use engine_protocol::language_server::ExecutionEnvironment; // ==================== @@ -298,7 +298,11 @@ impl model::execution_context::API for ExecutionContext { async move { self.language_server .client - .recompute(&self.id, &language_server::InvalidatedExpressions::All) + .recompute( + &self.id, + &language_server::InvalidatedExpressions::All, + &Some(self.model.execution_environment.get()), + ) .await?; Ok(()) } @@ -308,6 +312,15 @@ impl model::execution_context::API for ExecutionContext { fn rename_method_pointers(&self, old_project_name: String, new_project_name: String) { self.model.rename_method_pointers(old_project_name, new_project_name); } + + fn set_mode(&self, mode: ExecutionEnvironment) -> BoxFuture { + self.model.execution_environment.set(mode); + async move { + self.language_server.client.set_mode(&self.id, &mode).await?; + Ok(()) + } + .boxed_local() + } } impl Drop for ExecutionContext { diff --git a/app/gui/src/presenter/graph.rs b/app/gui/src/presenter/graph.rs index f8cad3e1e11c..a13858c1dae0 100644 --- a/app/gui/src/presenter/graph.rs +++ b/app/gui/src/presenter/graph.rs @@ -502,6 +502,13 @@ impl Model { self.execution_environment.set(new_environment); new_environment } + + fn set_execution_mode(&self, mode: ide_view::execution_mode_selector::ExecutionMode) { + match mode.as_str().try_into() { + Ok(mode) => self.controller.set_mode(mode), + Err(err) => error!("Invalid execution mode given: {mode:?}"), + } + } } diff --git a/app/gui/src/presenter/project.rs b/app/gui/src/presenter/project.rs index 3e8aa5bffd44..1572faab6c29 100644 --- a/app/gui/src/presenter/project.rs +++ b/app/gui/src/presenter/project.rs @@ -2,6 +2,7 @@ //! about presenters in general. use crate::prelude::*; +use engine_protocol::language_server::ExecutionEnvironment; use crate::executor::global::spawn_stream_handler; use crate::presenter; @@ -394,7 +395,7 @@ impl Project { /// implementation of #5930. fn init_execution_modes(self) -> Self { let graph = &self.model.view.graph(); - let entries = Rc::new(vec!["design".to_string(), "live".to_string()]); + let entries = Rc::new(ExecutionEnvironment::list_all_as_imstrings()); graph.set_available_execution_modes(entries); self } diff --git a/app/gui/view/examples/execution-mode-dropdown/src/lib.rs b/app/gui/view/examples/execution-mode-dropdown/src/lib.rs index c2c9b7087589..35961d750965 100644 --- a/app/gui/view/examples/execution-mode-dropdown/src/lib.rs +++ b/app/gui/view/examples/execution-mode-dropdown/src/lib.rs @@ -28,7 +28,7 @@ use ide_view_execution_mode_selector as execution_mode_selector; // ====================== fn make_entries() -> execution_mode_selector::ExecutionModes { - Rc::new(vec!["development".to_string(), "production".to_string()]) + Rc::new(vec!["development".to_string().into(), "production".to_string().into()]) } fn init(app: &Application) { diff --git a/app/gui/view/examples/interface/src/lib.rs b/app/gui/view/examples/interface/src/lib.rs index 4a7752a42b10..0f33c1fc09d6 100644 --- a/app/gui/view/examples/interface/src/lib.rs +++ b/app/gui/view/examples/interface/src/lib.rs @@ -256,8 +256,10 @@ fn init(app: &Application) { // === Execution Modes === - graph_editor - .set_available_execution_modes(vec!["development".to_string(), "production".to_string()]); + graph_editor.set_available_execution_modes(vec![ + "development".to_string().into(), + "production".to_string().into(), + ]); // === Rendering === diff --git a/app/gui/view/execution-mode-selector/src/lib.rs b/app/gui/view/execution-mode-selector/src/lib.rs index bff8fb7612d4..c30278099564 100644 --- a/app/gui/view/execution-mode-selector/src/lib.rs +++ b/app/gui/view/execution-mode-selector/src/lib.rs @@ -90,7 +90,7 @@ mod play_icon { // =========== /// An identifier of a execution mode. -pub type ExecutionMode = String; +pub type ExecutionMode = ImString; /// A list of execution modes. pub type ExecutionModes = Rc>; From 5001a5bea2dc6fe3d9bda1544761ab9ecb9eac46 Mon Sep 17 00:00:00 2001 From: Michael Mauderer Date: Thu, 6 Apr 2023 12:45:04 +0100 Subject: [PATCH 03/23] ./run fmt, ./run lint --- .../src/language_server/types.rs | 14 +++++++++++--- app/gui/src/controller/graph/executed.rs | 16 +++------------- app/gui/src/model/execution_context/plain.rs | 1 + .../model/execution_context/synchronized.rs | 2 ++ app/gui/src/presenter/project.rs | 18 ++++++++++++++++-- 5 files changed, 33 insertions(+), 18 deletions(-) diff --git a/app/gui/controller/engine-protocol/src/language_server/types.rs b/app/gui/controller/engine-protocol/src/language_server/types.rs index 84aabb98dc19..9e768dd0b6c4 100644 --- a/app/gui/controller/engine-protocol/src/language_server/types.rs +++ b/app/gui/controller/engine-protocol/src/language_server/types.rs @@ -1175,12 +1175,20 @@ impl Default for ExecutionEnvironment { } impl ExecutionEnvironment { + /// List all available execution environments. pub fn list_all() -> Vec { vec![ExecutionEnvironment::Design, ExecutionEnvironment::Live] } + /// List all available execution environments as ImStrings. Useful for UI. pub fn list_all_as_imstrings() -> Vec { - Self::list_all().iter().map(|env| ImString::new(env.to_string())).collect() + Self::list_all().iter().map(|env| (*env).into()).collect() + } +} + +impl From for ImString { + fn from(env: ExecutionEnvironment) -> Self { + ImString::new(env.to_string()) } } @@ -1189,8 +1197,8 @@ impl TryFrom<&str> for ExecutionEnvironment { fn try_from(value: &str) -> core::result::Result { match value { - "design" => Ok(ExecutionEnvironment::Design), - "live" => Ok(ExecutionEnvironment::Live), + "design" | "Design" => Ok(ExecutionEnvironment::Design), + "live" | "Live" => Ok(ExecutionEnvironment::Live), _ => Err(()), } } diff --git a/app/gui/src/controller/graph/executed.rs b/app/gui/src/controller/graph/executed.rs index a30f4a5341d7..240f13521094 100644 --- a/app/gui/src/controller/graph/executed.rs +++ b/app/gui/src/controller/graph/executed.rs @@ -321,8 +321,9 @@ impl Handle { } /// Set the execution mode. - pub fn set_mode(&self, mode: ExecutionEnvironment) { - self.execution_ctx.set_mode(mode); + pub async fn set_mode(&self, mode: ExecutionEnvironment) -> FallibleResult { + self.execution_ctx.set_mode(mode).await?; + Ok(()) } } @@ -460,15 +461,4 @@ pub mod tests { notifications.expect_pending(); } - - /// Test that the execution mode is properly set on the execution context. - #[wasm_bindgen_test] - fn execution_mode() { - use crate::test::mock::Fixture; - // Setup the controller. - let mut fixture = crate::test::mock::Unified::new().fixture(); - let Fixture { executed_graph, execution, executor, .. } = &mut fixture; - - executed_graph.set_mode(ExecutionEnvironment::Live); - } } diff --git a/app/gui/src/model/execution_context/plain.rs b/app/gui/src/model/execution_context/plain.rs index bc06efccce56..935a184f7168 100644 --- a/app/gui/src/model/execution_context/plain.rs +++ b/app/gui/src/model/execution_context/plain.rs @@ -280,6 +280,7 @@ impl model::execution_context::API for ExecutionContext { } fn set_mode(&self, mode: ExecutionEnvironment) -> BoxFuture { + info!("Setting execution mode to {mode:?}."); self.execution_environment.set(mode); futures::future::ready(Ok(())).boxed_local() } diff --git a/app/gui/src/model/execution_context/synchronized.rs b/app/gui/src/model/execution_context/synchronized.rs index 6176e3739d6c..2adf83f242a3 100644 --- a/app/gui/src/model/execution_context/synchronized.rs +++ b/app/gui/src/model/execution_context/synchronized.rs @@ -14,6 +14,7 @@ use engine_protocol::language_server; use engine_protocol::language_server::ExecutionEnvironment; + // ==================== // === Notification === // ==================== @@ -316,6 +317,7 @@ impl model::execution_context::API for ExecutionContext { fn set_mode(&self, mode: ExecutionEnvironment) -> BoxFuture { self.model.execution_environment.set(mode); async move { + info!("Setting execution mode to {mode:?}."); self.language_server.client.set_mode(&self.id, &mode).await?; Ok(()) } diff --git a/app/gui/src/presenter/project.rs b/app/gui/src/presenter/project.rs index 1572faab6c29..03d8828b1671 100644 --- a/app/gui/src/presenter/project.rs +++ b/app/gui/src/presenter/project.rs @@ -2,12 +2,12 @@ //! about presenters in general. use crate::prelude::*; -use engine_protocol::language_server::ExecutionEnvironment; use crate::executor::global::spawn_stream_handler; use crate::presenter; use crate::presenter::graph::ViewNodeId; +use engine_protocol::language_server::ExecutionEnvironment; use enso_frp as frp; use ensogl::system::js; use ide_view as view; @@ -281,7 +281,16 @@ impl Model { } fn execution_mode_changed(&self, mode: &ide_view::execution_mode_selector::ExecutionMode) { - error!("Execution mode changed: {mode}"); + if let Ok(mode) = mode.as_str().try_into() { + let graph_controller = self.graph_controller.clone_ref(); + executor::global::spawn(async move { + if let Err(err) = graph_controller.set_mode(mode).await { + error!("Error setting execution mode: {err}"); + } + }); + } else { + error!("Invalid execution mode: {mode:?}"); + } } } @@ -381,6 +390,8 @@ impl Project { eval_ view.execution_context_restart(model.execution_context_restart()); eval graph_view.execution_mode((mode) model.execution_mode_changed(mode)); + eval graph_view.execution_mode([](mode) error!("project::execution_mode_changed {mode:?}")); + } let graph_controller = self.model.graph_controller.clone_ref(); @@ -397,6 +408,9 @@ impl Project { let graph = &self.model.view.graph(); let entries = Rc::new(ExecutionEnvironment::list_all_as_imstrings()); graph.set_available_execution_modes(entries); + let default_mode = ExecutionEnvironment::default(); + let default_mode: ImString = default_mode.into(); + graph.set_execution_mode(default_mode); self } From 527ed4d53224805f8f5508f73303dc62e7c8bc76 Mon Sep 17 00:00:00 2001 From: Michael Mauderer Date: Thu, 13 Apr 2023 11:59:27 +0200 Subject: [PATCH 04/23] Fix clickable area size. --- .../view/execution-mode-selector/src/lib.rs | 1 + .../ensogl/app/theme/hardcoded/src/lib.rs | 2 +- .../component/drop-down-menu/src/lib.rs | 42 ++++++++++--------- 3 files changed, 24 insertions(+), 21 deletions(-) diff --git a/app/gui/view/execution-mode-selector/src/lib.rs b/app/gui/view/execution-mode-selector/src/lib.rs index c30278099564..4ce5ada64234 100644 --- a/app/gui/view/execution-mode-selector/src/lib.rs +++ b/app/gui/view/execution-mode-selector/src/lib.rs @@ -129,6 +129,7 @@ impl Model { fn update_dropdown_style(&self, style: &Style) { self.dropdown.set_menu_offset_y(style.menu_offset); self.dropdown.set_x(style.overall_width() / 2.0 - style.divider_offset); + self.dropdown.set_width(style.dropdown_width); self.dropdown.set_label_color(Rgba::white()); self.dropdown.set_icon_size(Vector2::new(1.0, 1.0)); self.dropdown.set_menu_alignment(ensogl_drop_down_menu::Alignment::Right); diff --git a/lib/rust/ensogl/app/theme/hardcoded/src/lib.rs b/lib/rust/ensogl/app/theme/hardcoded/src/lib.rs index c2cfb6673942..aa823e97db70 100644 --- a/lib/rust/ensogl/app/theme/hardcoded/src/lib.rs +++ b/lib/rust/ensogl/app/theme/hardcoded/src/lib.rs @@ -663,7 +663,7 @@ define_themes! { [light:0, dark:1] play_button_padding = 10.0, 10.0; divider_offset = 32.5, 32.5; divider_padding = 10.0, 10.0; - dropdown_width = 95.0, 95.0; + dropdown_width = 75.0, 75.0; height = 24.0, 24.0; menu_offset = 20.0, 20.0; } diff --git a/lib/rust/ensogl/component/drop-down-menu/src/lib.rs b/lib/rust/ensogl/component/drop-down-menu/src/lib.rs index 75c42be933b9..84882e7872ba 100644 --- a/lib/rust/ensogl/component/drop-down-menu/src/lib.rs +++ b/lib/rust/ensogl/component/drop-down-menu/src/lib.rs @@ -40,10 +40,8 @@ use ensogl_text as text; /// Invisible dummy color to catch hover events. const HOVER_COLOR: color::Rgba = color::Rgba::new(1.0, 0.0, 0.0, 0.000_001); -/// The width of the visualisation selection menu. -const MENU_WIDTH: f32 = 180.0; - - +/// The default width of the selection menu. +const DEFAULT_MENU_WIDTH: f32 = 180.0; // ============== // === Shapes === @@ -122,6 +120,7 @@ ensogl_core::define_endpoints! { set_menu_offset_y (f32), set_menu_alignment (Alignment), set_label_alignment (Alignment), + set_width (f32), } Output { menu_visible (bool), @@ -270,9 +269,11 @@ impl DropDownMenu { // === Layouting === let menu_height = DEPRECATED_Animation::::new(network); + let menu_width = frp.set_width.clone_ref(); - eval menu_height.value ([model](height) { - model.selection_menu.frp.resize.emit(Vector2::new(MENU_WIDTH,*height)); + resize_menu <- all(menu_width,menu_height.value); + eval resize_menu ([model]((width,height)) { + model.selection_menu.frp.resize.emit(Vector2::new(*width,*height)); if *height <= 0.0 { model.hide_selection_menu(); } else if *height > 0.0 { @@ -298,29 +299,30 @@ impl DropDownMenu { model.selection_menu.set_x(x_offset); }); - label_position <- all(model.label.frp.width,frp.input.set_icon_size,model.label.frp.height, - frp.input.set_label_alignment); - eval label_position ([model]((text_width,icon_size,text_height,alignment)) { + label_position <- all5(&model.label.frp.width,&frp.input.set_icon_size,&model.label.frp + .height,&frp.input.set_label_alignment,&menu_width); + eval label_position ([model]((text_width,icon_size,text_height,alignment,menu_width)) { let base_offset = match alignment { - Alignment::Left => -MENU_WIDTH/2.0+icon_size.x/2.0, - Alignment::Right => -text_width-icon_size.x/2.0, + Alignment::Left => -menu_width + icon_size.x / 2.0, + Alignment::Right => -text_width-icon_size.x / 2.0, }; model.label.set_x(base_offset); // Adjust for text offset, so this appears more centered. model.label.set_y(0.5 * text_height); }); - overlay_size <- all( - model.label.frp.width, - model.label.frp.height, - frp.input.set_icon_size, - frp.input.set_icon_padding); - eval overlay_size ([model]((text_width,text_height,icon_size,icon_padding)) { + overlay_size <- all5( + &model.label.frp.width, + &model.label.frp.height, + &frp.input.set_icon_size, + &frp.input.set_icon_padding, + &menu_width); + eval overlay_size ([model]((text_width,text_height,icon_size,icon_padding,menu_width)) { let height = icon_size.y.max(*text_height); - let width = text_width + icon_size.x + icon_padding.x; + let width = *menu_width; let size = Vector2::new(width,height); model.click_overlay.set_size(size); - model.click_overlay.set_x(-width/2.0 + icon_size.x/2.0 - icon_padding.x); + model.click_overlay.set_x(-width / 2.0 + icon_size.x / 2.0 - icon_padding.x); }); @@ -417,7 +419,7 @@ impl DropDownMenu { let styles = StyleWatch::new(&app.display.default_scene.style_sheet); let text_color = styles.get_color(theme::widget::list_view::text); model.label.set_property_default(text_color); - + frp.set_width.emit(DEFAULT_MENU_WIDTH); self } From 348c7a6bd985ca8875b9507e7db51a1d2a73c41e Mon Sep 17 00:00:00 2001 From: Michael Mauderer Date: Tue, 18 Apr 2023 13:49:22 +0200 Subject: [PATCH 05/23] Rebase to develop and merge changes. --- .../engine-protocol/src/language_server.rs | 4 +- .../src/language_server/types.rs | 19 ++++++++ .../model/execution_context/synchronized.rs | 2 +- app/gui/src/presenter/graph.rs | 14 +++--- .../view/graph-editor/src/component/node.rs | 3 +- .../src/component/node/action_bar.rs | 3 +- app/gui/view/graph-editor/src/lib.rs | 43 +------------------ .../component/drop-down-menu/src/lib.rs | 5 +-- 8 files changed, 34 insertions(+), 59 deletions(-) diff --git a/app/gui/controller/engine-protocol/src/language_server.rs b/app/gui/controller/engine-protocol/src/language_server.rs index ed01065ca1e4..a74ddce014ec 100644 --- a/app/gui/controller/engine-protocol/src/language_server.rs +++ b/app/gui/controller/engine-protocol/src/language_server.rs @@ -207,8 +207,8 @@ trait API { fn restore_vcs(&self, root: Path, commit_id: Option) -> response::RestoreVcs; /// Set the execution mode of the context for future evaluations. - #[MethodInput=SetModeInput, rpc_name="executionContext/setMode"] - fn set_mode(&self, context_id: ContextId, mode: ExecutionEnvironment) -> (); + #[MethodInput=SetModeInput, rpc_name="executionContext/setExecutionEnvironment"] + fn set_execution_environment(&self, context_id: ContextId, mode: ExecutionEnvironment) -> (); }} diff --git a/app/gui/controller/engine-protocol/src/language_server/types.rs b/app/gui/controller/engine-protocol/src/language_server/types.rs index 9e768dd0b6c4..a84aa26f34ff 100644 --- a/app/gui/controller/engine-protocol/src/language_server/types.rs +++ b/app/gui/controller/engine-protocol/src/language_server/types.rs @@ -1160,11 +1160,19 @@ pub struct LibraryComponentGroup { // === Execution Environment === // ============================= +/// The execution environment which controls the global execution of functions with side effects. +/// +/// For more information, see +/// https://github.com/enso-org/design/blob/main/epics/basic-libraries/write-action-control/design.md. #[derive(Hash, Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Display)] #[serde(rename_all = "camelCase")] #[allow(missing_docs)] + pub enum ExecutionEnvironment { + /// Allows editing the graph, but the `Output` context is disabled, so it prevents accidental + /// changes. Design, + /// Unrestricted, live editing of data. Live, } @@ -1204,6 +1212,17 @@ impl TryFrom<&str> for ExecutionEnvironment { } } +impl ExecutionEnvironment { + /// Returns whether the output context is enabled for this execution environment. + pub fn output_context_enabled(&self) -> bool { + match self { + Self::Design => false, + Self::Live => true, + } + } +} + + // ====================== // === Test Utilities === diff --git a/app/gui/src/model/execution_context/synchronized.rs b/app/gui/src/model/execution_context/synchronized.rs index 2adf83f242a3..adb11e11a664 100644 --- a/app/gui/src/model/execution_context/synchronized.rs +++ b/app/gui/src/model/execution_context/synchronized.rs @@ -318,7 +318,7 @@ impl model::execution_context::API for ExecutionContext { self.model.execution_environment.set(mode); async move { info!("Setting execution mode to {mode:?}."); - self.language_server.client.set_mode(&self.id, &mode).await?; + self.language_server.client.set_execution_environment(&self.id, &mode).await?; Ok(()) } .boxed_local() diff --git a/app/gui/src/presenter/graph.rs b/app/gui/src/presenter/graph.rs index a13858c1dae0..87bd5b207bb5 100644 --- a/app/gui/src/presenter/graph.rs +++ b/app/gui/src/presenter/graph.rs @@ -12,6 +12,7 @@ use crate::presenter::graph::state::State; use double_representation::context_switch::Context; use double_representation::context_switch::ContextSwitch; use double_representation::context_switch::ContextSwitchExpression; +use engine_protocol::language_server::ExecutionEnvironment; use engine_protocol::language_server::SuggestionId; use enso_frp as frp; use futures::future::LocalBoxFuture; @@ -19,7 +20,6 @@ use ide_view as view; use ide_view::graph_editor::component::node as node_view; use ide_view::graph_editor::component::visualization as visualization_view; use ide_view::graph_editor::EdgeEndpoint; -use view::graph_editor::ExecutionEnvironment; use view::graph_editor::WidgetUpdates; @@ -503,12 +503,12 @@ impl Model { new_environment } - fn set_execution_mode(&self, mode: ide_view::execution_mode_selector::ExecutionMode) { - match mode.as_str().try_into() { - Ok(mode) => self.controller.set_mode(mode), - Err(err) => error!("Invalid execution mode given: {mode:?}"), - } - } + // fn set_execution_mode(&self, mode: ide_view::execution_mode_selector::ExecutionMode) { + // match mode.as_str().try_into() { + // Ok(mode) => self.execution_environment.set(mode), + // Err(_err) => error!("Invalid execution mode given: {mode:?}"), + // } + // } } diff --git a/app/gui/view/graph-editor/src/component/node.rs b/app/gui/view/graph-editor/src/component/node.rs index b8b7daa3850c..aefb462fd5c6 100644 --- a/app/gui/view/graph-editor/src/component/node.rs +++ b/app/gui/view/graph-editor/src/component/node.rs @@ -11,11 +11,11 @@ use crate::component::visualization; use crate::selection::BoundingBox; use crate::tooltip; use crate::view; -use crate::ExecutionEnvironment; use crate::Type; use crate::WidgetUpdates; use super::edge; +use engine_protocol::language_server::ExecutionEnvironment; use enso_frp as frp; use enso_frp; use ensogl::animation::delayed::DelayedAnimation; @@ -31,7 +31,6 @@ use ensogl_hardcoded_theme as theme; use ensogl_hardcoded_theme; use std::f32::EPSILON; - // ============== // === Export === // ============== diff --git a/app/gui/view/graph-editor/src/component/node/action_bar.rs b/app/gui/view/graph-editor/src/component/node/action_bar.rs index e385baa512b4..1452d7c58925 100644 --- a/app/gui/view/graph-editor/src/component/node/action_bar.rs +++ b/app/gui/view/graph-editor/src/component/node/action_bar.rs @@ -3,8 +3,7 @@ use crate::prelude::*; use ensogl::display::shape::*; -use crate::ExecutionEnvironment; - +use engine_protocol::language_server::ExecutionEnvironment; use enso_config::ARGS; use enso_frp as frp; use ensogl::application::tooltip; diff --git a/app/gui/view/graph-editor/src/lib.rs b/app/gui/view/graph-editor/src/lib.rs index b2aeededafc2..cec966ab4713 100644 --- a/app/gui/view/graph-editor/src/lib.rs +++ b/app/gui/view/graph-editor/src/lib.rs @@ -53,6 +53,7 @@ use crate::component::visualization::instance::PreprocessorConfiguration; use crate::component::visualization::MockDataGenerator3D; use crate::data::enso; pub use crate::node::profiling::Status as NodeProfilingStatus; +use engine_protocol::language_server::ExecutionEnvironment; use application::tooltip; use enso_config::ARGS; @@ -3857,48 +3858,6 @@ impl display::Object for GraphEditor { } - -// ============================= -// === Execution Environment === -// ============================= - -// TODO(#5930): Move me once we synchronise the execution environment with the language server. -/// The execution environment which controls the global execution of functions with side effects. -/// -/// For more information, see -/// https://github.com/enso-org/design/blob/main/epics/basic-libraries/write-action-control/design.md. -#[derive(Debug, Clone, CloneRef, Copy, Default)] -pub enum ExecutionEnvironment { - /// Allows editing the graph, but the `Output` context is disabled, so it prevents accidental - /// changes. - #[default] - Design, - /// Unrestricted, live editing of data. - Live, -} - -impl ExecutionEnvironment { - /// Returns whether the output context is enabled for this execution environment. - pub fn output_context_enabled(&self) -> bool { - match self { - Self::Design => false, - Self::Live => true, - } - } -} - -impl Display for ExecutionEnvironment { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let name = match self { - Self::Design => "design", - Self::Live => "live", - }; - write!(f, "{name}") - } -} - - - // ============= // === Tests === // ============= diff --git a/lib/rust/ensogl/component/drop-down-menu/src/lib.rs b/lib/rust/ensogl/component/drop-down-menu/src/lib.rs index 84882e7872ba..21b6066f13f6 100644 --- a/lib/rust/ensogl/component/drop-down-menu/src/lib.rs +++ b/lib/rust/ensogl/component/drop-down-menu/src/lib.rs @@ -311,13 +311,12 @@ impl DropDownMenu { model.label.set_y(0.5 * text_height); }); - overlay_size <- all5( - &model.label.frp.width, + overlay_size <- all4( &model.label.frp.height, &frp.input.set_icon_size, &frp.input.set_icon_padding, &menu_width); - eval overlay_size ([model]((text_width,text_height,icon_size,icon_padding,menu_width)) { + eval overlay_size ([model]((text_height,icon_size,icon_padding,menu_width)) { let height = icon_size.y.max(*text_height); let width = *menu_width; let size = Vector2::new(width,height); From cbc3d1a9073446e2f9fdff1b9ecacd9c8a7e2cae Mon Sep 17 00:00:00 2001 From: Michael Mauderer Date: Tue, 18 Apr 2023 15:21:22 +0100 Subject: [PATCH 06/23] Integrate with new existing functionality. --- Cargo.lock | 14 ++-- .../engine-protocol/src/language_server.rs | 2 +- .../src/language_server/types.rs | 2 - app/gui/src/presenter/graph.rs | 6 +- app/gui/src/presenter/project.rs | 21 +++--- app/gui/view/Cargo.toml | 2 +- app/gui/view/examples/Cargo.toml | 2 +- .../Cargo.toml | 4 +- .../src/lib.rs | 13 ++-- app/gui/view/examples/interface/Cargo.toml | 2 +- app/gui/view/examples/interface/src/lib.rs | 2 +- app/gui/view/examples/src/lib.rs | 2 +- .../Cargo.toml | 2 +- .../src/lib.rs | 18 +++--- app/gui/view/graph-editor/Cargo.toml | 2 +- .../view/graph-editor/src/component/node.rs | 1 + .../graph-editor/src/execution_environment.rs | 62 ++++++++++++++++++ .../view/graph-editor/src/execution_mode.rs | 62 ------------------ app/gui/view/graph-editor/src/lib.rs | 64 +++++++++---------- app/gui/view/graph-editor/src/shortcuts.rs | 2 +- app/gui/view/src/lib.rs | 2 +- .../ensogl/app/theme/hardcoded/src/lib.rs | 2 +- 22 files changed, 144 insertions(+), 145 deletions(-) rename app/gui/view/examples/{execution-mode-dropdown => execution-environment-dropdown}/Cargo.toml (79%) rename app/gui/view/examples/{execution-mode-dropdown => execution-environment-dropdown}/src/lib.rs (74%) rename app/gui/view/{execution-mode-selector => execution-environment-selector}/Cargo.toml (93%) rename app/gui/view/{execution-mode-selector => execution-environment-selector}/src/lib.rs (91%) create mode 100644 app/gui/view/graph-editor/src/execution_environment.rs delete mode 100644 app/gui/view/graph-editor/src/execution_mode.rs diff --git a/Cargo.lock b/Cargo.lock index d0788c952a25..f76d5e44210d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1614,7 +1614,7 @@ dependencies = [ ] [[package]] -name = "debug-scene-execution-mode-dropdown" +name = "debug-scene-execution-environment-dropdown" version = "0.1.0" dependencies = [ "ensogl", @@ -1622,7 +1622,7 @@ dependencies = [ "ensogl-hardcoded-theme", "ensogl-list-view", "ensogl-text-msdf", - "ide-view-execution-mode-selector", + "ide-view-execution-environment-selector", ] [[package]] @@ -1647,7 +1647,7 @@ dependencies = [ "ensogl-hardcoded-theme", "ensogl-text-msdf", "ide-view", - "ide-view-execution-mode-selector", + "ide-view-execution-environment-selector", "parser", "span-tree", "uuid 0.8.2", @@ -2109,7 +2109,7 @@ version = "0.1.0" dependencies = [ "debug-scene-component-list-panel-view", "debug-scene-documentation", - "debug-scene-execution-mode-dropdown", + "debug-scene-execution-environment-dropdown", "debug-scene-icons", "debug-scene-interface", "debug-scene-text-grid-visualization", @@ -4287,7 +4287,7 @@ dependencies = [ "ensogl-text-msdf", "ide-view-component-browser", "ide-view-documentation", - "ide-view-execution-mode-selector", + "ide-view-execution-environment-selector", "ide-view-graph-editor", "js-sys", "multi-map", @@ -4402,7 +4402,7 @@ dependencies = [ ] [[package]] -name = "ide-view-execution-mode-selector" +name = "ide-view-execution-environment-selector" version = "0.1.0" dependencies = [ "enso-frp", @@ -4435,7 +4435,7 @@ dependencies = [ "ensogl-hardcoded-theme", "ensogl-text-msdf", "failure", - "ide-view-execution-mode-selector", + "ide-view-execution-environment-selector", "indexmap", "js-sys", "nalgebra", diff --git a/app/gui/controller/engine-protocol/src/language_server.rs b/app/gui/controller/engine-protocol/src/language_server.rs index a74ddce014ec..aa029d36cd2e 100644 --- a/app/gui/controller/engine-protocol/src/language_server.rs +++ b/app/gui/controller/engine-protocol/src/language_server.rs @@ -208,7 +208,7 @@ trait API { /// Set the execution mode of the context for future evaluations. #[MethodInput=SetModeInput, rpc_name="executionContext/setExecutionEnvironment"] - fn set_execution_environment(&self, context_id: ContextId, mode: ExecutionEnvironment) -> (); + fn set_execution_environment(&self, context_id: ContextId, execution_environment: ExecutionEnvironment) -> (); }} diff --git a/app/gui/controller/engine-protocol/src/language_server/types.rs b/app/gui/controller/engine-protocol/src/language_server/types.rs index a84aa26f34ff..bb33e2b2bc80 100644 --- a/app/gui/controller/engine-protocol/src/language_server/types.rs +++ b/app/gui/controller/engine-protocol/src/language_server/types.rs @@ -1166,8 +1166,6 @@ pub struct LibraryComponentGroup { /// https://github.com/enso-org/design/blob/main/epics/basic-libraries/write-action-control/design.md. #[derive(Hash, Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Display)] #[serde(rename_all = "camelCase")] -#[allow(missing_docs)] - pub enum ExecutionEnvironment { /// Allows editing the graph, but the `Output` context is disabled, so it prevents accidental /// changes. diff --git a/app/gui/src/presenter/graph.rs b/app/gui/src/presenter/graph.rs index 87bd5b207bb5..1876ec8207bd 100644 --- a/app/gui/src/presenter/graph.rs +++ b/app/gui/src/presenter/graph.rs @@ -503,9 +503,9 @@ impl Model { new_environment } - // fn set_execution_mode(&self, mode: ide_view::execution_mode_selector::ExecutionMode) { - // match mode.as_str().try_into() { - // Ok(mode) => self.execution_environment.set(mode), + // fn set_execution_environment(&self, mode: + // ide_view::execution_environment_selector::ExecutionMode) { match mode.as_str(). + // try_into() { Ok(mode) => self.execution_environment.set(mode), // Err(_err) => error!("Invalid execution mode given: {mode:?}"), // } // } diff --git a/app/gui/src/presenter/project.rs b/app/gui/src/presenter/project.rs index 03d8828b1671..b06e6ef0caf4 100644 --- a/app/gui/src/presenter/project.rs +++ b/app/gui/src/presenter/project.rs @@ -280,7 +280,10 @@ impl Model { }) } - fn execution_mode_changed(&self, mode: &ide_view::execution_mode_selector::ExecutionMode) { + fn execution_environment_changed( + &self, + mode: &ide_view::execution_environment_selector::ExecutionMode, + ) { if let Ok(mode) = mode.as_str().try_into() { let graph_controller = self.graph_controller.clone_ref(); executor::global::spawn(async move { @@ -389,28 +392,24 @@ impl Project { eval_ view.execution_context_restart(model.execution_context_restart()); - eval graph_view.execution_mode((mode) model.execution_mode_changed(mode)); - eval graph_view.execution_mode([](mode) error!("project::execution_mode_changed {mode:?}")); - + eval graph_view.execution_environment((mode) model.execution_environment_changed(mode)); } let graph_controller = self.model.graph_controller.clone_ref(); self.init_analytics() - .init_execution_modes() + .init_execution_environments() .setup_notification_handler() .attach_frp_to_values_computed_notifications(graph_controller, values_computed) } - /// Initialises execution modes. Currently a dummy implementqation to be replaced during - /// implementation of #5930. - fn init_execution_modes(self) -> Self { + /// Initialises execution modes. + fn init_execution_environments(self) -> Self { let graph = &self.model.view.graph(); let entries = Rc::new(ExecutionEnvironment::list_all_as_imstrings()); - graph.set_available_execution_modes(entries); + graph.set_available_execution_environments(entries); let default_mode = ExecutionEnvironment::default(); - let default_mode: ImString = default_mode.into(); - graph.set_execution_mode(default_mode); + graph.set_execution_environment(default_mode); self } diff --git a/app/gui/view/Cargo.toml b/app/gui/view/Cargo.toml index c9d3c103bd11..73e0956319f5 100644 --- a/app/gui/view/Cargo.toml +++ b/app/gui/view/Cargo.toml @@ -23,7 +23,7 @@ ensogl-text = { path = "../../../lib/rust/ensogl/component/text" } ensogl-text-msdf = { path = "../../../lib/rust/ensogl/component/text/src/font/msdf" } ensogl-hardcoded-theme = { path = "../../../lib/rust/ensogl/app/theme/hardcoded" } ide-view-component-browser = { path = "component-browser" } -ide-view-execution-mode-selector = { path = "execution-mode-selector" } +ide-view-execution-environment-selector = { path = "execution-environment-selector" } ide-view-documentation = { path = "documentation" } ide-view-graph-editor = { path = "graph-editor" } span-tree = { path = "../language/span-tree" } diff --git a/app/gui/view/examples/Cargo.toml b/app/gui/view/examples/Cargo.toml index 2e6e9eb0e78f..0eae83f4486c 100644 --- a/app/gui/view/examples/Cargo.toml +++ b/app/gui/view/examples/Cargo.toml @@ -14,7 +14,7 @@ debug-scene-icons = { path = "icons" } debug-scene-interface = { path = "interface" } debug-scene-text-grid-visualization = { path = "text-grid-visualization" } debug-scene-visualization = { path = "visualization" } -debug-scene-execution-mode-dropdown = { path = "execution-mode-dropdown" } +debug-scene-execution-environment-dropdown = { path = "execution-environment-dropdown" } # Stop wasm-pack from running wasm-opt, because we run it from our build scripts in order to customize options. [package.metadata.wasm-pack.profile.release] diff --git a/app/gui/view/examples/execution-mode-dropdown/Cargo.toml b/app/gui/view/examples/execution-environment-dropdown/Cargo.toml similarity index 79% rename from app/gui/view/examples/execution-mode-dropdown/Cargo.toml rename to app/gui/view/examples/execution-environment-dropdown/Cargo.toml index f4e5658753e2..914bf583983d 100644 --- a/app/gui/view/examples/execution-mode-dropdown/Cargo.toml +++ b/app/gui/view/examples/execution-environment-dropdown/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "debug-scene-execution-mode-dropdown" +name = "debug-scene-execution-environment-dropdown" version = "0.1.0" authors = ["Enso Team "] edition = "2021" @@ -13,4 +13,4 @@ ensogl-drop-down-menu = { path = "../../../../../lib/rust/ensogl/component/drop- ensogl-list-view = { path = "../../../../../lib/rust/ensogl/component/list-view" } ensogl-hardcoded-theme = { path = "../../../../../lib/rust/ensogl/app/theme/hardcoded" } ensogl-text-msdf = { path = "../../../../../lib/rust/ensogl/component/text/src/font/msdf" } -ide-view-execution-mode-selector = { path = "../../execution-mode-selector" } +ide-view-execution-environment-selector = { path = "../../execution-environment-selector" } diff --git a/app/gui/view/examples/execution-mode-dropdown/src/lib.rs b/app/gui/view/examples/execution-environment-dropdown/src/lib.rs similarity index 74% rename from app/gui/view/examples/execution-mode-dropdown/src/lib.rs rename to app/gui/view/examples/execution-environment-dropdown/src/lib.rs index 35961d750965..1e4f9903d690 100644 --- a/app/gui/view/examples/execution-mode-dropdown/src/lib.rs +++ b/app/gui/view/examples/execution-environment-dropdown/src/lib.rs @@ -19,7 +19,7 @@ use ensogl::prelude::*; use ensogl::animation; use ensogl::application::Application; use ensogl_text_msdf::run_once_initialized; -use ide_view_execution_mode_selector as execution_mode_selector; +use ide_view_execution_environment_selector as execution_environment_selector; @@ -27,7 +27,7 @@ use ide_view_execution_mode_selector as execution_mode_selector; // === Initialisation === // ====================== -fn make_entries() -> execution_mode_selector::ExecutionModes { +fn make_entries() -> execution_environment_selector::ExecutionModes { Rc::new(vec!["development".to_string().into(), "production".to_string().into()]) } @@ -36,15 +36,16 @@ fn init(app: &Application) { let world = &app.display; let _scene = &world.default_scene; - let execution_mode_selector = execution_mode_selector::ExecutionModeSelector::new(&app); - world.add_child(&execution_mode_selector); - execution_mode_selector.set_available_execution_modes(make_entries()); + let execution_environment_selector = + execution_environment_selector::ExecutionModeSelector::new(&app); + world.add_child(&execution_environment_selector); + execution_environment_selector.set_available_execution_environments(make_entries()); world .on .before_frame .add(move |_time_info: animation::TimeInfo| { - let _keep_alive = &execution_mode_selector; + let _keep_alive = &execution_environment_selector; }) .forget(); } diff --git a/app/gui/view/examples/interface/Cargo.toml b/app/gui/view/examples/interface/Cargo.toml index 3f40e579dd98..bb5d53a12b24 100644 --- a/app/gui/view/examples/interface/Cargo.toml +++ b/app/gui/view/examples/interface/Cargo.toml @@ -14,7 +14,7 @@ ensogl = { path = "../../../../../lib/rust/ensogl" } ensogl-hardcoded-theme = { path = "../../../../../lib/rust/ensogl/app/theme/hardcoded" } ensogl-text-msdf = { path = "../../../../../lib/rust/ensogl/component/text/src/font/msdf" } ide-view = { path = "../.." } -ide-view-execution-mode-selector = { path = "../../execution-mode-selector" } +ide-view-execution-environment-selector = { path = "../../execution-environment-selector" } parser = { path = "../../../language/parser" } span-tree = { path = "../../../language/span-tree" } uuid = { version = "0.8", features = ["v4", "wasm-bindgen"] } diff --git a/app/gui/view/examples/interface/src/lib.rs b/app/gui/view/examples/interface/src/lib.rs index 0f33c1fc09d6..78901443c12e 100644 --- a/app/gui/view/examples/interface/src/lib.rs +++ b/app/gui/view/examples/interface/src/lib.rs @@ -256,7 +256,7 @@ fn init(app: &Application) { // === Execution Modes === - graph_editor.set_available_execution_modes(vec![ + graph_editor.set_available_execution_environments(vec![ "development".to_string().into(), "production".to_string().into(), ]); diff --git a/app/gui/view/examples/src/lib.rs b/app/gui/view/examples/src/lib.rs index 8fd4ae8c680d..3b18d962ff33 100644 --- a/app/gui/view/examples/src/lib.rs +++ b/app/gui/view/examples/src/lib.rs @@ -24,7 +24,7 @@ pub use debug_scene_component_list_panel_view as new_component_list_panel_view; pub use debug_scene_documentation as documentation; -pub use debug_scene_execution_mode_dropdown as execution_mode_dropdown; +pub use debug_scene_execution_environment_dropdown as execution_environment_dropdown; pub use debug_scene_icons as icons; pub use debug_scene_interface as interface; pub use debug_scene_text_grid_visualization as text_grid_visualization; diff --git a/app/gui/view/execution-mode-selector/Cargo.toml b/app/gui/view/execution-environment-selector/Cargo.toml similarity index 93% rename from app/gui/view/execution-mode-selector/Cargo.toml rename to app/gui/view/execution-environment-selector/Cargo.toml index a67a694a9dd1..216223954cc4 100644 --- a/app/gui/view/execution-mode-selector/Cargo.toml +++ b/app/gui/view/execution-environment-selector/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "ide-view-execution-mode-selector" +name = "ide-view-execution-environment-selector" version = "0.1.0" authors = ["Enso Team "] edition = "2021" diff --git a/app/gui/view/execution-mode-selector/src/lib.rs b/app/gui/view/execution-environment-selector/src/lib.rs similarity index 91% rename from app/gui/view/execution-mode-selector/src/lib.rs rename to app/gui/view/execution-environment-selector/src/lib.rs index 4ce5ada64234..ab2fba945398 100644 --- a/app/gui/view/execution-mode-selector/src/lib.rs +++ b/app/gui/view/execution-environment-selector/src/lib.rs @@ -29,7 +29,7 @@ use ensogl::display::camera::Camera2d; use ensogl::display::shape::StyleWatchFrp; use ensogl_derive_theme::FromTheme; use ensogl_gui_component::component; -use ensogl_hardcoded_theme::graph_editor::execution_mode_selector as theme; +use ensogl_hardcoded_theme::graph_editor::execution_environment_selector as theme; @@ -39,7 +39,7 @@ use ensogl_hardcoded_theme::graph_editor::execution_mode_selector as theme; /// Theme specification for the execution mode selector. #[derive(Debug, Clone, Copy, Default, FromTheme)] -#[base_path = "ensogl_hardcoded_theme::graph_editor::execution_mode_selector"] +#[base_path = "ensogl_hardcoded_theme::graph_editor::execution_environment_selector"] pub struct Style { play_button_size: f32, play_button_offset: f32, @@ -96,11 +96,11 @@ pub type ExecutionModes = Rc>; ensogl::define_endpoints_2! { Input { - set_available_execution_modes (ExecutionModes), - set_execution_mode (ExecutionMode), + set_available_execution_environments (ExecutionModes), + set_execution_environment (ExecutionMode), } Output { - selected_execution_mode (ExecutionMode), + selected_execution_environment (ExecutionMode), play_press(), size (Vector2), } @@ -253,17 +253,17 @@ impl component::Frp for Frp { // == Inputs == - eval input.set_available_execution_modes ((entries) model.set_entries(entries.clone())); + eval input.set_available_execution_environments ((entries) model.set_entries(entries.clone())); - update_selected_entry <- input.set_execution_mode.map2(&input.set_available_execution_modes, |entry, entries| { + update_selected_entry <- input.set_execution_environment.map2(&input.set_available_execution_environments, |entry, entries| { entries.iter().position(|mode| mode == entry) }); dropdown.frp.set_selected <+ update_selected_entry; selected_id <- dropdown.frp.chosen_entry.unwrap(); - selection <- all(input.set_available_execution_modes, selected_id); + selection <- all(input.set_available_execution_environments, selected_id); selected_entry <- selection.map(|(entries, entry_id)| entries[*entry_id].clone()); - output.selected_execution_mode <+ selected_entry; + output.selected_execution_environment <+ selected_entry; // == Outputs == diff --git a/app/gui/view/graph-editor/Cargo.toml b/app/gui/view/graph-editor/Cargo.toml index 5ad11d2ce967..57f04077ef56 100644 --- a/app/gui/view/graph-editor/Cargo.toml +++ b/app/gui/view/graph-editor/Cargo.toml @@ -24,7 +24,7 @@ ensogl-drop-manager = { path = "../../../../lib/rust/ensogl/component/drop-manag ensogl-hardcoded-theme = { path = "../../../../lib/rust/ensogl/app/theme/hardcoded" } ensogl-text-msdf = { path = "../../../../lib/rust/ensogl/component/text/src/font/msdf" } failure = { workspace = true } -ide-view-execution-mode-selector = { path = "../execution-mode-selector" } +ide-view-execution-environment-selector = { path = "../execution-environment-selector" } indexmap = "1.9.2" js-sys = { workspace = true } nalgebra = { workspace = true } diff --git a/app/gui/view/graph-editor/src/component/node.rs b/app/gui/view/graph-editor/src/component/node.rs index aefb462fd5c6..86391acd501f 100644 --- a/app/gui/view/graph-editor/src/component/node.rs +++ b/app/gui/view/graph-editor/src/component/node.rs @@ -31,6 +31,7 @@ use ensogl_hardcoded_theme as theme; use ensogl_hardcoded_theme; use std::f32::EPSILON; + // ============== // === Export === // ============== diff --git a/app/gui/view/graph-editor/src/execution_environment.rs b/app/gui/view/graph-editor/src/execution_environment.rs new file mode 100644 index 000000000000..011c542683c2 --- /dev/null +++ b/app/gui/view/graph-editor/src/execution_environment.rs @@ -0,0 +1,62 @@ +//! This module contains the logic for the execution mode selector. + +use super::*; + +use crate::Frp; + +use ide_view_execution_environment_selector::ExecutionMode; + + + +fn get_next_execution_environment( + current: &ExecutionMode, + available: &[ExecutionMode], +) -> Option { + let index = available.iter().position(|mode| mode == current)?; + let next_index = (index + 1) % available.len(); + Some(available[next_index].clone()) +} + +/// Initialise the FRP logic for the execution mode selector. +pub fn init_frp(frp: &Frp, model: &GraphEditorModelWithNetwork) { + let out = &frp.private.output; + let network = frp.network(); + let inputs = &model.frp; + let execution_environment_selector = &model.execution_environment_selector; + + frp::extend! { network + // === Execution Mode Changes === + + execution_environment_selector.set_available_execution_environments <+ frp.set_available_execution_environments; + selected_execution_environment <- frp.set_execution_environment.map(|env| (*env).into()); + execution_environment_state <- all(out.execution_environment,frp.set_available_execution_environments); + + execution_environment_toggled <- execution_environment_state.sample(&frp.toggle_execution_environment); + toggled_execution_environment <- execution_environment_toggled.map(|(mode,available)| get_next_execution_environment(mode,available)).unwrap(); + + external_execution_environment_update <- any(selected_execution_environment,toggled_execution_environment); + execution_environment_selector.set_execution_environment <+ external_execution_environment_update; + + execution_environment_update <- any(execution_environment_selector.selected_execution_environment,external_execution_environment_update); + out.execution_environment <+ execution_environment_update; + out.execution_environment_play_button_pressed <+ execution_environment_selector.play_press; + + + // === Layout === + init <- source::<()>(); + size_update <- all(init,execution_environment_selector.size,inputs.space_for_window_buttons); + eval size_update ([model]((_,size,gap_size)) { + let y_offset = MACOS_TRAFFIC_LIGHTS_VERTICAL_CENTER; + let traffic_light_width = traffic_lights_gap_width(); + + let execution_environment_selector_x = gap_size.x + traffic_light_width; + model.execution_environment_selector.set_x(execution_environment_selector_x); + let breadcrumb_gap_width = execution_environment_selector_x + size.x + TOP_BAR_ITEM_MARGIN; + model.breadcrumbs.gap_width(breadcrumb_gap_width); + + model.execution_environment_selector.set_y(y_offset + size.y / 2.0); + model.breadcrumbs.set_y(y_offset + component::breadcrumbs::HEIGHT / 2.0); + }); + } + init.emit(()); +} diff --git a/app/gui/view/graph-editor/src/execution_mode.rs b/app/gui/view/graph-editor/src/execution_mode.rs deleted file mode 100644 index 92f010148b47..000000000000 --- a/app/gui/view/graph-editor/src/execution_mode.rs +++ /dev/null @@ -1,62 +0,0 @@ -//! This module contains the logic for the execution mode selector. - -use super::*; - -use crate::Frp; - -use ide_view_execution_mode_selector::ExecutionMode; - - - -fn get_next_execution_mode( - current: &ExecutionMode, - available: &[ExecutionMode], -) -> Option { - let index = available.iter().position(|mode| mode == current)?; - let next_index = (index + 1) % available.len(); - Some(available[next_index].clone()) -} - -/// Initialise the FRP logic for the execution mode selector. -pub fn init_frp(frp: &Frp, model: &GraphEditorModelWithNetwork) { - let out = &frp.private.output; - let network = frp.network(); - let inputs = &model.frp; - let execution_mode_selector = &model.execution_mode_selector; - - frp::extend! { network - // === Execution Mode Changes === - - execution_mode_selector.set_available_execution_modes <+ frp.set_available_execution_modes; - execution_mode_selector.set_execution_mode <+ frp.set_execution_mode; - execution_mode_state <- all(out.execution_mode,frp.set_available_execution_modes); - - execution_mode_toggled <- execution_mode_state.sample(&frp.toggle_execution_mode); - toggled_execution_mode <- execution_mode_toggled.map(|(mode,available)| get_next_execution_mode(mode,available)).unwrap(); - - external_execution_mode_update <- any(frp.set_execution_mode,toggled_execution_mode); - execution_mode_selector.set_execution_mode <+ external_execution_mode_update; - - execution_mode_update <- any(execution_mode_selector.selected_execution_mode,external_execution_mode_update); - out.execution_mode <+ execution_mode_update; - out.execution_mode_play_button_pressed <+ execution_mode_selector.play_press; - - - // === Layout === - init <- source::<()>(); - size_update <- all(init,execution_mode_selector.size,inputs.space_for_window_buttons); - eval size_update ([model]((_,size,gap_size)) { - let y_offset = MACOS_TRAFFIC_LIGHTS_VERTICAL_CENTER; - let traffic_light_width = traffic_lights_gap_width(); - - let execution_mode_selector_x = gap_size.x + traffic_light_width; - model.execution_mode_selector.set_x(execution_mode_selector_x); - let breadcrumb_gap_width = execution_mode_selector_x + size.x + TOP_BAR_ITEM_MARGIN; - model.breadcrumbs.gap_width(breadcrumb_gap_width); - - model.execution_mode_selector.set_y(y_offset + size.y / 2.0); - model.breadcrumbs.set_y(y_offset + component::breadcrumbs::HEIGHT / 2.0); - }); - } - init.emit(()); -} diff --git a/app/gui/view/graph-editor/src/lib.rs b/app/gui/view/graph-editor/src/lib.rs index cec966ab4713..e639b086a9ef 100644 --- a/app/gui/view/graph-editor/src/lib.rs +++ b/app/gui/view/graph-editor/src/lib.rs @@ -34,7 +34,7 @@ pub mod component; pub mod automation; pub mod builtin; pub mod data; -pub mod execution_mode; +pub mod execution_environment; pub mod new_node_position; #[warn(missing_docs)] pub mod profiling; @@ -78,7 +78,7 @@ use ensogl_component::text; use ensogl_component::text::buffer::selection::Selection; use ensogl_component::tooltip::Tooltip; use ensogl_hardcoded_theme as theme; -use ide_view_execution_mode_selector as execution_mode_selector; +use ide_view_execution_environment_selector as execution_environment_selector; // =============== @@ -582,9 +582,11 @@ ensogl::define_endpoints_2! { // === Execution Environment === - set_execution_environment(ExecutionEnvironment), // TODO(#5930): Temporary shortcut for testing different execution environments toggle_execution_environment(), + /// Set the execution modes available to the graph. + set_available_execution_environments (Rc>), + set_execution_environment (ExecutionEnvironment), // === Debug === @@ -654,10 +656,7 @@ ensogl::define_endpoints_2! { /// Drop an edge that is being dragged. drop_dragged_edge (), - /// Set the execution modes available to the graph. - set_available_execution_modes (Rc>), - set_execution_mode (execution_mode_selector::ExecutionMode), - toggle_execution_mode(), + } @@ -761,9 +760,9 @@ ensogl::define_endpoints_2! { min_x_spacing_for_new_nodes (f32), /// The selected execution mode. - execution_mode (execution_mode_selector::ExecutionMode), + execution_environment (execution_environment_selector::ExecutionMode), /// A press of the execution mode selector play button. - execution_mode_play_button_pressed (), + execution_environment_play_button_pressed (), } } @@ -1767,25 +1766,25 @@ impl GraphEditorModelWithNetwork { #[derive(Debug, Clone, CloneRef)] #[allow(missing_docs)] // FIXME[everyone] Public-facing API should be documented. pub struct GraphEditorModel { - pub display_object: display::object::Instance, - pub app: Application, - pub breadcrumbs: component::Breadcrumbs, - pub cursor: cursor::Cursor, - pub nodes: Nodes, - pub edges: Edges, - pub vis_registry: visualization::Registry, - pub drop_manager: ensogl_drop_manager::Manager, - pub navigator: Navigator, - pub add_node_button: Rc, - tooltip: Tooltip, - touch_state: TouchState, - visualisations: Visualisations, - frp: Frp, - profiling_statuses: profiling::Statuses, - profiling_button: component::profiling::Button, - styles_frp: StyleWatchFrp, - selection_controller: selection::Controller, - execution_mode_selector: execution_mode_selector::ExecutionModeSelector, + pub display_object: display::object::Instance, + pub app: Application, + pub breadcrumbs: component::Breadcrumbs, + pub cursor: cursor::Cursor, + pub nodes: Nodes, + pub edges: Edges, + pub vis_registry: visualization::Registry, + pub drop_manager: ensogl_drop_manager::Manager, + pub navigator: Navigator, + pub add_node_button: Rc, + tooltip: Tooltip, + touch_state: TouchState, + visualisations: Visualisations, + frp: Frp, + profiling_statuses: profiling::Statuses, + profiling_button: component::profiling::Button, + styles_frp: StyleWatchFrp, + selection_controller: selection::Controller, + execution_environment_selector: execution_environment_selector::ExecutionModeSelector, } @@ -1803,7 +1802,8 @@ impl GraphEditorModel { let visualisations = default(); let touch_state = TouchState::new(network, &scene.mouse.frp_deprecated); let breadcrumbs = component::Breadcrumbs::new(app.clone_ref()); - let execution_mode_selector = execution_mode_selector::ExecutionModeSelector::new(app); + let execution_environment_selector = + execution_environment_selector::ExecutionModeSelector::new(app); let app = app.clone_ref(); let frp = frp.clone_ref(); @@ -1842,7 +1842,7 @@ impl GraphEditorModel { add_node_button, styles_frp, selection_controller, - execution_mode_selector, + execution_environment_selector, } .init() } @@ -1850,7 +1850,7 @@ impl GraphEditorModel { fn init(self) -> Self { let x_offset = MACOS_TRAFFIC_LIGHTS_SIDE_OFFSET; - self.add_child(&self.execution_mode_selector); + self.add_child(&self.execution_environment_selector); self.add_child(&self.breadcrumbs); self.breadcrumbs.set_x(x_offset); @@ -3826,7 +3826,7 @@ fn new_graph_editor(app: &Application) -> GraphEditor { // === Execution Mode Selection === // ================================ - execution_mode::init_frp(&frp, &model); + execution_environment::init_frp(&frp, &model); // ================== diff --git a/app/gui/view/graph-editor/src/shortcuts.rs b/app/gui/view/graph-editor/src/shortcuts.rs index daa40795b22b..9f35d40f3ad2 100644 --- a/app/gui/view/graph-editor/src/shortcuts.rs +++ b/app/gui/view/graph-editor/src/shortcuts.rs @@ -55,7 +55,7 @@ pub const SHORTCUTS: &[(ensogl::application::shortcut::ActionType, &str, &str, & // === Profiling Mode === (Press, "", "cmd p", "toggle_profiling_mode"), // === Execution Mode === - (Press, "", "shift ctrl e", "toggle_execution_mode"), + (Press, "", "shift ctrl e", "toggle_execution_environment"), // === Debug === (Press, "debug_mode", "ctrl d", "debug_set_test_visualization_data_for_selected_node"), (Press, "debug_mode", "ctrl shift enter", "debug_push_breadcrumb"), diff --git a/app/gui/view/src/lib.rs b/app/gui/view/src/lib.rs index f8f56740f9e3..ab816ae54bc7 100644 --- a/app/gui/view/src/lib.rs +++ b/app/gui/view/src/lib.rs @@ -41,7 +41,7 @@ pub mod window_control_buttons; pub use ide_view_component_browser as component_browser; pub use ide_view_documentation as documentation; -pub use ide_view_execution_mode_selector as execution_mode_selector; +pub use ide_view_execution_environment_selector as execution_environment_selector; pub use ide_view_graph_editor as graph_editor; pub use welcome_screen; diff --git a/lib/rust/ensogl/app/theme/hardcoded/src/lib.rs b/lib/rust/ensogl/app/theme/hardcoded/src/lib.rs index aa823e97db70..496f74cf5282 100644 --- a/lib/rust/ensogl/app/theme/hardcoded/src/lib.rs +++ b/lib/rust/ensogl/app/theme/hardcoded/src/lib.rs @@ -654,7 +654,7 @@ define_themes! { [light:0, dark:1] color = Rgba(0.0, 0.451, 0.859, 1.0), Rgba(0.0, 0.451, 0.859, 1.0); } } - execution_mode_selector { + execution_environment_selector { background = Rgb::from_base_255(100.0, 181.0, 38.0), Rgb::from_base_255(100.0, 181.0, 38.0); divider = Rgba::black_with_alpha(0.12), Rgba::black_with_alpha(0.12); triangle = Rgba::white_with_alpha(0.75), Rgba::white_with_alpha(0.75); From f00c01239d49702b3a3756d663c1e61f9fdc5119 Mon Sep 17 00:00:00 2001 From: Michael Mauderer Date: Tue, 18 Apr 2023 15:39:42 +0100 Subject: [PATCH 07/23] Refactoring & code style. --- .../engine-protocol/src/language_server.rs | 2 +- app/gui/src/controller/graph/executed.rs | 2 +- app/gui/src/model/execution_context.rs | 2 +- app/gui/src/model/execution_context/plain.rs | 6 +-- .../model/execution_context/synchronized.rs | 2 +- app/gui/src/presenter/graph.rs | 7 --- app/gui/src/presenter/project.rs | 6 +-- .../execution-environment-dropdown/src/lib.rs | 8 +-- app/gui/view/examples/interface/src/lib.rs | 4 +- .../execution-environment-selector/src/lib.rs | 36 ++++++------- .../graph-editor/src/execution_environment.rs | 20 ++++--- app/gui/view/graph-editor/src/lib.rs | 14 ++--- .../node/callable/ApplicationNode.java | 10 ++-- .../callable/IndirectInvokeCallableNode.java | 52 +++++++++---------- .../IndirectInvokeConversionNode.java | 40 +++++++------- .../callable/IndirectInvokeMethodNode.java | 52 +++++++++---------- .../node/callable/InteropApplicationNode.java | 8 +-- .../callable/InteropConversionCallNode.java | 10 ++-- .../node/callable/InteropMethodCallNode.java | 12 ++--- .../node/callable/InvokeCallableNode.java | 36 ++++++------- .../node/callable/InvokeConversionNode.java | 20 +++---- .../node/callable/InvokeMethodNode.java | 24 ++++----- .../callable/argument/ArgumentSorterNode.java | 14 ++--- .../argument/IndirectArgumentSorterNode.java | 8 +-- .../node/callable/dispatch/CurryNode.java | 36 ++++++------- .../callable/dispatch/IndirectCurryNode.java | 24 ++++----- .../dispatch/IndirectInvokeFunctionNode.java | 18 +++---- .../callable/dispatch/InvokeFunctionNode.java | 40 +++++++------- .../callable/thunk/ThunkExecutorNode.java | 8 +-- .../node/expression/builtin/Builtin.java | 2 +- .../builtin/error/CatchAnyNode.java | 4 +- .../builtin/error/CatchErrorNode.java | 4 +- .../builtin/error/CatchPanicNode.java | 4 +- .../builtin/function/ApplicationOperator.java | 4 +- .../expression/builtin/io/PrintErrNode.java | 4 +- .../expression/builtin/io/PrintlnNode.java | 8 +-- .../builtin/meta/AtomWithAHoleNode.java | 8 +-- .../builtin/meta/EqualsAtomNode.java | 6 +-- .../ordering/CustomComparatorNode.java | 6 +-- .../builtin/ordering/HashCallbackNode.java | 8 +-- .../builtin/resource/BracketNode.java | 8 +-- .../expression/builtin/resource/WithNode.java | 4 +- .../builtin/runtime/NoInlineWithArgNode.java | 4 +- .../callable/argument/ArgumentDefinition.java | 14 ++--- .../callable/atom/AtomConstructor.java | 2 +- .../unboxing/SuspendedFieldGetterNode.java | 2 +- .../callable/function/FunctionSchema.java | 8 +-- .../enso/interpreter/runtime/data/Type.java | 4 +- .../runtime/error/PanicException.java | 8 +-- .../enso/compiler/codegen/IrToTruffle.scala | 22 ++++---- .../enso/interpreter/dsl/MethodProcessor.java | 8 +-- 51 files changed, 331 insertions(+), 332 deletions(-) diff --git a/app/gui/controller/engine-protocol/src/language_server.rs b/app/gui/controller/engine-protocol/src/language_server.rs index aa029d36cd2e..b5c0fe53ab52 100644 --- a/app/gui/controller/engine-protocol/src/language_server.rs +++ b/app/gui/controller/engine-protocol/src/language_server.rs @@ -206,7 +206,7 @@ trait API { #[MethodInput=VcsRestoreInput, rpc_name="vcs/restore"] fn restore_vcs(&self, root: Path, commit_id: Option) -> response::RestoreVcs; - /// Set the execution mode of the context for future evaluations. + /// Set the execution environment of the context for future evaluations. #[MethodInput=SetModeInput, rpc_name="executionContext/setExecutionEnvironment"] fn set_execution_environment(&self, context_id: ContextId, execution_environment: ExecutionEnvironment) -> (); diff --git a/app/gui/src/controller/graph/executed.rs b/app/gui/src/controller/graph/executed.rs index 240f13521094..ddaf0feabef2 100644 --- a/app/gui/src/controller/graph/executed.rs +++ b/app/gui/src/controller/graph/executed.rs @@ -320,7 +320,7 @@ impl Handle { self.graph.borrow().disconnect(connection, self) } - /// Set the execution mode. + /// Set the execution environment. pub async fn set_mode(&self, mode: ExecutionEnvironment) -> FallibleResult { self.execution_ctx.set_mode(mode).await?; Ok(()) diff --git a/app/gui/src/model/execution_context.rs b/app/gui/src/model/execution_context.rs index ab08ebadf7f6..23c20dea2c53 100644 --- a/app/gui/src/model/execution_context.rs +++ b/app/gui/src/model/execution_context.rs @@ -505,7 +505,7 @@ pub trait API: Debug { /// Adjust method pointers after the project rename action. fn rename_method_pointers(&self, old_project_name: String, new_project_name: String); - /// Set the execution mode of the context. + /// Set the execution environment of the context. #[allow(clippy::needless_lifetimes)] fn set_mode<'a>(&'a self, mode: ExecutionEnvironment) -> BoxFuture<'a, FallibleResult>; } diff --git a/app/gui/src/model/execution_context/plain.rs b/app/gui/src/model/execution_context/plain.rs index 935a184f7168..85435a169004 100644 --- a/app/gui/src/model/execution_context/plain.rs +++ b/app/gui/src/model/execution_context/plain.rs @@ -279,9 +279,9 @@ impl model::execution_context::API for ExecutionContext { }); } - fn set_mode(&self, mode: ExecutionEnvironment) -> BoxFuture { - info!("Setting execution mode to {mode:?}."); - self.execution_environment.set(mode); + fn set_mode(&self, environment: ExecutionEnvironment) -> BoxFuture { + info!("Setting execution environment to {environment:?}."); + self.execution_environment.set(environment); futures::future::ready(Ok(())).boxed_local() } } diff --git a/app/gui/src/model/execution_context/synchronized.rs b/app/gui/src/model/execution_context/synchronized.rs index adb11e11a664..16fbcc27c16f 100644 --- a/app/gui/src/model/execution_context/synchronized.rs +++ b/app/gui/src/model/execution_context/synchronized.rs @@ -317,7 +317,7 @@ impl model::execution_context::API for ExecutionContext { fn set_mode(&self, mode: ExecutionEnvironment) -> BoxFuture { self.model.execution_environment.set(mode); async move { - info!("Setting execution mode to {mode:?}."); + info!("Setting execution environment to {mode:?}."); self.language_server.client.set_execution_environment(&self.id, &mode).await?; Ok(()) } diff --git a/app/gui/src/presenter/graph.rs b/app/gui/src/presenter/graph.rs index 1876ec8207bd..99d7a4c1d99e 100644 --- a/app/gui/src/presenter/graph.rs +++ b/app/gui/src/presenter/graph.rs @@ -502,13 +502,6 @@ impl Model { self.execution_environment.set(new_environment); new_environment } - - // fn set_execution_environment(&self, mode: - // ide_view::execution_environment_selector::ExecutionMode) { match mode.as_str(). - // try_into() { Ok(mode) => self.execution_environment.set(mode), - // Err(_err) => error!("Invalid execution mode given: {mode:?}"), - // } - // } } diff --git a/app/gui/src/presenter/project.rs b/app/gui/src/presenter/project.rs index b06e6ef0caf4..e86e85408f34 100644 --- a/app/gui/src/presenter/project.rs +++ b/app/gui/src/presenter/project.rs @@ -282,13 +282,13 @@ impl Model { fn execution_environment_changed( &self, - mode: &ide_view::execution_environment_selector::ExecutionMode, + mode: &ide_view::execution_environment_selector::ExecutionEnvironment, ) { if let Ok(mode) = mode.as_str().try_into() { let graph_controller = self.graph_controller.clone_ref(); executor::global::spawn(async move { if let Err(err) = graph_controller.set_mode(mode).await { - error!("Error setting execution mode: {err}"); + error!("Error setting execution environment: {err}"); } }); } else { @@ -403,7 +403,7 @@ impl Project { .attach_frp_to_values_computed_notifications(graph_controller, values_computed) } - /// Initialises execution modes. + /// Initialises execution environment. fn init_execution_environments(self) -> Self { let graph = &self.model.view.graph(); let entries = Rc::new(ExecutionEnvironment::list_all_as_imstrings()); diff --git a/app/gui/view/examples/execution-environment-dropdown/src/lib.rs b/app/gui/view/examples/execution-environment-dropdown/src/lib.rs index 1e4f9903d690..46b80b614cb4 100644 --- a/app/gui/view/examples/execution-environment-dropdown/src/lib.rs +++ b/app/gui/view/examples/execution-environment-dropdown/src/lib.rs @@ -20,15 +20,15 @@ use ensogl::animation; use ensogl::application::Application; use ensogl_text_msdf::run_once_initialized; use ide_view_execution_environment_selector as execution_environment_selector; - +use ide_view_execution_environment_selector::ExecutionEnvironments; // ====================== // === Initialisation === // ====================== -fn make_entries() -> execution_environment_selector::ExecutionModes { - Rc::new(vec!["development".to_string().into(), "production".to_string().into()]) +fn make_entries() -> ExecutionEnvironments { + Rc::new(vec!["Design".to_string().into(), "Live".to_string().into()]) } fn init(app: &Application) { @@ -37,7 +37,7 @@ fn init(app: &Application) { let _scene = &world.default_scene; let execution_environment_selector = - execution_environment_selector::ExecutionModeSelector::new(&app); + execution_environment_selector::ExecutionEnvironmentSelector::new(&app); world.add_child(&execution_environment_selector); execution_environment_selector.set_available_execution_environments(make_entries()); diff --git a/app/gui/view/examples/interface/src/lib.rs b/app/gui/view/examples/interface/src/lib.rs index 78901443c12e..d378af009009 100644 --- a/app/gui/view/examples/interface/src/lib.rs +++ b/app/gui/view/examples/interface/src/lib.rs @@ -257,8 +257,8 @@ fn init(app: &Application) { // === Execution Modes === graph_editor.set_available_execution_environments(vec![ - "development".to_string().into(), - "production".to_string().into(), + "Live".to_string().into(), + "Design".to_string().into(), ]); diff --git a/app/gui/view/execution-environment-selector/src/lib.rs b/app/gui/view/execution-environment-selector/src/lib.rs index ab2fba945398..ecd7b8c85c8d 100644 --- a/app/gui/view/execution-environment-selector/src/lib.rs +++ b/app/gui/view/execution-environment-selector/src/lib.rs @@ -37,7 +37,7 @@ use ensogl_hardcoded_theme::graph_editor::execution_environment_selector as them // === Style === // ============== -/// Theme specification for the execution mode selector. +/// Theme specification for the execution environment selector. #[derive(Debug, Clone, Copy, Default, FromTheme)] #[base_path = "ensogl_hardcoded_theme::graph_editor::execution_environment_selector"] pub struct Style { @@ -89,18 +89,18 @@ mod play_icon { // === FRP === // =========== -/// An identifier of a execution mode. -pub type ExecutionMode = ImString; -/// A list of execution modes. -pub type ExecutionModes = Rc>; +/// An identifier of a execution environment. +pub type ExecutionEnvironment = ImString; +/// A list of execution environments. +pub type ExecutionEnvironments = Rc>; ensogl::define_endpoints_2! { Input { - set_available_execution_environments (ExecutionModes), - set_execution_environment (ExecutionMode), + set_available_execution_environments (ExecutionEnvironments), + set_execution_environment (ExecutionEnvironment), } Output { - selected_execution_environment (ExecutionMode), + selected_execution_environment (ExecutionEnvironment), play_press(), size (Vector2), } @@ -111,13 +111,13 @@ ensogl::define_endpoints_2! { // === Model === // ============= -/// The model of the execution mode selector. +/// The model of the execution environment selector. #[derive(Debug, Clone, CloneRef)] pub struct Model { - /// Main root object for the execution mode selector exposed for external positioning. + /// Main root object for the execution environment selector exposed for external positioning. display_object: display::object::Instance, - /// Inner root that will be used for positioning the execution mode selector relative to the - /// window + /// Inner root that will be used for positioning the execution environment selector relative to + /// the window inner_root: display::object::Instance, background: display::shape::compound::rectangle::Rectangle, divider: display::shape::compound::rectangle::Rectangle, @@ -166,7 +166,7 @@ impl Model { self.inner_root.set_y(y.round()); } - fn set_entries(&self, entries: Rc>) { + fn set_entries(&self, entries: Rc>) { let provider = ensogl_list_view::entry::AnyModelProvider::from(entries.clone_ref()); self.dropdown.set_entries(provider); self.dropdown.set_selected(0); @@ -181,12 +181,12 @@ impl display::Object for Model { // ============================= -// === ExecutionModeDropdown === +// === ExecutionEnvironmentDropdown === // ============================= impl component::Model for Model { fn label() -> &'static str { - "ExecutionModeDropdown" + "ExecutionEnvironmentDropdown" } fn new(app: &Application) -> Self { @@ -276,6 +276,6 @@ impl component::Frp for Frp { } } -/// ExecutionModeSelector is a component that allows the user to select the execution mode of the -/// graph. -pub type ExecutionModeSelector = component::ComponentView; +/// ExecutionEnvironmentSelector is a component that allows the user to select the execution +/// environment of the graph. +pub type ExecutionEnvironmentSelector = component::ComponentView; diff --git a/app/gui/view/graph-editor/src/execution_environment.rs b/app/gui/view/graph-editor/src/execution_environment.rs index 011c542683c2..ecaf7175dd3f 100644 --- a/app/gui/view/graph-editor/src/execution_environment.rs +++ b/app/gui/view/graph-editor/src/execution_environment.rs @@ -1,23 +1,26 @@ -//! This module contains the logic for the execution mode selector. +//! This module contains the logic for the execution environment selector. use super::*; use crate::Frp; -use ide_view_execution_environment_selector::ExecutionMode; +use ide_view_execution_environment_selector::ExecutionEnvironment; +// ============================= +// === Execution Environment === +// ============================= fn get_next_execution_environment( - current: &ExecutionMode, - available: &[ExecutionMode], -) -> Option { + current: &ExecutionEnvironment, + available: &[ExecutionEnvironment], +) -> Option { let index = available.iter().position(|mode| mode == current)?; let next_index = (index + 1) % available.len(); Some(available[next_index].clone()) } -/// Initialise the FRP logic for the execution mode selector. +/// Initialise the FRP logic for the execution environment selector. pub fn init_frp(frp: &Frp, model: &GraphEditorModelWithNetwork) { let out = &frp.private.output; let network = frp.network(); @@ -25,7 +28,9 @@ pub fn init_frp(frp: &Frp, model: &GraphEditorModelWithNetwork) { let execution_environment_selector = &model.execution_environment_selector; frp::extend! { network - // === Execution Mode Changes === + + + // === Execution Environment Changes === execution_environment_selector.set_available_execution_environments <+ frp.set_available_execution_environments; selected_execution_environment <- frp.set_execution_environment.map(|env| (*env).into()); @@ -43,6 +48,7 @@ pub fn init_frp(frp: &Frp, model: &GraphEditorModelWithNetwork) { // === Layout === + init <- source::<()>(); size_update <- all(init,execution_environment_selector.size,inputs.space_for_window_buttons); eval size_update ([model]((_,size,gap_size)) { diff --git a/app/gui/view/graph-editor/src/lib.rs b/app/gui/view/graph-editor/src/lib.rs index e639b086a9ef..797148a602a8 100644 --- a/app/gui/view/graph-editor/src/lib.rs +++ b/app/gui/view/graph-editor/src/lib.rs @@ -584,8 +584,8 @@ ensogl::define_endpoints_2! { // TODO(#5930): Temporary shortcut for testing different execution environments toggle_execution_environment(), - /// Set the execution modes available to the graph. - set_available_execution_environments (Rc>), + /// Set the execution environmenta available to the graph. + set_available_execution_environments (Rc>), set_execution_environment (ExecutionEnvironment), @@ -759,9 +759,9 @@ ensogl::define_endpoints_2! { default_y_gap_between_nodes (f32), min_x_spacing_for_new_nodes (f32), - /// The selected execution mode. - execution_environment (execution_environment_selector::ExecutionMode), - /// A press of the execution mode selector play button. + /// The selected environment mode. + execution_environment (execution_environment_selector::ExecutionEnvironment), + /// A press of the execution environment selector play button. execution_environment_play_button_pressed (), } } @@ -1784,7 +1784,7 @@ pub struct GraphEditorModel { profiling_button: component::profiling::Button, styles_frp: StyleWatchFrp, selection_controller: selection::Controller, - execution_environment_selector: execution_environment_selector::ExecutionModeSelector, + execution_environment_selector: execution_environment_selector::ExecutionEnvironmentSelector, } @@ -1803,7 +1803,7 @@ impl GraphEditorModel { let touch_state = TouchState::new(network, &scene.mouse.frp_deprecated); let breadcrumbs = component::Breadcrumbs::new(app.clone_ref()); let execution_environment_selector = - execution_environment_selector::ExecutionModeSelector::new(app); + execution_environment_selector::ExecutionEnvironmentSelector::new(app); let app = app.clone_ref(); let frp = frp.clone_ref(); diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/ApplicationNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/ApplicationNode.java index 0abe83bcd349..77b2e8dd07d9 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/ApplicationNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/ApplicationNode.java @@ -28,7 +28,7 @@ public class ApplicationNode extends ExpressionNode { private ApplicationNode( ExpressionNode callable, CallArgument[] callArguments, - InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode) { + InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment) { this.argExpressions = Arrays.stream(callArguments) .map(CallArgument::getExpression) @@ -40,7 +40,7 @@ private ApplicationNode( this.callable = callable; this.invokeCallableNode = InvokeCallableNode.build( - argSchema, defaultsExecutionMode, InvokeCallableNode.ArgumentsExecutionMode.EXECUTE); + argSchema, defaultsExecutionEnvironment, InvokeCallableNode.ArgumentsExecutionEnvironment.EXECUTE); } /** @@ -48,14 +48,14 @@ private ApplicationNode( * * @param callable the object being called * @param callArguments the arguments to pass to {@code callable} - * @param defaultsExecutionMode whether or not defaults should be executed + * @param defaultsExecutionEnvironment whether or not defaults should be executed * @return a node representing a function application */ public static ApplicationNode build( ExpressionNode callable, CallArgument[] callArguments, - InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode) { - return new ApplicationNode(callable, callArguments, defaultsExecutionMode); + InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment) { + return new ApplicationNode(callable, callArguments, defaultsExecutionEnvironment); } /** diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/IndirectInvokeCallableNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/IndirectInvokeCallableNode.java index cdb69eb65322..1b7c86853b2e 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/IndirectInvokeCallableNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/IndirectInvokeCallableNode.java @@ -42,8 +42,8 @@ public abstract class IndirectInvokeCallableNode extends Node { * @param state current monadic state. * @param arguments arguments to pass to the callable. * @param schema names and ordering of the arguments. - * @param defaultsExecutionMode whether defaults are suspended for this call. - * @param argumentsExecutionMode whether arguments are preexecuted for this call. + * @param defaultsExecutionEnvironment whether defaults are suspended for this call. + * @param argumentsExecutionEnvironment whether arguments are preexecuted for this call. * @param isTail is the call happening in a tail position. * @return the result of executing the callable. */ @@ -53,8 +53,8 @@ public abstract Object execute( State state, Object[] arguments, CallArgumentInfo[] schema, - InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, - InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, + InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, + InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, BaseNode.TailStatus isTail); /** @@ -69,8 +69,8 @@ Object invokeWithWarnings( State state, Object[] arguments, CallArgumentInfo[] schema, - InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, - InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, + InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, + InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, BaseNode.TailStatus isTail, @Cached IndirectInvokeCallableNode invokeCallableNode, @CachedLibrary(limit = "3") WarningsLibrary warnings) { @@ -82,8 +82,8 @@ Object invokeWithWarnings( state, arguments, schema, - defaultsExecutionMode, - argumentsExecutionMode, + defaultsExecutionEnvironment, + argumentsExecutionEnvironment, isTail); Warning[] extracted = warnings.getWarnings(warning, null); @@ -100,8 +100,8 @@ Object invokeFunction( State state, Object[] arguments, CallArgumentInfo[] schema, - InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, - InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, + InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, + InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, BaseNode.TailStatus isTail, @Cached IndirectInvokeFunctionNode invokeFunctionNode) { return invokeFunctionNode.execute( @@ -110,8 +110,8 @@ Object invokeFunction( state, arguments, schema, - defaultsExecutionMode, - argumentsExecutionMode, + defaultsExecutionEnvironment, + argumentsExecutionEnvironment, isTail); } @@ -122,8 +122,8 @@ Object invokeConstructor( State state, Object[] arguments, CallArgumentInfo[] schema, - InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, - InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, + InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, + InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, BaseNode.TailStatus isTail, @Cached IndirectInvokeFunctionNode invokeFunctionNode) { return invokeFunction( @@ -132,8 +132,8 @@ Object invokeConstructor( state, arguments, schema, - defaultsExecutionMode, - argumentsExecutionMode, + defaultsExecutionEnvironment, + argumentsExecutionEnvironment, isTail, invokeFunctionNode); } @@ -145,8 +145,8 @@ Object invokeDataflowError( State state, Object[] arguments, CallArgumentInfo[] schema, - InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, - InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, + InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, + InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, BaseNode.TailStatus isTail) { return error; } @@ -158,8 +158,8 @@ Object invokePanicSentinel( State state, Object[] arguments, CallArgumentInfo[] schema, - InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, - InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, + InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, + InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, BaseNode.TailStatus isTail) { throw sentinel; } @@ -171,8 +171,8 @@ public Object invokeDynamicSymbol( State state, Object[] arguments, CallArgumentInfo[] schema, - InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, - InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, + InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, + InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, BaseNode.TailStatus isTail, @Cached IndirectInvokeMethodNode invokeMethodNode, @Cached ThunkExecutorNode thisExecutor) { @@ -181,7 +181,7 @@ public Object invokeDynamicSymbol( int thisArgumentPosition = thisArg == null ? 0 : thisArg; if (canApplyThis) { Object self = arguments[thisArgumentPosition]; - if (argumentsExecutionMode.shouldExecute()) { + if (argumentsExecutionEnvironment.shouldExecute()) { self = thisExecutor.executeThunk(self, state, BaseNode.TailStatus.NOT_TAIL); arguments[thisArgumentPosition] = self; } @@ -192,8 +192,8 @@ public Object invokeDynamicSymbol( self, arguments, schema, - defaultsExecutionMode, - argumentsExecutionMode, + defaultsExecutionEnvironment, + argumentsExecutionEnvironment, isTail, thisArgumentPosition); } else { @@ -209,7 +209,7 @@ public Object invokeGeneric( State state, Object[] arguments, CallArgumentInfo[] schema, - InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, + InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionMode, InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, BaseNode.TailStatus isTail) { Atom error = EnsoContext.get(this).getBuiltins().error().makeNotInvokable(callable); diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/IndirectInvokeConversionNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/IndirectInvokeConversionNode.java index 0f397f0871ba..d86dc6a76e36 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/IndirectInvokeConversionNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/IndirectInvokeConversionNode.java @@ -37,8 +37,8 @@ public abstract Object execute( Object that, Object[] arguments, CallArgumentInfo[] schema, - InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, - InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, + InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, + InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, BaseNode.TailStatus isTail, int thatArgumentPosition); @@ -51,8 +51,8 @@ Object doConvertFrom( Object that, Object[] arguments, CallArgumentInfo[] schema, - InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, - InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, + InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, + InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, BaseNode.TailStatus isTail, int thatArgumentPosition, @CachedLibrary(limit = "10") TypesLibrary dispatch, @@ -70,8 +70,8 @@ Object doConvertFrom( state, arguments, schema, - defaultsExecutionMode, - argumentsExecutionMode, + defaultsExecutionEnvironment, + argumentsExecutionEnvironment, isTail); } @@ -84,8 +84,8 @@ Object doDataflowError( DataflowError that, Object[] arguments, CallArgumentInfo[] schema, - InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, - InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, + InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, + InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, BaseNode.TailStatus isTail, int thatArgumentPosition, @CachedLibrary(limit = "10") TypesLibrary dispatch, @@ -103,8 +103,8 @@ Object doDataflowError( state, arguments, schema, - defaultsExecutionMode, - argumentsExecutionMode, + defaultsExecutionEnvironment, + argumentsExecutionEnvironment, isTail); } else { return that; @@ -120,8 +120,8 @@ Object doPanicSentinel( PanicSentinel that, Object[] arguments, CallArgumentInfo[] schema, - InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, - InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, + InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, + InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, BaseNode.TailStatus isTail, int thatArgumentPosition) { throw that; @@ -136,8 +136,8 @@ Object doWarning( WithWarnings that, Object[] arguments, CallArgumentInfo[] schema, - InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, - InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, + InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, + InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, BaseNode.TailStatus isTail, int thatArgumentPosition, @Cached IndirectInvokeConversionNode childDispatch) { @@ -152,8 +152,8 @@ Object doWarning( that.getValue(), arguments, schema, - defaultsExecutionMode, - argumentsExecutionMode, + defaultsExecutionEnvironment, + argumentsExecutionEnvironment, isTail, thatArgumentPosition); return WithWarnings.prependTo(result, warnings); @@ -168,8 +168,8 @@ Object doConvertText( Object that, Object[] arguments, CallArgumentInfo[] schema, - InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, - InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, + InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, + InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, BaseNode.TailStatus isTail, int thatArgumentPosition, @CachedLibrary(limit = "10") TypesLibrary methods, @@ -192,8 +192,8 @@ Object doConvertText( state, arguments, schema, - defaultsExecutionMode, - argumentsExecutionMode, + defaultsExecutionEnvironment, + argumentsExecutionEnvironment, isTail); } catch (UnsupportedMessageException e) { throw new IllegalStateException("Impossible, that is guaranteed to be a string."); diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/IndirectInvokeMethodNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/IndirectInvokeMethodNode.java index 6a22a01234e8..3526cf04d687 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/IndirectInvokeMethodNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/IndirectInvokeMethodNode.java @@ -43,8 +43,8 @@ public abstract Object execute( Object self, Object[] arguments, CallArgumentInfo[] schema, - InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, - InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, + InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, + InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, BaseNode.TailStatus isTail, int thisArgumentPosition); @@ -56,8 +56,8 @@ Object doFunctionalDispatch( Object self, Object[] arguments, CallArgumentInfo[] schema, - InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, - InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, + InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, + InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, BaseNode.TailStatus isTail, int thisArgumentPosition, @CachedLibrary(limit = "10") TypesLibrary dispatch, @@ -70,8 +70,8 @@ Object doFunctionalDispatch( state, arguments, schema, - defaultsExecutionMode, - argumentsExecutionMode, + defaultsExecutionEnvironment, + argumentsExecutionEnvironment, isTail); } @@ -83,8 +83,8 @@ Object doDataflowError( DataflowError self, Object[] arguments, CallArgumentInfo[] schema, - InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, - InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, + InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, + InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, BaseNode.TailStatus isTail, int thisArgumentPosition, @Cached MethodResolverNode methodResolverNode, @@ -101,8 +101,8 @@ Object doDataflowError( state, arguments, schema, - defaultsExecutionMode, - argumentsExecutionMode, + defaultsExecutionEnvironment, + argumentsExecutionEnvironment, isTail); } } @@ -115,8 +115,8 @@ Object doWarning( WithWarnings self, Object[] arguments, CallArgumentInfo[] schema, - InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, - InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, + InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, + InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, BaseNode.TailStatus isTail, int thisArgumentPosition, @Cached IndirectInvokeMethodNode childDispatch) { @@ -130,8 +130,8 @@ Object doWarning( self.getValue(), arguments, schema, - defaultsExecutionMode, - argumentsExecutionMode, + defaultsExecutionEnvironment, + argumentsExecutionEnvironment, isTail, thisArgumentPosition); return WithWarnings.prependTo(result, warnings); @@ -145,8 +145,8 @@ Object doPanicSentinel( PanicSentinel self, Object[] arguments, CallArgumentInfo[] schema, - InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, - InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, + InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, + InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, BaseNode.TailStatus isTail, int thisArgumentPosition) { throw self; @@ -166,8 +166,8 @@ Object doPolyglot( Object self, Object[] arguments, CallArgumentInfo[] schema, - InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, - InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, + InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, + InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, BaseNode.TailStatus isTail, int thisArgumentPosition, @CachedLibrary(limit = "10") TypesLibrary methods, @@ -200,8 +200,8 @@ Object doConvertText( Object self, Object[] arguments, CallArgumentInfo[] schema, - InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, - InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, + InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, + InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, BaseNode.TailStatus isTail, int thisArgumentPosition, @CachedLibrary(limit = "10") TypesLibrary methods, @@ -221,8 +221,8 @@ Object doConvertText( state, arguments, schema, - defaultsExecutionMode, - argumentsExecutionMode, + defaultsExecutionEnvironment, + argumentsExecutionEnvironment, isTail); } catch (UnsupportedMessageException e) { throw new IllegalStateException("Impossible, self is guaranteed to be a string."); @@ -243,8 +243,8 @@ Object doFallback( Object self, Object[] arguments, CallArgumentInfo[] schema, - InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, - InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, + InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, + InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, BaseNode.TailStatus isTail, int thisArgumentPosition, @Cached MethodResolverNode methodResolverNode, @@ -259,8 +259,8 @@ Object doFallback( state, arguments, schema, - defaultsExecutionMode, - argumentsExecutionMode, + defaultsExecutionEnvironment, + argumentsExecutionEnvironment, isTail); } } diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/InteropApplicationNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/InteropApplicationNode.java index 0c3b7d537dfe..f2dd3dfc3b4a 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/InteropApplicationNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/InteropApplicationNode.java @@ -54,8 +54,8 @@ InvokeFunctionNode buildSorter(int length) { CallArgumentInfo[] args = buildSchema(length); return InvokeFunctionNode.build( args, - InvokeCallableNode.DefaultsExecutionMode.EXECUTE, - InvokeCallableNode.ArgumentsExecutionMode.PRE_EXECUTED); + InvokeCallableNode.DefaultsExecutionEnvironment.EXECUTE, + InvokeCallableNode.ArgumentsExecutionEnvironment.PRE_EXECUTED); } EnsoContext getContext() { @@ -96,8 +96,8 @@ Object callUncached( state, args, buildSchema(arguments.length), - InvokeCallableNode.DefaultsExecutionMode.EXECUTE, - InvokeCallableNode.ArgumentsExecutionMode.PRE_EXECUTED, + InvokeCallableNode.DefaultsExecutionEnvironment.EXECUTE, + InvokeCallableNode.ArgumentsExecutionEnvironment.PRE_EXECUTED, BaseNode.TailStatus.NOT_TAIL); } } diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/InteropConversionCallNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/InteropConversionCallNode.java index 194b5a80ee5b..4641a1d502bd 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/InteropConversionCallNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/InteropConversionCallNode.java @@ -10,8 +10,8 @@ import com.oracle.truffle.api.nodes.NodeInfo; import org.enso.interpreter.Constants; import org.enso.interpreter.node.BaseNode.TailStatus; -import org.enso.interpreter.node.callable.InvokeCallableNode.ArgumentsExecutionMode; -import org.enso.interpreter.node.callable.InvokeCallableNode.DefaultsExecutionMode; +import org.enso.interpreter.node.callable.InvokeCallableNode.ArgumentsExecutionEnvironment; +import org.enso.interpreter.node.callable.InvokeCallableNode.DefaultsExecutionEnvironment; import org.enso.interpreter.node.expression.builtin.interop.syntax.HostValueToEnsoNode; import org.enso.interpreter.runtime.EnsoContext; import org.enso.interpreter.runtime.callable.UnresolvedConversion; @@ -43,7 +43,7 @@ CallArgumentInfo[] buildSchema(int length) { InvokeConversionNode buildInvoker(int length) { CallArgumentInfo[] args = buildSchema(length); return InvokeConversionNode.build( - args, DefaultsExecutionMode.EXECUTE, ArgumentsExecutionMode.PRE_EXECUTED, 1); + args, DefaultsExecutionEnvironment.EXECUTE, ArgumentsExecutionEnvironment.PRE_EXECUTED, 1); } EnsoContext getContext() { @@ -91,8 +91,8 @@ Object callUncached( args[1], args, buildSchema(arguments.length), - DefaultsExecutionMode.EXECUTE, - ArgumentsExecutionMode.PRE_EXECUTED, + DefaultsExecutionEnvironment.EXECUTE, + ArgumentsExecutionEnvironment.PRE_EXECUTED, TailStatus.NOT_TAIL, 1); } diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/InteropMethodCallNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/InteropMethodCallNode.java index 59912eee70f2..90560876ad07 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/InteropMethodCallNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/InteropMethodCallNode.java @@ -9,8 +9,8 @@ import com.oracle.truffle.api.nodes.NodeInfo; import org.enso.interpreter.Constants; import org.enso.interpreter.node.BaseNode.TailStatus; -import org.enso.interpreter.node.callable.InvokeCallableNode.ArgumentsExecutionMode; -import org.enso.interpreter.node.callable.InvokeCallableNode.DefaultsExecutionMode; +import org.enso.interpreter.node.callable.InvokeCallableNode.ArgumentsExecutionEnvironment; +import org.enso.interpreter.node.callable.InvokeCallableNode.DefaultsExecutionEnvironment; import org.enso.interpreter.node.expression.builtin.interop.syntax.HostValueToEnsoNode; import org.enso.interpreter.runtime.EnsoContext; import org.enso.interpreter.runtime.callable.UnresolvedSymbol; @@ -56,8 +56,8 @@ InvokeMethodNode buildSorter(int length) { CallArgumentInfo[] args = buildSchema(length); return InvokeMethodNode.build( args, - InvokeCallableNode.DefaultsExecutionMode.EXECUTE, - InvokeCallableNode.ArgumentsExecutionMode.PRE_EXECUTED, + InvokeCallableNode.DefaultsExecutionEnvironment.EXECUTE, + InvokeCallableNode.ArgumentsExecutionEnvironment.PRE_EXECUTED, 0); } @@ -104,8 +104,8 @@ Object callUncached( args[0], args, buildSchema(arguments.length), - DefaultsExecutionMode.EXECUTE, - ArgumentsExecutionMode.PRE_EXECUTED, + DefaultsExecutionEnvironment.EXECUTE, + ArgumentsExecutionEnvironment.PRE_EXECUTED, TailStatus.NOT_TAIL, 0); } diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/InvokeCallableNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/InvokeCallableNode.java index 3720b29fc198..dbe25e49a270 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/InvokeCallableNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/InvokeCallableNode.java @@ -40,7 +40,7 @@ public abstract class InvokeCallableNode extends BaseNode { /** Denotes the mode of defaulted arguments treatment for a function invocation. */ - public enum DefaultsExecutionMode { + public enum DefaultsExecutionEnvironment { /** Defaulted arguments should be ignored for this application position. */ IGNORE, /** Defaulted arguments should be executed normally for this application position. */ @@ -66,7 +66,7 @@ public boolean isExecute() { } /** Denotes the mode of arguments execution for a function invocation */ - public enum ArgumentsExecutionMode { + public enum ArgumentsExecutionEnvironment { /** Arguments are pre-executed for this call. */ PRE_EXECUTED, /** Arguments are passed as thunks and should be executed before calling the function. */ @@ -94,12 +94,12 @@ public boolean shouldExecute() { private final int thisArgumentPosition; private final int thatArgumentPosition; - private final ArgumentsExecutionMode argumentsExecutionMode; + private final ArgumentsExecutionEnvironment argumentsExecutionEnvironment; InvokeCallableNode( CallArgumentInfo[] schema, - DefaultsExecutionMode defaultsExecutionMode, - ArgumentsExecutionMode argumentsExecutionMode) { + DefaultsExecutionEnvironment defaultsExecutionEnvironment, + ArgumentsExecutionEnvironment argumentsExecutionEnvironment) { Integer thisArg = thisArgumentPosition(schema); this.canApplyThis = thisArg != null; this.thisArgumentPosition = thisArg == null ? -1 : thisArg; @@ -108,16 +108,16 @@ public boolean shouldExecute() { this.canApplyThat = thatArg != null; this.thatArgumentPosition = thatArg == null ? -1 : thatArg; - this.argumentsExecutionMode = argumentsExecutionMode; + this.argumentsExecutionEnvironment = argumentsExecutionEnvironment; this.invokeFunctionNode = - InvokeFunctionNode.build(schema, defaultsExecutionMode, argumentsExecutionMode); + InvokeFunctionNode.build(schema, defaultsExecutionEnvironment, argumentsExecutionEnvironment); this.invokeMethodNode = InvokeMethodNode.build( - schema, defaultsExecutionMode, argumentsExecutionMode, thisArgumentPosition); + schema, defaultsExecutionEnvironment, argumentsExecutionEnvironment, thisArgumentPosition); this.invokeConversionNode = InvokeConversionNode.build( - schema, defaultsExecutionMode, argumentsExecutionMode, thatArgumentPosition); + schema, defaultsExecutionEnvironment, argumentsExecutionEnvironment, thatArgumentPosition); } public static Integer thisArgumentPosition(CallArgumentInfo[] schema) { @@ -150,14 +150,14 @@ public static Integer thatArgumentPosition(CallArgumentInfo[] schema, int thisAr * Creates a new instance of this node. * * @param schema a description of the arguments being applied to the callable - * @param defaultsExecutionMode the defaulted arguments handling mode for this call - * @param argumentsExecutionMode the arguments execution mode for this call + * @param defaultsExecutionEnvironment the defaulted arguments handling mode for this call + * @param argumentsExecutionEnvironment the arguments execution mode for this call */ public static InvokeCallableNode build( CallArgumentInfo[] schema, - DefaultsExecutionMode defaultsExecutionMode, - ArgumentsExecutionMode argumentsExecutionMode) { - return InvokeCallableNodeGen.create(schema, defaultsExecutionMode, argumentsExecutionMode); + DefaultsExecutionEnvironment defaultsExecutionEnvironment, + ArgumentsExecutionEnvironment argumentsExecutionEnvironment) { + return InvokeCallableNodeGen.create(schema, defaultsExecutionEnvironment, argumentsExecutionEnvironment); } @Specialization @@ -190,7 +190,7 @@ public Object invokeConversion( if (canApplyThis && canApplyThat) { Object selfArgument = arguments[thisArgumentPosition]; Object thatArgument = arguments[thatArgumentPosition]; - if (argumentsExecutionMode.shouldExecute()) { + if (argumentsExecutionEnvironment.shouldExecute()) { if (thisExecutor == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); Lock lock = getLock(); @@ -235,7 +235,7 @@ public Object invokeDynamicSymbol( UnresolvedSymbol symbol, VirtualFrame callerFrame, State state, Object[] arguments) { if (canApplyThis) { Object selfArgument = arguments[thisArgumentPosition]; - if (argumentsExecutionMode.shouldExecute()) { + if (argumentsExecutionEnvironment.shouldExecute()) { if (thisExecutor == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); Lock lock = getLock(); @@ -276,8 +276,8 @@ public Object invokeWarnings( insert( build( invokeFunctionNode.getSchema(), - invokeFunctionNode.getDefaultsExecutionMode(), - invokeFunctionNode.getArgumentsExecutionMode())); + invokeFunctionNode.getDefaultsExecutionEnvironment(), + invokeFunctionNode.getArgumentsExecutionEnvironment())); childDispatch.setTailStatus(getTailStatus()); childDispatch.setId(invokeFunctionNode.getId()); notifyInserted(childDispatch); diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/InvokeConversionNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/InvokeConversionNode.java index 6af3ce73ee8d..51cd25b68c90 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/InvokeConversionNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/InvokeConversionNode.java @@ -34,26 +34,26 @@ public abstract class InvokeConversionNode extends BaseNode { * Creates a new node for method invocation. * * @param schema a description of the arguments being applied to the callable - * @param defaultsExecutionMode the defaulted arguments handling mode for this call - * @param argumentsExecutionMode the arguments execution mode for this call + * @param defaultsExecutionEnvironment the defaulted arguments handling mode for this call + * @param argumentsExecutionEnvironment the arguments execution mode for this call * @return a new invoke method node */ public static InvokeConversionNode build( CallArgumentInfo[] schema, - InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, - InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, + InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, + InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, int thatArgumentPosition) { return InvokeConversionNodeGen.create( - schema, defaultsExecutionMode, argumentsExecutionMode, thatArgumentPosition); + schema, defaultsExecutionEnvironment, argumentsExecutionEnvironment, thatArgumentPosition); } InvokeConversionNode( CallArgumentInfo[] schema, - InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, - InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, + InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, + InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, int thatArgumentPosition) { this.invokeFunctionNode = - InvokeFunctionNode.build(schema, defaultsExecutionMode, argumentsExecutionMode); + InvokeFunctionNode.build(schema, defaultsExecutionEnvironment, argumentsExecutionEnvironment); this.thatArgumentPosition = thatArgumentPosition; } @@ -160,8 +160,8 @@ Object doWarning( insert( build( invokeFunctionNode.getSchema(), - invokeFunctionNode.getDefaultsExecutionMode(), - invokeFunctionNode.getArgumentsExecutionMode(), + invokeFunctionNode.getDefaultsExecutionEnvironment(), + invokeFunctionNode.getArgumentsExecutionEnvironment(), thatArgumentPosition)); childDispatch.setTailStatus(getTailStatus()); childDispatch.setId(invokeFunctionNode.getId()); diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/InvokeMethodNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/InvokeMethodNode.java index 0ccd30812095..5233b2b28a60 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/InvokeMethodNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/InvokeMethodNode.java @@ -62,26 +62,26 @@ public abstract class InvokeMethodNode extends BaseNode { * Creates a new node for method invocation. * * @param schema a description of the arguments being applied to the callable - * @param defaultsExecutionMode the defaulted arguments handling mode for this call - * @param argumentsExecutionMode the arguments execution mode for this call + * @param defaultsExecutionEnvironment the defaulted arguments handling mode for this call + * @param argumentsExecutionEnvironment the arguments execution mode for this call * @return a new invoke method node */ public static InvokeMethodNode build( CallArgumentInfo[] schema, - InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, - InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, + InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, + InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, int thisArgumentPosition) { return InvokeMethodNodeGen.create( - schema, defaultsExecutionMode, argumentsExecutionMode, thisArgumentPosition); + schema, defaultsExecutionEnvironment, argumentsExecutionEnvironment, thisArgumentPosition); } InvokeMethodNode( CallArgumentInfo[] schema, - InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, - InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, + InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, + InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, int thisArgumentPosition) { this.invokeFunctionNode = - InvokeFunctionNode.build(schema, defaultsExecutionMode, argumentsExecutionMode); + InvokeFunctionNode.build(schema, defaultsExecutionEnvironment, argumentsExecutionEnvironment); this.argumentCount = schema.length; this.thisArgumentPosition = thisArgumentPosition; } @@ -201,8 +201,8 @@ public InvokeFunctionNode buildInvokeFunctionWithSelf() { schema[0] = new CallArgumentInfo(); return InvokeFunctionNode.build( schema, - invokeFunctionNode.getDefaultsExecutionMode(), - invokeFunctionNode.getArgumentsExecutionMode()); + invokeFunctionNode.getDefaultsExecutionEnvironment(), + invokeFunctionNode.getArgumentsExecutionEnvironment()); } @Specialization( @@ -260,8 +260,8 @@ Object doWarning( insert( build( invokeFunctionNode.getSchema(), - invokeFunctionNode.getDefaultsExecutionMode(), - invokeFunctionNode.getArgumentsExecutionMode(), + invokeFunctionNode.getDefaultsExecutionEnvironment(), + invokeFunctionNode.getArgumentsExecutionEnvironment(), thisArgumentPosition)); childDispatch.setTailStatus(getTailStatus()); childDispatch.setId(invokeFunctionNode.getId()); diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/argument/ArgumentSorterNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/argument/ArgumentSorterNode.java index cbad564b3a77..ca42b0109387 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/argument/ArgumentSorterNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/argument/ArgumentSorterNode.java @@ -23,15 +23,15 @@ public class ArgumentSorterNode extends BaseNode { private final FunctionSchema postApplicationSchema; private final ArgumentMapping mapping; private @Children ThunkExecutorNode[] executors; - private final InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode; + private final InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment; private ArgumentSorterNode( FunctionSchema preApplicationSchema, FunctionSchema postApplicationSchema, ArgumentMapping mapping, - InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode) { + InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment) { this.preApplicationSchema = preApplicationSchema; - this.argumentsExecutionMode = argumentsExecutionMode; + this.argumentsExecutionEnvironment = argumentsExecutionEnvironment; this.mapping = mapping; this.postApplicationSchema = postApplicationSchema; } @@ -42,16 +42,16 @@ private ArgumentSorterNode( * @param preApplicationSchema the schema of all functions passed to the {@link #execute(Function, * Object, Object[])} method of this node. * @param mapping the argument mapping generated for current application site. - * @param argumentsExecutionMode lazy arguments handling mode for this node. + * @param argumentsExecutionEnvironment lazy arguments handling mode for this node. * @return a sorter node for the arguments in {@code schema} being passed to a function with the * {@code preApplicationSchema}. */ public static ArgumentSorterNode build( FunctionSchema preApplicationSchema, ArgumentMapping mapping, - InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode) { + InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment) { return new ArgumentSorterNode( - preApplicationSchema, mapping.getPostApplicationSchema(), mapping, argumentsExecutionMode); + preApplicationSchema, mapping.getPostApplicationSchema(), mapping, argumentsExecutionEnvironment); } private void initArgumentExecutors() { @@ -95,7 +95,7 @@ private void executeArguments(Object[] arguments, State state) { * @return the provided {@code arguments} in the order expected by the cached {@link Function} */ public MappedArguments execute(Function function, State state, Object[] arguments) { - if (argumentsExecutionMode.shouldExecute()) { + if (argumentsExecutionEnvironment.shouldExecute()) { executeArguments(arguments, state); } Object[] mappedAppliedArguments = diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/argument/IndirectArgumentSorterNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/argument/IndirectArgumentSorterNode.java index 5f0e1ee2ebc3..3343aede5292 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/argument/IndirectArgumentSorterNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/argument/IndirectArgumentSorterNode.java @@ -52,7 +52,7 @@ private void executeArguments( * * @param preApplicationSchema the function schema before applying the arguments * @param mapping the pre-computed argument mapping for the function - * @param argumentsExecutionMode whether arguments should be executed or not + * @param argumentsExecutionEnvironment whether arguments should be executed or not * @param function the function this node is reordering arguments for * @param state the state to pass to the function * @param arguments the arguments to reorder @@ -61,7 +61,7 @@ private void executeArguments( public abstract ArgumentSorterNode.MappedArguments execute( FunctionSchema preApplicationSchema, ArgumentMapping mapping, - InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, + InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, Function function, State state, Object[] arguments); @@ -70,13 +70,13 @@ public abstract ArgumentSorterNode.MappedArguments execute( ArgumentSorterNode.MappedArguments doExecute( FunctionSchema preApplicationSchema, ArgumentMapping mapping, - InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, + InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, Function function, State state, Object[] arguments, @Cached ThunkExecutorNode thunkExecutorNode) { FunctionSchema postApplicationSchema = mapping.getPostApplicationSchema(); - if (argumentsExecutionMode.shouldExecute()) { + if (argumentsExecutionEnvironment.shouldExecute()) { executeArguments(mapping, arguments, state, thunkExecutorNode); } Object[] mappedAppliedArguments = diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/dispatch/CurryNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/dispatch/CurryNode.java index 4a2b022bb5ee..3651fa851031 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/dispatch/CurryNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/dispatch/CurryNode.java @@ -27,19 +27,19 @@ public class CurryNode extends BaseNode { private @Child ExecuteCallNode directCall; private @Child CallOptimiserNode loopingCall; private final BranchProfile keepExecutingProfile = BranchProfile.create(); - private final InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode; + private final InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment; private CurryNode( FunctionSchema postApplicationSchema, - InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, - InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, + InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, + InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, BaseNode.TailStatus isTail) { setTailStatus(isTail); - this.defaultsExecutionMode = defaultsExecutionMode; + this.defaultsExecutionEnvironment = defaultsExecutionEnvironment; this.postApplicationSchema = postApplicationSchema; - appliesFully = postApplicationSchema.isFullyApplied(defaultsExecutionMode); + appliesFully = postApplicationSchema.isFullyApplied(defaultsExecutionEnvironment); initializeCallNodes(); - initializeOversaturatedCallNode(argumentsExecutionMode); + initializeOversaturatedCallNode(argumentsExecutionEnvironment); } /** @@ -47,20 +47,20 @@ private CurryNode( * * @param argumentMapping the argument mapping for moving from the original schema to the argument * schema expected by the function. - * @param defaultsExecutionMode the mode of handling defaulted arguments for this call. - * @param argumentsExecutionMode the mode of executing lazy arguments for this call. + * @param defaultsExecutionEnvironment the mode of handling defaulted arguments for this call. + * @param argumentsExecutionEnvironment the mode of executing lazy arguments for this call. * @param tailStatus is this a tail call position? * @return an instance of this node. */ public static CurryNode build( CallArgumentInfo.ArgumentMapping argumentMapping, - InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, - InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, + InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, + InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, BaseNode.TailStatus tailStatus) { return new CurryNode( argumentMapping.getPostApplicationSchema(), - defaultsExecutionMode, - argumentsExecutionMode, + defaultsExecutionEnvironment, + argumentsExecutionEnvironment, tailStatus); } @@ -73,13 +73,13 @@ private void initializeCallNodes() { } private void initializeOversaturatedCallNode( - InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode) { + InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment) { if (postApplicationSchema.hasOversaturatedArgs()) { oversaturatedCallableNode = InvokeCallableNodeGen.create( postApplicationSchema.getOversaturatedArguments(), - defaultsExecutionMode, - argumentsExecutionMode); + defaultsExecutionEnvironment, + argumentsExecutionEnvironment); oversaturatedCallableNode.setTailStatus(getTailStatus()); } } @@ -106,7 +106,7 @@ public Object execute( if (appliesFully) { if (!postApplicationSchema.hasOversaturatedArgs()) { var value = doCall(function, callerInfo, state, arguments); - if (defaultsExecutionMode.isExecute() + if (defaultsExecutionEnvironment.isExecute() && (value instanceof Function || (value instanceof AtomConstructor cons && cons.getConstructorFunction().getSchema().isFullyApplied()))) { keepExecutingProfile.enter(); @@ -120,8 +120,8 @@ public Object execute( insert( InvokeCallableNode.build( new CallArgumentInfo[0], - InvokeCallableNode.DefaultsExecutionMode.EXECUTE, - InvokeCallableNode.ArgumentsExecutionMode.EXECUTE)); + InvokeCallableNode.DefaultsExecutionEnvironment.EXECUTE, + InvokeCallableNode.ArgumentsExecutionEnvironment.EXECUTE)); } } finally { lock.unlock(); diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/dispatch/IndirectCurryNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/dispatch/IndirectCurryNode.java index 839e92e50ce7..790b9a750d66 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/dispatch/IndirectCurryNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/dispatch/IndirectCurryNode.java @@ -38,8 +38,8 @@ public abstract class IndirectCurryNode extends Node { * @param oversaturatedArguments any arguments that should be treated as candidates for an * eta-expanded call. * @param postApplicationSchema function schema after the call. - * @param defaultsExecutionMode should default arguments be used for this call. - * @param argumentsExecutionMode are arguments pre-executed or suspended. + * @param defaultsExecutionEnvironment should default arguments be used for this call. + * @param argumentsExecutionEnvironment are arguments pre-executed or suspended. * @param isTail is the call happening in a tail position. * @return the result of executing the {@code function}. */ @@ -51,8 +51,8 @@ public abstract Object execute( Object[] arguments, Object[] oversaturatedArguments, FunctionSchema postApplicationSchema, - InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, - InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, + InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, + InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, BaseNode.TailStatus isTail); @Specialization @@ -64,18 +64,18 @@ Object doCurry( Object[] arguments, Object[] oversaturatedArguments, FunctionSchema postApplicationSchema, - InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, - InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, + InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, + InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, BaseNode.TailStatus isTail, @Cached ExecuteCallNode directCall, @Cached LoopingCallOptimiserNode loopingCall, @Cached IndirectInvokeCallableNode oversaturatedCallableNode) { - boolean appliesFully = postApplicationSchema.isFullyApplied(defaultsExecutionMode); + boolean appliesFully = postApplicationSchema.isFullyApplied(defaultsExecutionEnvironment); if (appliesFully) { if (!postApplicationSchema.hasOversaturatedArgs()) { var value = doCall(function, callerInfo, state, arguments, isTail, directCall, loopingCall); - if (defaultsExecutionMode.isExecute() + if (defaultsExecutionEnvironment.isExecute() && (value instanceof Function || (value instanceof AtomConstructor cons && cons.getConstructorFunction().getSchema().isFullyApplied()))) { return oversaturatedCallableNode.execute( @@ -84,8 +84,8 @@ Object doCurry( state, new Object[0], new CallArgumentInfo[0], - defaultsExecutionMode, - argumentsExecutionMode, + defaultsExecutionEnvironment, + argumentsExecutionEnvironment, isTail); } else { return value; @@ -99,8 +99,8 @@ Object doCurry( state, oversaturatedArguments, postApplicationSchema.getOversaturatedArguments(), - defaultsExecutionMode, - argumentsExecutionMode, + defaultsExecutionEnvironment, + argumentsExecutionEnvironment, isTail); } } else { diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/dispatch/IndirectInvokeFunctionNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/dispatch/IndirectInvokeFunctionNode.java index d3fb301ac277..198111853a6d 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/dispatch/IndirectInvokeFunctionNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/dispatch/IndirectInvokeFunctionNode.java @@ -33,8 +33,8 @@ public abstract class IndirectInvokeFunctionNode extends Node { * @param state the state to pass to the function * @param arguments the arguments being passed to {@code function} * @param schema the names and ordering of arguments for this call site - * @param defaultsExecutionMode whether defaults are suspended for this call. - * @param argumentsExecutionMode whether arguments are preexecuted for this call. + * @param defaultsExecutionEnvironment whether defaults are suspended for this call. + * @param argumentsExecutionEnvironment whether arguments are preexecuted for this call. * @param isTail is the call happening in a tail position. * @return the result of executing the {@code function} with reordered {@code arguments} */ @@ -44,8 +44,8 @@ public abstract Object execute( Object state, Object[] arguments, CallArgumentInfo[] schema, - InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, - InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, + InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, + InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, BaseNode.TailStatus isTail); @Specialization @@ -55,8 +55,8 @@ Object invokeUncached( State state, Object[] arguments, CallArgumentInfo[] schema, - InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, - InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, + InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, + InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, BaseNode.TailStatus isTail, @Cached IndirectArgumentSorterNode mappingNode, @Cached IndirectCurryNode curryNode, @@ -68,7 +68,7 @@ Object invokeUncached( mappingNode.execute( function.getSchema(), argumentMapping, - argumentsExecutionMode, + argumentsExecutionEnvironment, function, state, arguments); @@ -87,8 +87,8 @@ Object invokeUncached( mappedArguments.getSortedArguments(), mappedArguments.getOversaturatedArguments(), argumentMapping.getPostApplicationSchema(), - defaultsExecutionMode, - argumentsExecutionMode, + defaultsExecutionEnvironment, + argumentsExecutionEnvironment, isTail); } } diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/dispatch/InvokeFunctionNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/dispatch/InvokeFunctionNode.java index 151c32cccbee..5ad679392600 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/dispatch/InvokeFunctionNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/dispatch/InvokeFunctionNode.java @@ -31,34 +31,34 @@ public abstract class InvokeFunctionNode extends BaseNode { private final CallArgumentInfo[] schema; - private final InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode; - private final InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode; + private final InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment; + private final InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment; private @Child CaptureCallerInfoNode captureCallerInfoNode = CaptureCallerInfoNode.build(); private @Child FunctionCallInstrumentationNode functionCallInstrumentationNode = FunctionCallInstrumentationNode.build(); InvokeFunctionNode( CallArgumentInfo[] schema, - InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, - InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode) { + InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, + InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment) { this.schema = schema; - this.defaultsExecutionMode = defaultsExecutionMode; - this.argumentsExecutionMode = argumentsExecutionMode; + this.defaultsExecutionEnvironment = defaultsExecutionEnvironment; + this.argumentsExecutionEnvironment = argumentsExecutionEnvironment; } /** * Creates an instance of this node. * * @param schema information about the call arguments in positional order - * @param defaultsExecutionMode the defaults execution mode for this function invocation - * @param argumentsExecutionMode the arguments execution mode for this function invocation + * @param defaultsExecutionEnvironment the defaults execution mode for this function invocation + * @param argumentsExecutionEnvironment the arguments execution mode for this function invocation * @return an instance of this node. */ public static InvokeFunctionNode build( CallArgumentInfo[] schema, - InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, - InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode) { - return InvokeFunctionNodeGen.create(schema, defaultsExecutionMode, argumentsExecutionMode); + InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, + InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment) { + return InvokeFunctionNodeGen.create(schema, defaultsExecutionEnvironment, argumentsExecutionEnvironment); } EnsoContext getContext() { @@ -76,10 +76,10 @@ Object invokeCached( @Cached("function.getSchema()") FunctionSchema cachedSchema, @Cached("generate(cachedSchema, getSchema())") CallArgumentInfo.ArgumentMapping argumentMapping, - @Cached("build(cachedSchema, argumentMapping, getArgumentsExecutionMode())") + @Cached("build(cachedSchema, argumentMapping, getArgumentsExecutionEnvironment())") ArgumentSorterNode mappingNode, @Cached( - "build(argumentMapping, getDefaultsExecutionMode(), getArgumentsExecutionMode(), getTailStatus())") + "build(argumentMapping, getDefaultsExecutionEnvironment(), getArgumentsExecutionEnvironment(), getTailStatus())") CurryNode curryNode) { ArgumentSorterNode.MappedArguments mappedArguments = mappingNode.execute(function, state, arguments); @@ -123,7 +123,7 @@ Object invokeUncached( mappingNode.execute( function.getSchema(), argumentMapping, - getArgumentsExecutionMode(), + getArgumentsExecutionEnvironment(), function, state, arguments); @@ -145,8 +145,8 @@ Object invokeUncached( mappedArguments.getSortedArguments(), mappedArguments.getOversaturatedArguments(), argumentMapping.getPostApplicationSchema(), - defaultsExecutionMode, - argumentsExecutionMode, + defaultsExecutionEnvironment, + argumentsExecutionEnvironment, getTailStatus()); } @@ -166,12 +166,12 @@ public CallArgumentInfo[] getSchema() { return schema; } - public InvokeCallableNode.DefaultsExecutionMode getDefaultsExecutionMode() { - return this.defaultsExecutionMode; + public InvokeCallableNode.DefaultsExecutionEnvironment getDefaultsExecutionEnvironment() { + return this.defaultsExecutionEnvironment; } - public InvokeCallableNode.ArgumentsExecutionMode getArgumentsExecutionMode() { - return argumentsExecutionMode; + public InvokeCallableNode.ArgumentsExecutionEnvironment getArgumentsExecutionEnvironment() { + return argumentsExecutionEnvironment; } /** @return the source section for this node. */ diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/thunk/ThunkExecutorNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/thunk/ThunkExecutorNode.java index 8552a3b3fe27..62f6238b45b0 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/thunk/ThunkExecutorNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/thunk/ThunkExecutorNode.java @@ -93,8 +93,8 @@ static InvokeFunctionNode buildInvokeFunctionNode(BaseNode.TailStatus tailStatus var node = InvokeFunctionNode.build( new CallArgumentInfo[0], - InvokeCallableNode.DefaultsExecutionMode.EXECUTE, - InvokeCallableNode.ArgumentsExecutionMode.EXECUTE); + InvokeCallableNode.DefaultsExecutionEnvironment.EXECUTE, + InvokeCallableNode.ArgumentsExecutionEnvironment.EXECUTE); node.setTailStatus(tailStatus); return node; } @@ -129,8 +129,8 @@ Object doUncachedFn( state, new Object[0], new CallArgumentInfo[0], - InvokeCallableNode.DefaultsExecutionMode.EXECUTE, - InvokeCallableNode.ArgumentsExecutionMode.EXECUTE, + InvokeCallableNode.DefaultsExecutionEnvironment.EXECUTE, + InvokeCallableNode.ArgumentsExecutionEnvironment.EXECUTE, isTail); } diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/Builtin.java b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/Builtin.java index c4cb8322a085..26725e4f22da 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/Builtin.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/Builtin.java @@ -25,7 +25,7 @@ private AtomConstructor build(EnsoLanguage language, ModuleScope scope, Type typ .mapToObj( i -> new ArgumentDefinition( - i, params.get(i), ArgumentDefinition.ExecutionMode.EXECUTE)) + i, params.get(i), ArgumentDefinition.ExecutionEnvironment.EXECUTE)) .toArray(ArgumentDefinition[]::new)); return res; } diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/error/CatchAnyNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/error/CatchAnyNode.java index 19c24c10bcef..7cd365e90c37 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/error/CatchAnyNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/error/CatchAnyNode.java @@ -18,8 +18,8 @@ public class CatchAnyNode extends Node { this.invokeCallableNode = InvokeCallableNode.build( new CallArgumentInfo[] {new CallArgumentInfo()}, - InvokeCallableNode.DefaultsExecutionMode.EXECUTE, - InvokeCallableNode.ArgumentsExecutionMode.PRE_EXECUTED); + InvokeCallableNode.DefaultsExecutionEnvironment.EXECUTE, + InvokeCallableNode.ArgumentsExecutionEnvironment.PRE_EXECUTED); this.invokeCallableNode.setTailStatus(BaseNode.TailStatus.TAIL_DIRECT); } diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/error/CatchErrorNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/error/CatchErrorNode.java index 608f3b83d636..8869730fe8d9 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/error/CatchErrorNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/error/CatchErrorNode.java @@ -21,8 +21,8 @@ public class CatchErrorNode extends Node { this.invokeCallableNode = InvokeCallableNode.build( new CallArgumentInfo[] {new CallArgumentInfo()}, - InvokeCallableNode.DefaultsExecutionMode.EXECUTE, - InvokeCallableNode.ArgumentsExecutionMode.PRE_EXECUTED); + InvokeCallableNode.DefaultsExecutionEnvironment.EXECUTE, + InvokeCallableNode.ArgumentsExecutionEnvironment.PRE_EXECUTED); this.invokeCallableNode.setTailStatus(BaseNode.TailStatus.TAIL_DIRECT); } diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/error/CatchPanicNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/error/CatchPanicNode.java index ac7a37d8e042..eff3cd4c7cd7 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/error/CatchPanicNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/error/CatchPanicNode.java @@ -37,8 +37,8 @@ public abstract class CatchPanicNode extends Node { this.invokeCallableNode = InvokeCallableNode.build( new CallArgumentInfo[] {new CallArgumentInfo()}, - InvokeCallableNode.DefaultsExecutionMode.EXECUTE, - InvokeCallableNode.ArgumentsExecutionMode.PRE_EXECUTED); + InvokeCallableNode.DefaultsExecutionEnvironment.EXECUTE, + InvokeCallableNode.ArgumentsExecutionEnvironment.PRE_EXECUTED); this.invokeCallableNode.setTailStatus(BaseNode.TailStatus.TAIL_DIRECT); } diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/function/ApplicationOperator.java b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/function/ApplicationOperator.java index ad5d39967321..be12ce4b7ddd 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/function/ApplicationOperator.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/function/ApplicationOperator.java @@ -20,8 +20,8 @@ public class ApplicationOperator extends Node { invokeCallableNode = InvokeCallableNode.build( new CallArgumentInfo[] {new CallArgumentInfo()}, - InvokeCallableNode.DefaultsExecutionMode.EXECUTE, - InvokeCallableNode.ArgumentsExecutionMode.EXECUTE); + InvokeCallableNode.DefaultsExecutionEnvironment.EXECUTE, + InvokeCallableNode.ArgumentsExecutionEnvironment.EXECUTE); invokeCallableNode.setTailStatus(BaseNode.TailStatus.TAIL_DIRECT); } diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/io/PrintErrNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/io/PrintErrNode.java index cc69fc53e87a..1e963cf4daed 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/io/PrintErrNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/io/PrintErrNode.java @@ -73,8 +73,8 @@ boolean isText(Object o) { InvokeCallableNode buildInvokeCallableNode() { return InvokeCallableNode.build( new CallArgumentInfo[] {new CallArgumentInfo()}, - InvokeCallableNode.DefaultsExecutionMode.EXECUTE, - InvokeCallableNode.ArgumentsExecutionMode.PRE_EXECUTED); + InvokeCallableNode.DefaultsExecutionEnvironment.EXECUTE, + InvokeCallableNode.ArgumentsExecutionEnvironment.PRE_EXECUTED); } UnresolvedSymbol buildSymbol() { diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/io/PrintlnNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/io/PrintlnNode.java index f2f0eb2b798c..5a8b69df142d 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/io/PrintlnNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/io/PrintlnNode.java @@ -28,8 +28,8 @@ public abstract class PrintlnNode extends Node { private @Child InvokeCallableNode invokeCallableNode = InvokeCallableNode.build( new CallArgumentInfo[] {new CallArgumentInfo()}, - InvokeCallableNode.DefaultsExecutionMode.EXECUTE, - InvokeCallableNode.ArgumentsExecutionMode.PRE_EXECUTED); + InvokeCallableNode.DefaultsExecutionEnvironment.EXECUTE, + InvokeCallableNode.ArgumentsExecutionEnvironment.PRE_EXECUTED); abstract Object execute(VirtualFrame frame, State state, @AcceptsError Object message); @@ -79,8 +79,8 @@ UnresolvedSymbol buildSymbol() { InvokeCallableNode buildInvokeCallableNode() { return InvokeCallableNode.build( new CallArgumentInfo[] {new CallArgumentInfo()}, - InvokeCallableNode.DefaultsExecutionMode.EXECUTE, - InvokeCallableNode.ArgumentsExecutionMode.PRE_EXECUTED); + InvokeCallableNode.DefaultsExecutionEnvironment.EXECUTE, + InvokeCallableNode.ArgumentsExecutionEnvironment.PRE_EXECUTED); } static PrintlnNode build() { diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/meta/AtomWithAHoleNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/meta/AtomWithAHoleNode.java index 86332206692c..d8fba28353da 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/meta/AtomWithAHoleNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/meta/AtomWithAHoleNode.java @@ -42,8 +42,8 @@ static AtomWithAHoleNode build() { static InvokeCallableNode callWithHole() { return InvokeCallableNode.build( new CallArgumentInfo[] {new CallArgumentInfo()}, - InvokeCallableNode.DefaultsExecutionMode.EXECUTE, - InvokeCallableNode.ArgumentsExecutionMode.PRE_EXECUTED); + InvokeCallableNode.DefaultsExecutionEnvironment.EXECUTE, + InvokeCallableNode.ArgumentsExecutionEnvironment.PRE_EXECUTED); } @Specialization @@ -123,8 +123,8 @@ static final class SwapAtomFieldNode extends RootNode { private SwapAtomFieldNode() { super(null); this.schema = new FunctionSchema(FunctionSchema.CallerFrameAccess.NONE, new ArgumentDefinition[]{ - new ArgumentDefinition(0, "lazy", ArgumentDefinition.ExecutionMode.EXECUTE), - new ArgumentDefinition(1, "value", ArgumentDefinition.ExecutionMode.EXECUTE) + new ArgumentDefinition(0, "lazy", ArgumentDefinition.ExecutionEnvironment.EXECUTE), + new ArgumentDefinition(1, "value", ArgumentDefinition.ExecutionEnvironment.EXECUTE) }, new boolean[]{ true, false }, new CallArgumentInfo[0], new Annotation[0]); diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/meta/EqualsAtomNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/meta/EqualsAtomNode.java index e4ab96f17cb3..1e567f6f75ed 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/meta/EqualsAtomNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/meta/EqualsAtomNode.java @@ -11,8 +11,8 @@ import com.oracle.truffle.api.nodes.Node; import com.oracle.truffle.api.profiles.ConditionProfile; import java.util.Arrays; -import org.enso.interpreter.node.callable.InvokeCallableNode.ArgumentsExecutionMode; -import org.enso.interpreter.node.callable.InvokeCallableNode.DefaultsExecutionMode; +import org.enso.interpreter.node.callable.InvokeCallableNode.ArgumentsExecutionEnvironment; +import org.enso.interpreter.node.callable.InvokeCallableNode.DefaultsExecutionEnvironment; import org.enso.interpreter.node.callable.dispatch.InvokeFunctionNode; import org.enso.interpreter.node.expression.builtin.ordering.CustomComparatorNode; import org.enso.interpreter.runtime.EnsoContext; @@ -136,6 +136,6 @@ static InvokeFunctionNode invokeCompareNode(Function compareFn) { argsInfo[i] = new CallArgumentInfo(argDef.getName()); } return InvokeFunctionNode.build( - argsInfo, DefaultsExecutionMode.EXECUTE, ArgumentsExecutionMode.EXECUTE); + argsInfo, DefaultsExecutionEnvironment.EXECUTE, ArgumentsExecutionEnvironment.EXECUTE); } } diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/ordering/CustomComparatorNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/ordering/CustomComparatorNode.java index dc31e8b9f741..568fa1dcaa29 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/ordering/CustomComparatorNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/ordering/CustomComparatorNode.java @@ -4,8 +4,8 @@ import com.oracle.truffle.api.dsl.GenerateUncached; import com.oracle.truffle.api.dsl.Specialization; import com.oracle.truffle.api.nodes.Node; -import org.enso.interpreter.node.callable.InvokeCallableNode.ArgumentsExecutionMode; -import org.enso.interpreter.node.callable.InvokeCallableNode.DefaultsExecutionMode; +import org.enso.interpreter.node.callable.InvokeCallableNode.ArgumentsExecutionEnvironment; +import org.enso.interpreter.node.callable.InvokeCallableNode.DefaultsExecutionEnvironment; import org.enso.interpreter.node.callable.InvokeConversionNode; import org.enso.interpreter.runtime.EnsoContext; import org.enso.interpreter.runtime.callable.UnresolvedConversion; @@ -59,6 +59,6 @@ static InvokeConversionNode buildConvertionNode() { argSchema[0] = new CallArgumentInfo(); argSchema[1] = new CallArgumentInfo(); - return InvokeConversionNode.build(argSchema, DefaultsExecutionMode.EXECUTE, ArgumentsExecutionMode.EXECUTE, 1); + return InvokeConversionNode.build(argSchema, DefaultsExecutionEnvironment.EXECUTE, ArgumentsExecutionEnvironment.EXECUTE, 1); } } diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/ordering/HashCallbackNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/ordering/HashCallbackNode.java index ad5f104b8009..d3349b6c47a2 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/ordering/HashCallbackNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/ordering/HashCallbackNode.java @@ -8,8 +8,8 @@ import com.oracle.truffle.api.interop.UnsupportedMessageException; import com.oracle.truffle.api.library.CachedLibrary; import com.oracle.truffle.api.nodes.Node; -import org.enso.interpreter.node.callable.InvokeCallableNode.ArgumentsExecutionMode; -import org.enso.interpreter.node.callable.InvokeCallableNode.DefaultsExecutionMode; +import org.enso.interpreter.node.callable.InvokeCallableNode.ArgumentsExecutionEnvironment; +import org.enso.interpreter.node.callable.InvokeCallableNode.DefaultsExecutionEnvironment; import org.enso.interpreter.node.callable.dispatch.InvokeFunctionNode; import org.enso.interpreter.runtime.EnsoContext; import org.enso.interpreter.runtime.callable.argument.CallArgumentInfo; @@ -68,8 +68,8 @@ long hashCallbackCached( static InvokeFunctionNode buildInvokeNodeWithAtomArgument() { return InvokeFunctionNode.build( new CallArgumentInfo[] {new CallArgumentInfo("self"), new CallArgumentInfo("atom")}, - DefaultsExecutionMode.EXECUTE, - ArgumentsExecutionMode.EXECUTE); + DefaultsExecutionEnvironment.EXECUTE, + ArgumentsExecutionEnvironment.EXECUTE); } @TruffleBoundary diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/resource/BracketNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/resource/BracketNode.java index a6e48e4ba3b2..2ee52c165a99 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/resource/BracketNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/resource/BracketNode.java @@ -36,14 +36,14 @@ public abstract class BracketNode extends Node { private @Child InvokeCallableNode invokeDestructorNode = InvokeCallableNode.build( new CallArgumentInfo[] {new CallArgumentInfo()}, - InvokeCallableNode.DefaultsExecutionMode.EXECUTE, - InvokeCallableNode.ArgumentsExecutionMode.PRE_EXECUTED); + InvokeCallableNode.DefaultsExecutionEnvironment.EXECUTE, + InvokeCallableNode.ArgumentsExecutionEnvironment.PRE_EXECUTED); private @Child InvokeCallableNode invokeActionNode = InvokeCallableNode.build( new CallArgumentInfo[] {new CallArgumentInfo()}, - InvokeCallableNode.DefaultsExecutionMode.EXECUTE, - InvokeCallableNode.ArgumentsExecutionMode.PRE_EXECUTED); + InvokeCallableNode.DefaultsExecutionEnvironment.EXECUTE, + InvokeCallableNode.ArgumentsExecutionEnvironment.PRE_EXECUTED); static BracketNode build() { return BracketNodeGen.create(); diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/resource/WithNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/resource/WithNode.java index 3753ea25bf09..ce9f92a32eea 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/resource/WithNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/resource/WithNode.java @@ -21,8 +21,8 @@ public abstract class WithNode extends Node { private @Child InvokeCallableNode invokeCallableNode = InvokeCallableNode.build( new CallArgumentInfo[] {new CallArgumentInfo()}, - InvokeCallableNode.DefaultsExecutionMode.EXECUTE, - InvokeCallableNode.ArgumentsExecutionMode.PRE_EXECUTED); + InvokeCallableNode.DefaultsExecutionEnvironment.EXECUTE, + InvokeCallableNode.ArgumentsExecutionEnvironment.PRE_EXECUTED); static WithNode build() { return WithNodeGen.create(); diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/runtime/NoInlineWithArgNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/runtime/NoInlineWithArgNode.java index f7d0467fff72..e4789db37ff0 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/runtime/NoInlineWithArgNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/runtime/NoInlineWithArgNode.java @@ -23,8 +23,8 @@ public class NoInlineWithArgNode extends Node { invokeCallableNode = InvokeCallableNode.build( new CallArgumentInfo[] {new CallArgumentInfo()}, - InvokeCallableNode.DefaultsExecutionMode.EXECUTE, - InvokeCallableNode.ArgumentsExecutionMode.EXECUTE); + InvokeCallableNode.DefaultsExecutionEnvironment.EXECUTE, + InvokeCallableNode.ArgumentsExecutionEnvironment.EXECUTE); invokeCallableNode.setTailStatus(TailStatus.NOT_TAIL); } diff --git a/engine/runtime/src/main/java/org/enso/interpreter/runtime/callable/argument/ArgumentDefinition.java b/engine/runtime/src/main/java/org/enso/interpreter/runtime/callable/argument/ArgumentDefinition.java index 356d0708c603..02ea9f349c27 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/runtime/callable/argument/ArgumentDefinition.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/runtime/callable/argument/ArgumentDefinition.java @@ -7,7 +7,7 @@ public final class ArgumentDefinition { /** Represents the mode of passing this argument to the function. */ - public enum ExecutionMode { + public enum ExecutionEnvironment { /** Argument should be passed fully executed. */ EXECUTE, /** Argument should be passed suspended, as a thunk. */ @@ -33,10 +33,10 @@ public boolean isSuspended() { * * @param position the position of the argument at the definition site * @param name the name of the argument - * @param executionMode the execution mode for this argument + * @param ExecutionEnvironment the execution mode for this argument */ - public ArgumentDefinition(int position, String name, ExecutionMode executionMode) { - this(position, name, null, executionMode); + public ArgumentDefinition(int position, String name, ExecutionEnvironment ExecutionEnvironment) { + this(position, name, null, ExecutionEnvironment); } /** @@ -45,14 +45,14 @@ public ArgumentDefinition(int position, String name, ExecutionMode executionMode * @param position the position of the argument at the definition site * @param name the name of the argument * @param defaultValue the default value of the argument - * @param executionMode the execution mode for this argument + * @param ExecutionEnvironment the execution mode for this argument */ public ArgumentDefinition( - int position, String name, ExpressionNode defaultValue, ExecutionMode executionMode) { + int position, String name, ExpressionNode defaultValue, ExecutionEnvironment ExecutionEnvironment) { this.position = position; this.name = name; this.defaultValue = Optional.ofNullable(defaultValue); - this.isSuspended = executionMode.isSuspended(); + this.isSuspended = ExecutionEnvironment.isSuspended(); } /** diff --git a/engine/runtime/src/main/java/org/enso/interpreter/runtime/callable/atom/AtomConstructor.java b/engine/runtime/src/main/java/org/enso/interpreter/runtime/callable/atom/AtomConstructor.java index 13886479f87c..1f8ffbcbbe82 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/runtime/callable/atom/AtomConstructor.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/runtime/callable/atom/AtomConstructor.java @@ -175,7 +175,7 @@ private void generateQualifiedAccessor() { callTarget, null, new FunctionSchema( - new ArgumentDefinition(0, "self", ArgumentDefinition.ExecutionMode.EXECUTE))); + new ArgumentDefinition(0, "self", ArgumentDefinition.ExecutionEnvironment.EXECUTE))); definitionScope.registerMethod(type.getEigentype(), this.name, function); } diff --git a/engine/runtime/src/main/java/org/enso/interpreter/runtime/callable/atom/unboxing/SuspendedFieldGetterNode.java b/engine/runtime/src/main/java/org/enso/interpreter/runtime/callable/atom/unboxing/SuspendedFieldGetterNode.java index 5760f8515892..dbec535fc5ed 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/runtime/callable/atom/unboxing/SuspendedFieldGetterNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/runtime/callable/atom/unboxing/SuspendedFieldGetterNode.java @@ -22,7 +22,7 @@ final class SuspendedFieldGetterNode extends UnboxingAtom.FieldGetterNode { private UnboxingAtom.FieldGetterNode get; @Node.Child private InvokeFunctionNode invoke = InvokeFunctionNode.build( - new CallArgumentInfo[0], InvokeCallableNode.DefaultsExecutionMode.EXECUTE, InvokeCallableNode.ArgumentsExecutionMode.EXECUTE + new CallArgumentInfo[0], InvokeCallableNode.DefaultsExecutionEnvironment.EXECUTE, InvokeCallableNode.ArgumentsExecutionEnvironment.EXECUTE ); private SuspendedFieldGetterNode(UnboxingAtom.FieldGetterNode get, UnboxingAtom.FieldSetterNode set) { diff --git a/engine/runtime/src/main/java/org/enso/interpreter/runtime/callable/function/FunctionSchema.java b/engine/runtime/src/main/java/org/enso/interpreter/runtime/callable/function/FunctionSchema.java index 67a898481752..c2b15523d06b 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/runtime/callable/function/FunctionSchema.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/runtime/callable/function/FunctionSchema.java @@ -76,7 +76,7 @@ public FunctionSchema( this.hasAnyPreApplied = hasAnyPreApplied; this.hasOversaturatedArguments = this.oversaturatedArguments.length > 0; - this.isFullyApplied = isFullyApplied(InvokeCallableNode.DefaultsExecutionMode.EXECUTE); + this.isFullyApplied = isFullyApplied(InvokeCallableNode.DefaultsExecutionEnvironment.EXECUTE); } /** @@ -242,14 +242,14 @@ public Annotation getAnnotation(String name) { /** * Checks whether the function is already fully applied. * - * @param defaultsExecutionMode should defaulted arguments be taken as applied or not. + * @param defaultsExecutionEnvironment should defaulted arguments be taken as applied or not. * @return whether or not the function is fully applied. */ @CompilerDirectives.TruffleBoundary - public boolean isFullyApplied(InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode) { + public boolean isFullyApplied(InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment) { boolean functionIsFullyApplied = true; for (int i = 0; i < getArgumentsCount(); i++) { - boolean hasValidDefault = hasDefaultAt(i) && !defaultsExecutionMode.isIgnore(); + boolean hasValidDefault = hasDefaultAt(i) && !defaultsExecutionEnvironment.isIgnore(); boolean hasPreappliedArg = hasPreAppliedAt(i); if (!(hasValidDefault || hasPreappliedArg)) { diff --git a/engine/runtime/src/main/java/org/enso/interpreter/runtime/data/Type.java b/engine/runtime/src/main/java/org/enso/interpreter/runtime/data/Type.java index fb9d4b2f580f..dd87e81fdb0c 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/runtime/data/Type.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/runtime/data/Type.java @@ -71,7 +71,7 @@ private void generateQualifiedAccessor() { node.getCallTarget(), null, new FunctionSchema( - new ArgumentDefinition(0, "this", ArgumentDefinition.ExecutionMode.EXECUTE))); + new ArgumentDefinition(0, "this", ArgumentDefinition.ExecutionEnvironment.EXECUTE))); definitionScope.registerMethod(definitionScope.getAssociatedType(), this.name, function); } @@ -168,7 +168,7 @@ public void generateGetters(EnsoLanguage language) { new ArgumentDefinition( 0, Constants.Names.SELF_ARGUMENT, - ArgumentDefinition.ExecutionMode.EXECUTE))); + ArgumentDefinition.ExecutionEnvironment.EXECUTE))); definitionScope.registerMethod(this, name, f); }); } diff --git a/engine/runtime/src/main/java/org/enso/interpreter/runtime/error/PanicException.java b/engine/runtime/src/main/java/org/enso/interpreter/runtime/error/PanicException.java index f74cd6947bff..d42e9e014261 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/runtime/error/PanicException.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/runtime/error/PanicException.java @@ -11,8 +11,8 @@ import com.oracle.truffle.api.source.SourceSection; import org.enso.interpreter.node.BaseNode.TailStatus; import org.enso.interpreter.node.callable.IndirectInvokeMethodNode; -import org.enso.interpreter.node.callable.InvokeCallableNode.ArgumentsExecutionMode; -import org.enso.interpreter.node.callable.InvokeCallableNode.DefaultsExecutionMode; +import org.enso.interpreter.node.callable.InvokeCallableNode.ArgumentsExecutionEnvironment; +import org.enso.interpreter.node.callable.InvokeCallableNode.DefaultsExecutionEnvironment; import org.enso.interpreter.node.expression.builtin.text.util.TypeToDisplayTextNode; import org.enso.interpreter.node.expression.builtin.text.util.TypeToDisplayTextNodeGen; import org.enso.interpreter.runtime.EnsoContext; @@ -107,8 +107,8 @@ Object getExceptionMessage( payload, new Object[] {payload}, new CallArgumentInfo[] {new CallArgumentInfo("self")}, - DefaultsExecutionMode.EXECUTE, - ArgumentsExecutionMode.EXECUTE, + DefaultsExecutionEnvironment.EXECUTE, + ArgumentsExecutionEnvironment.EXECUTE, TailStatus.NOT_TAIL, 0); try { diff --git a/engine/runtime/src/main/scala/org/enso/compiler/codegen/IrToTruffle.scala b/engine/runtime/src/main/scala/org/enso/compiler/codegen/IrToTruffle.scala index 9980a306c2c9..1e0601fc9022 100644 --- a/engine/runtime/src/main/scala/org/enso/compiler/codegen/IrToTruffle.scala +++ b/engine/runtime/src/main/scala/org/enso/compiler/codegen/IrToTruffle.scala @@ -736,7 +736,7 @@ class IrToTruffle( new ArgumentDefinition( 0, Constants.Names.SELF_ARGUMENT, - ArgumentDefinition.ExecutionMode.EXECUTE + ArgumentDefinition.ExecutionEnvironment.EXECUTE ) ) val fun = new RuntimeFunction(body, null, schema) @@ -752,7 +752,7 @@ class IrToTruffle( new ArgumentDefinition( 0, Constants.Names.SELF_ARGUMENT, - ArgumentDefinition.ExecutionMode.EXECUTE + ArgumentDefinition.ExecutionEnvironment.EXECUTE ) ) ) @@ -766,7 +766,7 @@ class IrToTruffle( new ArgumentDefinition( 0, Constants.Names.SELF_ARGUMENT, - ArgumentDefinition.ExecutionMode.EXECUTE + ArgumentDefinition.ExecutionEnvironment.EXECUTE ) ) ) @@ -1840,10 +1840,10 @@ class IrToTruffle( callArgs.append(arg) } - val defaultsExecutionMode = if (hasDefaultsSuspended) { - InvokeCallableNode.DefaultsExecutionMode.IGNORE + val defaultsExecutionEnvironment = if (hasDefaultsSuspended) { + InvokeCallableNode.DefaultsExecutionEnvironment.IGNORE } else { - InvokeCallableNode.DefaultsExecutionMode.EXECUTE + InvokeCallableNode.DefaultsExecutionEnvironment.EXECUTE } val appNode = application.getMetadata(ApplicationSaturation) match { @@ -1855,7 +1855,7 @@ class IrToTruffle( ApplicationNode.build( this.run(fn, subjectToInstrumentation), callArgs.toArray, - defaultsExecutionMode + defaultsExecutionEnvironment ) } @@ -2032,17 +2032,17 @@ class IrToTruffle( defaultExpression } - val executionMode = if (arg.suspended) { - ArgumentDefinition.ExecutionMode.PASS_THUNK + val ExecutionEnvironment = if (arg.suspended) { + ArgumentDefinition.ExecutionEnvironment.PASS_THUNK } else { - ArgumentDefinition.ExecutionMode.EXECUTE + ArgumentDefinition.ExecutionEnvironment.EXECUTE } new ArgumentDefinition( position, arg.name.name, defaultedValue, - executionMode + ExecutionEnvironment ) } } diff --git a/lib/scala/interpreter-dsl/src/main/java/org/enso/interpreter/dsl/MethodProcessor.java b/lib/scala/interpreter-dsl/src/main/java/org/enso/interpreter/dsl/MethodProcessor.java index 734a644484ee..09fdbf1c720b 100644 --- a/lib/scala/interpreter-dsl/src/main/java/org/enso/interpreter/dsl/MethodProcessor.java +++ b/lib/scala/interpreter-dsl/src/main/java/org/enso/interpreter/dsl/MethodProcessor.java @@ -333,19 +333,19 @@ private List generateMakeFunctionArgs(boolean staticInstance, List argumentDefs = new ArrayList<>(); int staticPrefix = 0; if (staticInstance) { - argumentDefs.add(" new ArgumentDefinition(0, \"selfStatic\", ArgumentDefinition.ExecutionMode.EXECUTE)"); + argumentDefs.add(" new ArgumentDefinition(0, \"selfStatic\", ArgumentDefinition.ExecutionEnvironment.EXECUTE)"); staticPrefix = 1; } for (MethodDefinition.ArgumentDefinition arg : args) { if (arg.isPositional()) { - String executionMode = arg.isSuspended() ? "PASS_THUNK" : "EXECUTE"; + String ExecutionEnvironment = arg.isSuspended() ? "PASS_THUNK" : "EXECUTE"; argumentDefs.add( " new ArgumentDefinition(" + (staticPrefix + arg.getPosition()) + ", \"" + arg.getName() - + "\", ArgumentDefinition.ExecutionMode." - + executionMode + + "\", ArgumentDefinition.ExecutionEnvironment." + + ExecutionEnvironment + ")"); } } From bbb43524f1147850b465e7de488671390d33cca9 Mon Sep 17 00:00:00 2001 From: Michael Mauderer Date: Tue, 18 Apr 2023 23:18:54 +0100 Subject: [PATCH 08/23] Fix naming of parameters. --- app/gui/controller/engine-protocol/src/language_server/types.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/app/gui/controller/engine-protocol/src/language_server/types.rs b/app/gui/controller/engine-protocol/src/language_server/types.rs index bb33e2b2bc80..05b0e0eeee64 100644 --- a/app/gui/controller/engine-protocol/src/language_server/types.rs +++ b/app/gui/controller/engine-protocol/src/language_server/types.rs @@ -1165,7 +1165,6 @@ pub struct LibraryComponentGroup { /// For more information, see /// https://github.com/enso-org/design/blob/main/epics/basic-libraries/write-action-control/design.md. #[derive(Hash, Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Display)] -#[serde(rename_all = "camelCase")] pub enum ExecutionEnvironment { /// Allows editing the graph, but the `Output` context is disabled, so it prevents accidental /// changes. From d473bd153c7ee100f900acb4868f4e2d3782dd5e Mon Sep 17 00:00:00 2001 From: Michael Mauderer Date: Tue, 18 Apr 2023 23:36:58 +0100 Subject: [PATCH 09/23] Revert unintended changes. --- .../node/callable/ApplicationNode.java | 10 ++-- .../callable/IndirectInvokeCallableNode.java | 52 +++++++++---------- .../IndirectInvokeConversionNode.java | 40 +++++++------- .../callable/IndirectInvokeMethodNode.java | 52 +++++++++---------- .../node/callable/InteropApplicationNode.java | 8 +-- .../callable/InteropConversionCallNode.java | 10 ++-- .../node/callable/InteropMethodCallNode.java | 12 ++--- .../node/callable/InvokeCallableNode.java | 36 ++++++------- .../node/callable/InvokeConversionNode.java | 20 +++---- .../node/callable/InvokeMethodNode.java | 24 ++++----- .../callable/argument/ArgumentSorterNode.java | 14 ++--- .../argument/IndirectArgumentSorterNode.java | 8 +-- .../node/callable/dispatch/CurryNode.java | 36 ++++++------- .../callable/dispatch/IndirectCurryNode.java | 24 ++++----- .../dispatch/IndirectInvokeFunctionNode.java | 18 +++---- .../callable/dispatch/InvokeFunctionNode.java | 40 +++++++------- .../callable/thunk/ThunkExecutorNode.java | 8 +-- .../node/expression/builtin/Builtin.java | 2 +- .../builtin/error/CatchAnyNode.java | 4 +- .../builtin/error/CatchErrorNode.java | 4 +- .../builtin/error/CatchPanicNode.java | 4 +- .../builtin/function/ApplicationOperator.java | 4 +- .../expression/builtin/io/PrintErrNode.java | 4 +- .../expression/builtin/io/PrintlnNode.java | 8 +-- .../builtin/meta/AtomWithAHoleNode.java | 8 +-- .../builtin/meta/EqualsAtomNode.java | 6 +-- .../ordering/CustomComparatorNode.java | 6 +-- .../builtin/ordering/HashCallbackNode.java | 8 +-- .../builtin/resource/BracketNode.java | 8 +-- .../expression/builtin/resource/WithNode.java | 4 +- .../builtin/runtime/NoInlineWithArgNode.java | 4 +- .../callable/argument/ArgumentDefinition.java | 14 ++--- .../callable/atom/AtomConstructor.java | 2 +- .../unboxing/SuspendedFieldGetterNode.java | 2 +- .../callable/function/FunctionSchema.java | 8 +-- .../enso/interpreter/runtime/data/Type.java | 4 +- .../runtime/error/PanicException.java | 8 +-- .../enso/compiler/codegen/IrToTruffle.scala | 22 ++++---- .../enso/interpreter/dsl/MethodProcessor.java | 8 +-- 39 files changed, 277 insertions(+), 277 deletions(-) diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/ApplicationNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/ApplicationNode.java index 77b2e8dd07d9..0abe83bcd349 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/ApplicationNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/ApplicationNode.java @@ -28,7 +28,7 @@ public class ApplicationNode extends ExpressionNode { private ApplicationNode( ExpressionNode callable, CallArgument[] callArguments, - InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment) { + InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode) { this.argExpressions = Arrays.stream(callArguments) .map(CallArgument::getExpression) @@ -40,7 +40,7 @@ private ApplicationNode( this.callable = callable; this.invokeCallableNode = InvokeCallableNode.build( - argSchema, defaultsExecutionEnvironment, InvokeCallableNode.ArgumentsExecutionEnvironment.EXECUTE); + argSchema, defaultsExecutionMode, InvokeCallableNode.ArgumentsExecutionMode.EXECUTE); } /** @@ -48,14 +48,14 @@ private ApplicationNode( * * @param callable the object being called * @param callArguments the arguments to pass to {@code callable} - * @param defaultsExecutionEnvironment whether or not defaults should be executed + * @param defaultsExecutionMode whether or not defaults should be executed * @return a node representing a function application */ public static ApplicationNode build( ExpressionNode callable, CallArgument[] callArguments, - InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment) { - return new ApplicationNode(callable, callArguments, defaultsExecutionEnvironment); + InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode) { + return new ApplicationNode(callable, callArguments, defaultsExecutionMode); } /** diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/IndirectInvokeCallableNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/IndirectInvokeCallableNode.java index 1b7c86853b2e..cdb69eb65322 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/IndirectInvokeCallableNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/IndirectInvokeCallableNode.java @@ -42,8 +42,8 @@ public abstract class IndirectInvokeCallableNode extends Node { * @param state current monadic state. * @param arguments arguments to pass to the callable. * @param schema names and ordering of the arguments. - * @param defaultsExecutionEnvironment whether defaults are suspended for this call. - * @param argumentsExecutionEnvironment whether arguments are preexecuted for this call. + * @param defaultsExecutionMode whether defaults are suspended for this call. + * @param argumentsExecutionMode whether arguments are preexecuted for this call. * @param isTail is the call happening in a tail position. * @return the result of executing the callable. */ @@ -53,8 +53,8 @@ public abstract Object execute( State state, Object[] arguments, CallArgumentInfo[] schema, - InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, - InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, + InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, + InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, BaseNode.TailStatus isTail); /** @@ -69,8 +69,8 @@ Object invokeWithWarnings( State state, Object[] arguments, CallArgumentInfo[] schema, - InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, - InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, + InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, + InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, BaseNode.TailStatus isTail, @Cached IndirectInvokeCallableNode invokeCallableNode, @CachedLibrary(limit = "3") WarningsLibrary warnings) { @@ -82,8 +82,8 @@ Object invokeWithWarnings( state, arguments, schema, - defaultsExecutionEnvironment, - argumentsExecutionEnvironment, + defaultsExecutionMode, + argumentsExecutionMode, isTail); Warning[] extracted = warnings.getWarnings(warning, null); @@ -100,8 +100,8 @@ Object invokeFunction( State state, Object[] arguments, CallArgumentInfo[] schema, - InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, - InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, + InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, + InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, BaseNode.TailStatus isTail, @Cached IndirectInvokeFunctionNode invokeFunctionNode) { return invokeFunctionNode.execute( @@ -110,8 +110,8 @@ Object invokeFunction( state, arguments, schema, - defaultsExecutionEnvironment, - argumentsExecutionEnvironment, + defaultsExecutionMode, + argumentsExecutionMode, isTail); } @@ -122,8 +122,8 @@ Object invokeConstructor( State state, Object[] arguments, CallArgumentInfo[] schema, - InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, - InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, + InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, + InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, BaseNode.TailStatus isTail, @Cached IndirectInvokeFunctionNode invokeFunctionNode) { return invokeFunction( @@ -132,8 +132,8 @@ Object invokeConstructor( state, arguments, schema, - defaultsExecutionEnvironment, - argumentsExecutionEnvironment, + defaultsExecutionMode, + argumentsExecutionMode, isTail, invokeFunctionNode); } @@ -145,8 +145,8 @@ Object invokeDataflowError( State state, Object[] arguments, CallArgumentInfo[] schema, - InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, - InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, + InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, + InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, BaseNode.TailStatus isTail) { return error; } @@ -158,8 +158,8 @@ Object invokePanicSentinel( State state, Object[] arguments, CallArgumentInfo[] schema, - InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, - InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, + InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, + InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, BaseNode.TailStatus isTail) { throw sentinel; } @@ -171,8 +171,8 @@ public Object invokeDynamicSymbol( State state, Object[] arguments, CallArgumentInfo[] schema, - InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, - InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, + InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, + InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, BaseNode.TailStatus isTail, @Cached IndirectInvokeMethodNode invokeMethodNode, @Cached ThunkExecutorNode thisExecutor) { @@ -181,7 +181,7 @@ public Object invokeDynamicSymbol( int thisArgumentPosition = thisArg == null ? 0 : thisArg; if (canApplyThis) { Object self = arguments[thisArgumentPosition]; - if (argumentsExecutionEnvironment.shouldExecute()) { + if (argumentsExecutionMode.shouldExecute()) { self = thisExecutor.executeThunk(self, state, BaseNode.TailStatus.NOT_TAIL); arguments[thisArgumentPosition] = self; } @@ -192,8 +192,8 @@ public Object invokeDynamicSymbol( self, arguments, schema, - defaultsExecutionEnvironment, - argumentsExecutionEnvironment, + defaultsExecutionMode, + argumentsExecutionMode, isTail, thisArgumentPosition); } else { @@ -209,7 +209,7 @@ public Object invokeGeneric( State state, Object[] arguments, CallArgumentInfo[] schema, - InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionMode, + InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, BaseNode.TailStatus isTail) { Atom error = EnsoContext.get(this).getBuiltins().error().makeNotInvokable(callable); diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/IndirectInvokeConversionNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/IndirectInvokeConversionNode.java index d86dc6a76e36..0f397f0871ba 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/IndirectInvokeConversionNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/IndirectInvokeConversionNode.java @@ -37,8 +37,8 @@ public abstract Object execute( Object that, Object[] arguments, CallArgumentInfo[] schema, - InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, - InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, + InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, + InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, BaseNode.TailStatus isTail, int thatArgumentPosition); @@ -51,8 +51,8 @@ Object doConvertFrom( Object that, Object[] arguments, CallArgumentInfo[] schema, - InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, - InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, + InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, + InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, BaseNode.TailStatus isTail, int thatArgumentPosition, @CachedLibrary(limit = "10") TypesLibrary dispatch, @@ -70,8 +70,8 @@ Object doConvertFrom( state, arguments, schema, - defaultsExecutionEnvironment, - argumentsExecutionEnvironment, + defaultsExecutionMode, + argumentsExecutionMode, isTail); } @@ -84,8 +84,8 @@ Object doDataflowError( DataflowError that, Object[] arguments, CallArgumentInfo[] schema, - InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, - InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, + InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, + InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, BaseNode.TailStatus isTail, int thatArgumentPosition, @CachedLibrary(limit = "10") TypesLibrary dispatch, @@ -103,8 +103,8 @@ Object doDataflowError( state, arguments, schema, - defaultsExecutionEnvironment, - argumentsExecutionEnvironment, + defaultsExecutionMode, + argumentsExecutionMode, isTail); } else { return that; @@ -120,8 +120,8 @@ Object doPanicSentinel( PanicSentinel that, Object[] arguments, CallArgumentInfo[] schema, - InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, - InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, + InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, + InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, BaseNode.TailStatus isTail, int thatArgumentPosition) { throw that; @@ -136,8 +136,8 @@ Object doWarning( WithWarnings that, Object[] arguments, CallArgumentInfo[] schema, - InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, - InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, + InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, + InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, BaseNode.TailStatus isTail, int thatArgumentPosition, @Cached IndirectInvokeConversionNode childDispatch) { @@ -152,8 +152,8 @@ Object doWarning( that.getValue(), arguments, schema, - defaultsExecutionEnvironment, - argumentsExecutionEnvironment, + defaultsExecutionMode, + argumentsExecutionMode, isTail, thatArgumentPosition); return WithWarnings.prependTo(result, warnings); @@ -168,8 +168,8 @@ Object doConvertText( Object that, Object[] arguments, CallArgumentInfo[] schema, - InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, - InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, + InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, + InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, BaseNode.TailStatus isTail, int thatArgumentPosition, @CachedLibrary(limit = "10") TypesLibrary methods, @@ -192,8 +192,8 @@ Object doConvertText( state, arguments, schema, - defaultsExecutionEnvironment, - argumentsExecutionEnvironment, + defaultsExecutionMode, + argumentsExecutionMode, isTail); } catch (UnsupportedMessageException e) { throw new IllegalStateException("Impossible, that is guaranteed to be a string."); diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/IndirectInvokeMethodNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/IndirectInvokeMethodNode.java index 3526cf04d687..6a22a01234e8 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/IndirectInvokeMethodNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/IndirectInvokeMethodNode.java @@ -43,8 +43,8 @@ public abstract Object execute( Object self, Object[] arguments, CallArgumentInfo[] schema, - InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, - InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, + InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, + InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, BaseNode.TailStatus isTail, int thisArgumentPosition); @@ -56,8 +56,8 @@ Object doFunctionalDispatch( Object self, Object[] arguments, CallArgumentInfo[] schema, - InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, - InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, + InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, + InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, BaseNode.TailStatus isTail, int thisArgumentPosition, @CachedLibrary(limit = "10") TypesLibrary dispatch, @@ -70,8 +70,8 @@ Object doFunctionalDispatch( state, arguments, schema, - defaultsExecutionEnvironment, - argumentsExecutionEnvironment, + defaultsExecutionMode, + argumentsExecutionMode, isTail); } @@ -83,8 +83,8 @@ Object doDataflowError( DataflowError self, Object[] arguments, CallArgumentInfo[] schema, - InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, - InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, + InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, + InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, BaseNode.TailStatus isTail, int thisArgumentPosition, @Cached MethodResolverNode methodResolverNode, @@ -101,8 +101,8 @@ Object doDataflowError( state, arguments, schema, - defaultsExecutionEnvironment, - argumentsExecutionEnvironment, + defaultsExecutionMode, + argumentsExecutionMode, isTail); } } @@ -115,8 +115,8 @@ Object doWarning( WithWarnings self, Object[] arguments, CallArgumentInfo[] schema, - InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, - InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, + InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, + InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, BaseNode.TailStatus isTail, int thisArgumentPosition, @Cached IndirectInvokeMethodNode childDispatch) { @@ -130,8 +130,8 @@ Object doWarning( self.getValue(), arguments, schema, - defaultsExecutionEnvironment, - argumentsExecutionEnvironment, + defaultsExecutionMode, + argumentsExecutionMode, isTail, thisArgumentPosition); return WithWarnings.prependTo(result, warnings); @@ -145,8 +145,8 @@ Object doPanicSentinel( PanicSentinel self, Object[] arguments, CallArgumentInfo[] schema, - InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, - InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, + InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, + InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, BaseNode.TailStatus isTail, int thisArgumentPosition) { throw self; @@ -166,8 +166,8 @@ Object doPolyglot( Object self, Object[] arguments, CallArgumentInfo[] schema, - InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, - InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, + InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, + InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, BaseNode.TailStatus isTail, int thisArgumentPosition, @CachedLibrary(limit = "10") TypesLibrary methods, @@ -200,8 +200,8 @@ Object doConvertText( Object self, Object[] arguments, CallArgumentInfo[] schema, - InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, - InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, + InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, + InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, BaseNode.TailStatus isTail, int thisArgumentPosition, @CachedLibrary(limit = "10") TypesLibrary methods, @@ -221,8 +221,8 @@ Object doConvertText( state, arguments, schema, - defaultsExecutionEnvironment, - argumentsExecutionEnvironment, + defaultsExecutionMode, + argumentsExecutionMode, isTail); } catch (UnsupportedMessageException e) { throw new IllegalStateException("Impossible, self is guaranteed to be a string."); @@ -243,8 +243,8 @@ Object doFallback( Object self, Object[] arguments, CallArgumentInfo[] schema, - InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, - InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, + InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, + InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, BaseNode.TailStatus isTail, int thisArgumentPosition, @Cached MethodResolverNode methodResolverNode, @@ -259,8 +259,8 @@ Object doFallback( state, arguments, schema, - defaultsExecutionEnvironment, - argumentsExecutionEnvironment, + defaultsExecutionMode, + argumentsExecutionMode, isTail); } } diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/InteropApplicationNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/InteropApplicationNode.java index f2dd3dfc3b4a..0c3b7d537dfe 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/InteropApplicationNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/InteropApplicationNode.java @@ -54,8 +54,8 @@ InvokeFunctionNode buildSorter(int length) { CallArgumentInfo[] args = buildSchema(length); return InvokeFunctionNode.build( args, - InvokeCallableNode.DefaultsExecutionEnvironment.EXECUTE, - InvokeCallableNode.ArgumentsExecutionEnvironment.PRE_EXECUTED); + InvokeCallableNode.DefaultsExecutionMode.EXECUTE, + InvokeCallableNode.ArgumentsExecutionMode.PRE_EXECUTED); } EnsoContext getContext() { @@ -96,8 +96,8 @@ Object callUncached( state, args, buildSchema(arguments.length), - InvokeCallableNode.DefaultsExecutionEnvironment.EXECUTE, - InvokeCallableNode.ArgumentsExecutionEnvironment.PRE_EXECUTED, + InvokeCallableNode.DefaultsExecutionMode.EXECUTE, + InvokeCallableNode.ArgumentsExecutionMode.PRE_EXECUTED, BaseNode.TailStatus.NOT_TAIL); } } diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/InteropConversionCallNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/InteropConversionCallNode.java index 4641a1d502bd..194b5a80ee5b 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/InteropConversionCallNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/InteropConversionCallNode.java @@ -10,8 +10,8 @@ import com.oracle.truffle.api.nodes.NodeInfo; import org.enso.interpreter.Constants; import org.enso.interpreter.node.BaseNode.TailStatus; -import org.enso.interpreter.node.callable.InvokeCallableNode.ArgumentsExecutionEnvironment; -import org.enso.interpreter.node.callable.InvokeCallableNode.DefaultsExecutionEnvironment; +import org.enso.interpreter.node.callable.InvokeCallableNode.ArgumentsExecutionMode; +import org.enso.interpreter.node.callable.InvokeCallableNode.DefaultsExecutionMode; import org.enso.interpreter.node.expression.builtin.interop.syntax.HostValueToEnsoNode; import org.enso.interpreter.runtime.EnsoContext; import org.enso.interpreter.runtime.callable.UnresolvedConversion; @@ -43,7 +43,7 @@ CallArgumentInfo[] buildSchema(int length) { InvokeConversionNode buildInvoker(int length) { CallArgumentInfo[] args = buildSchema(length); return InvokeConversionNode.build( - args, DefaultsExecutionEnvironment.EXECUTE, ArgumentsExecutionEnvironment.PRE_EXECUTED, 1); + args, DefaultsExecutionMode.EXECUTE, ArgumentsExecutionMode.PRE_EXECUTED, 1); } EnsoContext getContext() { @@ -91,8 +91,8 @@ Object callUncached( args[1], args, buildSchema(arguments.length), - DefaultsExecutionEnvironment.EXECUTE, - ArgumentsExecutionEnvironment.PRE_EXECUTED, + DefaultsExecutionMode.EXECUTE, + ArgumentsExecutionMode.PRE_EXECUTED, TailStatus.NOT_TAIL, 1); } diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/InteropMethodCallNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/InteropMethodCallNode.java index 90560876ad07..59912eee70f2 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/InteropMethodCallNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/InteropMethodCallNode.java @@ -9,8 +9,8 @@ import com.oracle.truffle.api.nodes.NodeInfo; import org.enso.interpreter.Constants; import org.enso.interpreter.node.BaseNode.TailStatus; -import org.enso.interpreter.node.callable.InvokeCallableNode.ArgumentsExecutionEnvironment; -import org.enso.interpreter.node.callable.InvokeCallableNode.DefaultsExecutionEnvironment; +import org.enso.interpreter.node.callable.InvokeCallableNode.ArgumentsExecutionMode; +import org.enso.interpreter.node.callable.InvokeCallableNode.DefaultsExecutionMode; import org.enso.interpreter.node.expression.builtin.interop.syntax.HostValueToEnsoNode; import org.enso.interpreter.runtime.EnsoContext; import org.enso.interpreter.runtime.callable.UnresolvedSymbol; @@ -56,8 +56,8 @@ InvokeMethodNode buildSorter(int length) { CallArgumentInfo[] args = buildSchema(length); return InvokeMethodNode.build( args, - InvokeCallableNode.DefaultsExecutionEnvironment.EXECUTE, - InvokeCallableNode.ArgumentsExecutionEnvironment.PRE_EXECUTED, + InvokeCallableNode.DefaultsExecutionMode.EXECUTE, + InvokeCallableNode.ArgumentsExecutionMode.PRE_EXECUTED, 0); } @@ -104,8 +104,8 @@ Object callUncached( args[0], args, buildSchema(arguments.length), - DefaultsExecutionEnvironment.EXECUTE, - ArgumentsExecutionEnvironment.PRE_EXECUTED, + DefaultsExecutionMode.EXECUTE, + ArgumentsExecutionMode.PRE_EXECUTED, TailStatus.NOT_TAIL, 0); } diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/InvokeCallableNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/InvokeCallableNode.java index dbe25e49a270..3720b29fc198 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/InvokeCallableNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/InvokeCallableNode.java @@ -40,7 +40,7 @@ public abstract class InvokeCallableNode extends BaseNode { /** Denotes the mode of defaulted arguments treatment for a function invocation. */ - public enum DefaultsExecutionEnvironment { + public enum DefaultsExecutionMode { /** Defaulted arguments should be ignored for this application position. */ IGNORE, /** Defaulted arguments should be executed normally for this application position. */ @@ -66,7 +66,7 @@ public boolean isExecute() { } /** Denotes the mode of arguments execution for a function invocation */ - public enum ArgumentsExecutionEnvironment { + public enum ArgumentsExecutionMode { /** Arguments are pre-executed for this call. */ PRE_EXECUTED, /** Arguments are passed as thunks and should be executed before calling the function. */ @@ -94,12 +94,12 @@ public boolean shouldExecute() { private final int thisArgumentPosition; private final int thatArgumentPosition; - private final ArgumentsExecutionEnvironment argumentsExecutionEnvironment; + private final ArgumentsExecutionMode argumentsExecutionMode; InvokeCallableNode( CallArgumentInfo[] schema, - DefaultsExecutionEnvironment defaultsExecutionEnvironment, - ArgumentsExecutionEnvironment argumentsExecutionEnvironment) { + DefaultsExecutionMode defaultsExecutionMode, + ArgumentsExecutionMode argumentsExecutionMode) { Integer thisArg = thisArgumentPosition(schema); this.canApplyThis = thisArg != null; this.thisArgumentPosition = thisArg == null ? -1 : thisArg; @@ -108,16 +108,16 @@ public boolean shouldExecute() { this.canApplyThat = thatArg != null; this.thatArgumentPosition = thatArg == null ? -1 : thatArg; - this.argumentsExecutionEnvironment = argumentsExecutionEnvironment; + this.argumentsExecutionMode = argumentsExecutionMode; this.invokeFunctionNode = - InvokeFunctionNode.build(schema, defaultsExecutionEnvironment, argumentsExecutionEnvironment); + InvokeFunctionNode.build(schema, defaultsExecutionMode, argumentsExecutionMode); this.invokeMethodNode = InvokeMethodNode.build( - schema, defaultsExecutionEnvironment, argumentsExecutionEnvironment, thisArgumentPosition); + schema, defaultsExecutionMode, argumentsExecutionMode, thisArgumentPosition); this.invokeConversionNode = InvokeConversionNode.build( - schema, defaultsExecutionEnvironment, argumentsExecutionEnvironment, thatArgumentPosition); + schema, defaultsExecutionMode, argumentsExecutionMode, thatArgumentPosition); } public static Integer thisArgumentPosition(CallArgumentInfo[] schema) { @@ -150,14 +150,14 @@ public static Integer thatArgumentPosition(CallArgumentInfo[] schema, int thisAr * Creates a new instance of this node. * * @param schema a description of the arguments being applied to the callable - * @param defaultsExecutionEnvironment the defaulted arguments handling mode for this call - * @param argumentsExecutionEnvironment the arguments execution mode for this call + * @param defaultsExecutionMode the defaulted arguments handling mode for this call + * @param argumentsExecutionMode the arguments execution mode for this call */ public static InvokeCallableNode build( CallArgumentInfo[] schema, - DefaultsExecutionEnvironment defaultsExecutionEnvironment, - ArgumentsExecutionEnvironment argumentsExecutionEnvironment) { - return InvokeCallableNodeGen.create(schema, defaultsExecutionEnvironment, argumentsExecutionEnvironment); + DefaultsExecutionMode defaultsExecutionMode, + ArgumentsExecutionMode argumentsExecutionMode) { + return InvokeCallableNodeGen.create(schema, defaultsExecutionMode, argumentsExecutionMode); } @Specialization @@ -190,7 +190,7 @@ public Object invokeConversion( if (canApplyThis && canApplyThat) { Object selfArgument = arguments[thisArgumentPosition]; Object thatArgument = arguments[thatArgumentPosition]; - if (argumentsExecutionEnvironment.shouldExecute()) { + if (argumentsExecutionMode.shouldExecute()) { if (thisExecutor == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); Lock lock = getLock(); @@ -235,7 +235,7 @@ public Object invokeDynamicSymbol( UnresolvedSymbol symbol, VirtualFrame callerFrame, State state, Object[] arguments) { if (canApplyThis) { Object selfArgument = arguments[thisArgumentPosition]; - if (argumentsExecutionEnvironment.shouldExecute()) { + if (argumentsExecutionMode.shouldExecute()) { if (thisExecutor == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); Lock lock = getLock(); @@ -276,8 +276,8 @@ public Object invokeWarnings( insert( build( invokeFunctionNode.getSchema(), - invokeFunctionNode.getDefaultsExecutionEnvironment(), - invokeFunctionNode.getArgumentsExecutionEnvironment())); + invokeFunctionNode.getDefaultsExecutionMode(), + invokeFunctionNode.getArgumentsExecutionMode())); childDispatch.setTailStatus(getTailStatus()); childDispatch.setId(invokeFunctionNode.getId()); notifyInserted(childDispatch); diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/InvokeConversionNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/InvokeConversionNode.java index 51cd25b68c90..6af3ce73ee8d 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/InvokeConversionNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/InvokeConversionNode.java @@ -34,26 +34,26 @@ public abstract class InvokeConversionNode extends BaseNode { * Creates a new node for method invocation. * * @param schema a description of the arguments being applied to the callable - * @param defaultsExecutionEnvironment the defaulted arguments handling mode for this call - * @param argumentsExecutionEnvironment the arguments execution mode for this call + * @param defaultsExecutionMode the defaulted arguments handling mode for this call + * @param argumentsExecutionMode the arguments execution mode for this call * @return a new invoke method node */ public static InvokeConversionNode build( CallArgumentInfo[] schema, - InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, - InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, + InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, + InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, int thatArgumentPosition) { return InvokeConversionNodeGen.create( - schema, defaultsExecutionEnvironment, argumentsExecutionEnvironment, thatArgumentPosition); + schema, defaultsExecutionMode, argumentsExecutionMode, thatArgumentPosition); } InvokeConversionNode( CallArgumentInfo[] schema, - InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, - InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, + InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, + InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, int thatArgumentPosition) { this.invokeFunctionNode = - InvokeFunctionNode.build(schema, defaultsExecutionEnvironment, argumentsExecutionEnvironment); + InvokeFunctionNode.build(schema, defaultsExecutionMode, argumentsExecutionMode); this.thatArgumentPosition = thatArgumentPosition; } @@ -160,8 +160,8 @@ Object doWarning( insert( build( invokeFunctionNode.getSchema(), - invokeFunctionNode.getDefaultsExecutionEnvironment(), - invokeFunctionNode.getArgumentsExecutionEnvironment(), + invokeFunctionNode.getDefaultsExecutionMode(), + invokeFunctionNode.getArgumentsExecutionMode(), thatArgumentPosition)); childDispatch.setTailStatus(getTailStatus()); childDispatch.setId(invokeFunctionNode.getId()); diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/InvokeMethodNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/InvokeMethodNode.java index 5233b2b28a60..0ccd30812095 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/InvokeMethodNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/InvokeMethodNode.java @@ -62,26 +62,26 @@ public abstract class InvokeMethodNode extends BaseNode { * Creates a new node for method invocation. * * @param schema a description of the arguments being applied to the callable - * @param defaultsExecutionEnvironment the defaulted arguments handling mode for this call - * @param argumentsExecutionEnvironment the arguments execution mode for this call + * @param defaultsExecutionMode the defaulted arguments handling mode for this call + * @param argumentsExecutionMode the arguments execution mode for this call * @return a new invoke method node */ public static InvokeMethodNode build( CallArgumentInfo[] schema, - InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, - InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, + InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, + InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, int thisArgumentPosition) { return InvokeMethodNodeGen.create( - schema, defaultsExecutionEnvironment, argumentsExecutionEnvironment, thisArgumentPosition); + schema, defaultsExecutionMode, argumentsExecutionMode, thisArgumentPosition); } InvokeMethodNode( CallArgumentInfo[] schema, - InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, - InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, + InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, + InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, int thisArgumentPosition) { this.invokeFunctionNode = - InvokeFunctionNode.build(schema, defaultsExecutionEnvironment, argumentsExecutionEnvironment); + InvokeFunctionNode.build(schema, defaultsExecutionMode, argumentsExecutionMode); this.argumentCount = schema.length; this.thisArgumentPosition = thisArgumentPosition; } @@ -201,8 +201,8 @@ public InvokeFunctionNode buildInvokeFunctionWithSelf() { schema[0] = new CallArgumentInfo(); return InvokeFunctionNode.build( schema, - invokeFunctionNode.getDefaultsExecutionEnvironment(), - invokeFunctionNode.getArgumentsExecutionEnvironment()); + invokeFunctionNode.getDefaultsExecutionMode(), + invokeFunctionNode.getArgumentsExecutionMode()); } @Specialization( @@ -260,8 +260,8 @@ Object doWarning( insert( build( invokeFunctionNode.getSchema(), - invokeFunctionNode.getDefaultsExecutionEnvironment(), - invokeFunctionNode.getArgumentsExecutionEnvironment(), + invokeFunctionNode.getDefaultsExecutionMode(), + invokeFunctionNode.getArgumentsExecutionMode(), thisArgumentPosition)); childDispatch.setTailStatus(getTailStatus()); childDispatch.setId(invokeFunctionNode.getId()); diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/argument/ArgumentSorterNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/argument/ArgumentSorterNode.java index ca42b0109387..cbad564b3a77 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/argument/ArgumentSorterNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/argument/ArgumentSorterNode.java @@ -23,15 +23,15 @@ public class ArgumentSorterNode extends BaseNode { private final FunctionSchema postApplicationSchema; private final ArgumentMapping mapping; private @Children ThunkExecutorNode[] executors; - private final InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment; + private final InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode; private ArgumentSorterNode( FunctionSchema preApplicationSchema, FunctionSchema postApplicationSchema, ArgumentMapping mapping, - InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment) { + InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode) { this.preApplicationSchema = preApplicationSchema; - this.argumentsExecutionEnvironment = argumentsExecutionEnvironment; + this.argumentsExecutionMode = argumentsExecutionMode; this.mapping = mapping; this.postApplicationSchema = postApplicationSchema; } @@ -42,16 +42,16 @@ private ArgumentSorterNode( * @param preApplicationSchema the schema of all functions passed to the {@link #execute(Function, * Object, Object[])} method of this node. * @param mapping the argument mapping generated for current application site. - * @param argumentsExecutionEnvironment lazy arguments handling mode for this node. + * @param argumentsExecutionMode lazy arguments handling mode for this node. * @return a sorter node for the arguments in {@code schema} being passed to a function with the * {@code preApplicationSchema}. */ public static ArgumentSorterNode build( FunctionSchema preApplicationSchema, ArgumentMapping mapping, - InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment) { + InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode) { return new ArgumentSorterNode( - preApplicationSchema, mapping.getPostApplicationSchema(), mapping, argumentsExecutionEnvironment); + preApplicationSchema, mapping.getPostApplicationSchema(), mapping, argumentsExecutionMode); } private void initArgumentExecutors() { @@ -95,7 +95,7 @@ private void executeArguments(Object[] arguments, State state) { * @return the provided {@code arguments} in the order expected by the cached {@link Function} */ public MappedArguments execute(Function function, State state, Object[] arguments) { - if (argumentsExecutionEnvironment.shouldExecute()) { + if (argumentsExecutionMode.shouldExecute()) { executeArguments(arguments, state); } Object[] mappedAppliedArguments = diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/argument/IndirectArgumentSorterNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/argument/IndirectArgumentSorterNode.java index 3343aede5292..5f0e1ee2ebc3 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/argument/IndirectArgumentSorterNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/argument/IndirectArgumentSorterNode.java @@ -52,7 +52,7 @@ private void executeArguments( * * @param preApplicationSchema the function schema before applying the arguments * @param mapping the pre-computed argument mapping for the function - * @param argumentsExecutionEnvironment whether arguments should be executed or not + * @param argumentsExecutionMode whether arguments should be executed or not * @param function the function this node is reordering arguments for * @param state the state to pass to the function * @param arguments the arguments to reorder @@ -61,7 +61,7 @@ private void executeArguments( public abstract ArgumentSorterNode.MappedArguments execute( FunctionSchema preApplicationSchema, ArgumentMapping mapping, - InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, + InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, Function function, State state, Object[] arguments); @@ -70,13 +70,13 @@ public abstract ArgumentSorterNode.MappedArguments execute( ArgumentSorterNode.MappedArguments doExecute( FunctionSchema preApplicationSchema, ArgumentMapping mapping, - InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, + InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, Function function, State state, Object[] arguments, @Cached ThunkExecutorNode thunkExecutorNode) { FunctionSchema postApplicationSchema = mapping.getPostApplicationSchema(); - if (argumentsExecutionEnvironment.shouldExecute()) { + if (argumentsExecutionMode.shouldExecute()) { executeArguments(mapping, arguments, state, thunkExecutorNode); } Object[] mappedAppliedArguments = diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/dispatch/CurryNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/dispatch/CurryNode.java index 3651fa851031..4a2b022bb5ee 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/dispatch/CurryNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/dispatch/CurryNode.java @@ -27,19 +27,19 @@ public class CurryNode extends BaseNode { private @Child ExecuteCallNode directCall; private @Child CallOptimiserNode loopingCall; private final BranchProfile keepExecutingProfile = BranchProfile.create(); - private final InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment; + private final InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode; private CurryNode( FunctionSchema postApplicationSchema, - InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, - InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, + InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, + InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, BaseNode.TailStatus isTail) { setTailStatus(isTail); - this.defaultsExecutionEnvironment = defaultsExecutionEnvironment; + this.defaultsExecutionMode = defaultsExecutionMode; this.postApplicationSchema = postApplicationSchema; - appliesFully = postApplicationSchema.isFullyApplied(defaultsExecutionEnvironment); + appliesFully = postApplicationSchema.isFullyApplied(defaultsExecutionMode); initializeCallNodes(); - initializeOversaturatedCallNode(argumentsExecutionEnvironment); + initializeOversaturatedCallNode(argumentsExecutionMode); } /** @@ -47,20 +47,20 @@ private CurryNode( * * @param argumentMapping the argument mapping for moving from the original schema to the argument * schema expected by the function. - * @param defaultsExecutionEnvironment the mode of handling defaulted arguments for this call. - * @param argumentsExecutionEnvironment the mode of executing lazy arguments for this call. + * @param defaultsExecutionMode the mode of handling defaulted arguments for this call. + * @param argumentsExecutionMode the mode of executing lazy arguments for this call. * @param tailStatus is this a tail call position? * @return an instance of this node. */ public static CurryNode build( CallArgumentInfo.ArgumentMapping argumentMapping, - InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, - InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, + InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, + InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, BaseNode.TailStatus tailStatus) { return new CurryNode( argumentMapping.getPostApplicationSchema(), - defaultsExecutionEnvironment, - argumentsExecutionEnvironment, + defaultsExecutionMode, + argumentsExecutionMode, tailStatus); } @@ -73,13 +73,13 @@ private void initializeCallNodes() { } private void initializeOversaturatedCallNode( - InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment) { + InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode) { if (postApplicationSchema.hasOversaturatedArgs()) { oversaturatedCallableNode = InvokeCallableNodeGen.create( postApplicationSchema.getOversaturatedArguments(), - defaultsExecutionEnvironment, - argumentsExecutionEnvironment); + defaultsExecutionMode, + argumentsExecutionMode); oversaturatedCallableNode.setTailStatus(getTailStatus()); } } @@ -106,7 +106,7 @@ public Object execute( if (appliesFully) { if (!postApplicationSchema.hasOversaturatedArgs()) { var value = doCall(function, callerInfo, state, arguments); - if (defaultsExecutionEnvironment.isExecute() + if (defaultsExecutionMode.isExecute() && (value instanceof Function || (value instanceof AtomConstructor cons && cons.getConstructorFunction().getSchema().isFullyApplied()))) { keepExecutingProfile.enter(); @@ -120,8 +120,8 @@ public Object execute( insert( InvokeCallableNode.build( new CallArgumentInfo[0], - InvokeCallableNode.DefaultsExecutionEnvironment.EXECUTE, - InvokeCallableNode.ArgumentsExecutionEnvironment.EXECUTE)); + InvokeCallableNode.DefaultsExecutionMode.EXECUTE, + InvokeCallableNode.ArgumentsExecutionMode.EXECUTE)); } } finally { lock.unlock(); diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/dispatch/IndirectCurryNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/dispatch/IndirectCurryNode.java index 790b9a750d66..839e92e50ce7 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/dispatch/IndirectCurryNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/dispatch/IndirectCurryNode.java @@ -38,8 +38,8 @@ public abstract class IndirectCurryNode extends Node { * @param oversaturatedArguments any arguments that should be treated as candidates for an * eta-expanded call. * @param postApplicationSchema function schema after the call. - * @param defaultsExecutionEnvironment should default arguments be used for this call. - * @param argumentsExecutionEnvironment are arguments pre-executed or suspended. + * @param defaultsExecutionMode should default arguments be used for this call. + * @param argumentsExecutionMode are arguments pre-executed or suspended. * @param isTail is the call happening in a tail position. * @return the result of executing the {@code function}. */ @@ -51,8 +51,8 @@ public abstract Object execute( Object[] arguments, Object[] oversaturatedArguments, FunctionSchema postApplicationSchema, - InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, - InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, + InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, + InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, BaseNode.TailStatus isTail); @Specialization @@ -64,18 +64,18 @@ Object doCurry( Object[] arguments, Object[] oversaturatedArguments, FunctionSchema postApplicationSchema, - InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, - InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, + InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, + InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, BaseNode.TailStatus isTail, @Cached ExecuteCallNode directCall, @Cached LoopingCallOptimiserNode loopingCall, @Cached IndirectInvokeCallableNode oversaturatedCallableNode) { - boolean appliesFully = postApplicationSchema.isFullyApplied(defaultsExecutionEnvironment); + boolean appliesFully = postApplicationSchema.isFullyApplied(defaultsExecutionMode); if (appliesFully) { if (!postApplicationSchema.hasOversaturatedArgs()) { var value = doCall(function, callerInfo, state, arguments, isTail, directCall, loopingCall); - if (defaultsExecutionEnvironment.isExecute() + if (defaultsExecutionMode.isExecute() && (value instanceof Function || (value instanceof AtomConstructor cons && cons.getConstructorFunction().getSchema().isFullyApplied()))) { return oversaturatedCallableNode.execute( @@ -84,8 +84,8 @@ Object doCurry( state, new Object[0], new CallArgumentInfo[0], - defaultsExecutionEnvironment, - argumentsExecutionEnvironment, + defaultsExecutionMode, + argumentsExecutionMode, isTail); } else { return value; @@ -99,8 +99,8 @@ Object doCurry( state, oversaturatedArguments, postApplicationSchema.getOversaturatedArguments(), - defaultsExecutionEnvironment, - argumentsExecutionEnvironment, + defaultsExecutionMode, + argumentsExecutionMode, isTail); } } else { diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/dispatch/IndirectInvokeFunctionNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/dispatch/IndirectInvokeFunctionNode.java index 198111853a6d..d3fb301ac277 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/dispatch/IndirectInvokeFunctionNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/dispatch/IndirectInvokeFunctionNode.java @@ -33,8 +33,8 @@ public abstract class IndirectInvokeFunctionNode extends Node { * @param state the state to pass to the function * @param arguments the arguments being passed to {@code function} * @param schema the names and ordering of arguments for this call site - * @param defaultsExecutionEnvironment whether defaults are suspended for this call. - * @param argumentsExecutionEnvironment whether arguments are preexecuted for this call. + * @param defaultsExecutionMode whether defaults are suspended for this call. + * @param argumentsExecutionMode whether arguments are preexecuted for this call. * @param isTail is the call happening in a tail position. * @return the result of executing the {@code function} with reordered {@code arguments} */ @@ -44,8 +44,8 @@ public abstract Object execute( Object state, Object[] arguments, CallArgumentInfo[] schema, - InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, - InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, + InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, + InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, BaseNode.TailStatus isTail); @Specialization @@ -55,8 +55,8 @@ Object invokeUncached( State state, Object[] arguments, CallArgumentInfo[] schema, - InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, - InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment, + InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, + InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode, BaseNode.TailStatus isTail, @Cached IndirectArgumentSorterNode mappingNode, @Cached IndirectCurryNode curryNode, @@ -68,7 +68,7 @@ Object invokeUncached( mappingNode.execute( function.getSchema(), argumentMapping, - argumentsExecutionEnvironment, + argumentsExecutionMode, function, state, arguments); @@ -87,8 +87,8 @@ Object invokeUncached( mappedArguments.getSortedArguments(), mappedArguments.getOversaturatedArguments(), argumentMapping.getPostApplicationSchema(), - defaultsExecutionEnvironment, - argumentsExecutionEnvironment, + defaultsExecutionMode, + argumentsExecutionMode, isTail); } } diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/dispatch/InvokeFunctionNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/dispatch/InvokeFunctionNode.java index 5ad679392600..151c32cccbee 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/dispatch/InvokeFunctionNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/dispatch/InvokeFunctionNode.java @@ -31,34 +31,34 @@ public abstract class InvokeFunctionNode extends BaseNode { private final CallArgumentInfo[] schema; - private final InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment; - private final InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment; + private final InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode; + private final InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode; private @Child CaptureCallerInfoNode captureCallerInfoNode = CaptureCallerInfoNode.build(); private @Child FunctionCallInstrumentationNode functionCallInstrumentationNode = FunctionCallInstrumentationNode.build(); InvokeFunctionNode( CallArgumentInfo[] schema, - InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, - InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment) { + InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, + InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode) { this.schema = schema; - this.defaultsExecutionEnvironment = defaultsExecutionEnvironment; - this.argumentsExecutionEnvironment = argumentsExecutionEnvironment; + this.defaultsExecutionMode = defaultsExecutionMode; + this.argumentsExecutionMode = argumentsExecutionMode; } /** * Creates an instance of this node. * * @param schema information about the call arguments in positional order - * @param defaultsExecutionEnvironment the defaults execution mode for this function invocation - * @param argumentsExecutionEnvironment the arguments execution mode for this function invocation + * @param defaultsExecutionMode the defaults execution mode for this function invocation + * @param argumentsExecutionMode the arguments execution mode for this function invocation * @return an instance of this node. */ public static InvokeFunctionNode build( CallArgumentInfo[] schema, - InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment, - InvokeCallableNode.ArgumentsExecutionEnvironment argumentsExecutionEnvironment) { - return InvokeFunctionNodeGen.create(schema, defaultsExecutionEnvironment, argumentsExecutionEnvironment); + InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode, + InvokeCallableNode.ArgumentsExecutionMode argumentsExecutionMode) { + return InvokeFunctionNodeGen.create(schema, defaultsExecutionMode, argumentsExecutionMode); } EnsoContext getContext() { @@ -76,10 +76,10 @@ Object invokeCached( @Cached("function.getSchema()") FunctionSchema cachedSchema, @Cached("generate(cachedSchema, getSchema())") CallArgumentInfo.ArgumentMapping argumentMapping, - @Cached("build(cachedSchema, argumentMapping, getArgumentsExecutionEnvironment())") + @Cached("build(cachedSchema, argumentMapping, getArgumentsExecutionMode())") ArgumentSorterNode mappingNode, @Cached( - "build(argumentMapping, getDefaultsExecutionEnvironment(), getArgumentsExecutionEnvironment(), getTailStatus())") + "build(argumentMapping, getDefaultsExecutionMode(), getArgumentsExecutionMode(), getTailStatus())") CurryNode curryNode) { ArgumentSorterNode.MappedArguments mappedArguments = mappingNode.execute(function, state, arguments); @@ -123,7 +123,7 @@ Object invokeUncached( mappingNode.execute( function.getSchema(), argumentMapping, - getArgumentsExecutionEnvironment(), + getArgumentsExecutionMode(), function, state, arguments); @@ -145,8 +145,8 @@ Object invokeUncached( mappedArguments.getSortedArguments(), mappedArguments.getOversaturatedArguments(), argumentMapping.getPostApplicationSchema(), - defaultsExecutionEnvironment, - argumentsExecutionEnvironment, + defaultsExecutionMode, + argumentsExecutionMode, getTailStatus()); } @@ -166,12 +166,12 @@ public CallArgumentInfo[] getSchema() { return schema; } - public InvokeCallableNode.DefaultsExecutionEnvironment getDefaultsExecutionEnvironment() { - return this.defaultsExecutionEnvironment; + public InvokeCallableNode.DefaultsExecutionMode getDefaultsExecutionMode() { + return this.defaultsExecutionMode; } - public InvokeCallableNode.ArgumentsExecutionEnvironment getArgumentsExecutionEnvironment() { - return argumentsExecutionEnvironment; + public InvokeCallableNode.ArgumentsExecutionMode getArgumentsExecutionMode() { + return argumentsExecutionMode; } /** @return the source section for this node. */ diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/thunk/ThunkExecutorNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/thunk/ThunkExecutorNode.java index 62f6238b45b0..8552a3b3fe27 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/callable/thunk/ThunkExecutorNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/callable/thunk/ThunkExecutorNode.java @@ -93,8 +93,8 @@ static InvokeFunctionNode buildInvokeFunctionNode(BaseNode.TailStatus tailStatus var node = InvokeFunctionNode.build( new CallArgumentInfo[0], - InvokeCallableNode.DefaultsExecutionEnvironment.EXECUTE, - InvokeCallableNode.ArgumentsExecutionEnvironment.EXECUTE); + InvokeCallableNode.DefaultsExecutionMode.EXECUTE, + InvokeCallableNode.ArgumentsExecutionMode.EXECUTE); node.setTailStatus(tailStatus); return node; } @@ -129,8 +129,8 @@ Object doUncachedFn( state, new Object[0], new CallArgumentInfo[0], - InvokeCallableNode.DefaultsExecutionEnvironment.EXECUTE, - InvokeCallableNode.ArgumentsExecutionEnvironment.EXECUTE, + InvokeCallableNode.DefaultsExecutionMode.EXECUTE, + InvokeCallableNode.ArgumentsExecutionMode.EXECUTE, isTail); } diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/Builtin.java b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/Builtin.java index 26725e4f22da..c4cb8322a085 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/Builtin.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/Builtin.java @@ -25,7 +25,7 @@ private AtomConstructor build(EnsoLanguage language, ModuleScope scope, Type typ .mapToObj( i -> new ArgumentDefinition( - i, params.get(i), ArgumentDefinition.ExecutionEnvironment.EXECUTE)) + i, params.get(i), ArgumentDefinition.ExecutionMode.EXECUTE)) .toArray(ArgumentDefinition[]::new)); return res; } diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/error/CatchAnyNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/error/CatchAnyNode.java index 7cd365e90c37..19c24c10bcef 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/error/CatchAnyNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/error/CatchAnyNode.java @@ -18,8 +18,8 @@ public class CatchAnyNode extends Node { this.invokeCallableNode = InvokeCallableNode.build( new CallArgumentInfo[] {new CallArgumentInfo()}, - InvokeCallableNode.DefaultsExecutionEnvironment.EXECUTE, - InvokeCallableNode.ArgumentsExecutionEnvironment.PRE_EXECUTED); + InvokeCallableNode.DefaultsExecutionMode.EXECUTE, + InvokeCallableNode.ArgumentsExecutionMode.PRE_EXECUTED); this.invokeCallableNode.setTailStatus(BaseNode.TailStatus.TAIL_DIRECT); } diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/error/CatchErrorNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/error/CatchErrorNode.java index 8869730fe8d9..608f3b83d636 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/error/CatchErrorNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/error/CatchErrorNode.java @@ -21,8 +21,8 @@ public class CatchErrorNode extends Node { this.invokeCallableNode = InvokeCallableNode.build( new CallArgumentInfo[] {new CallArgumentInfo()}, - InvokeCallableNode.DefaultsExecutionEnvironment.EXECUTE, - InvokeCallableNode.ArgumentsExecutionEnvironment.PRE_EXECUTED); + InvokeCallableNode.DefaultsExecutionMode.EXECUTE, + InvokeCallableNode.ArgumentsExecutionMode.PRE_EXECUTED); this.invokeCallableNode.setTailStatus(BaseNode.TailStatus.TAIL_DIRECT); } diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/error/CatchPanicNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/error/CatchPanicNode.java index eff3cd4c7cd7..ac7a37d8e042 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/error/CatchPanicNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/error/CatchPanicNode.java @@ -37,8 +37,8 @@ public abstract class CatchPanicNode extends Node { this.invokeCallableNode = InvokeCallableNode.build( new CallArgumentInfo[] {new CallArgumentInfo()}, - InvokeCallableNode.DefaultsExecutionEnvironment.EXECUTE, - InvokeCallableNode.ArgumentsExecutionEnvironment.PRE_EXECUTED); + InvokeCallableNode.DefaultsExecutionMode.EXECUTE, + InvokeCallableNode.ArgumentsExecutionMode.PRE_EXECUTED); this.invokeCallableNode.setTailStatus(BaseNode.TailStatus.TAIL_DIRECT); } diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/function/ApplicationOperator.java b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/function/ApplicationOperator.java index be12ce4b7ddd..ad5d39967321 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/function/ApplicationOperator.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/function/ApplicationOperator.java @@ -20,8 +20,8 @@ public class ApplicationOperator extends Node { invokeCallableNode = InvokeCallableNode.build( new CallArgumentInfo[] {new CallArgumentInfo()}, - InvokeCallableNode.DefaultsExecutionEnvironment.EXECUTE, - InvokeCallableNode.ArgumentsExecutionEnvironment.EXECUTE); + InvokeCallableNode.DefaultsExecutionMode.EXECUTE, + InvokeCallableNode.ArgumentsExecutionMode.EXECUTE); invokeCallableNode.setTailStatus(BaseNode.TailStatus.TAIL_DIRECT); } diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/io/PrintErrNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/io/PrintErrNode.java index 1e963cf4daed..cc69fc53e87a 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/io/PrintErrNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/io/PrintErrNode.java @@ -73,8 +73,8 @@ boolean isText(Object o) { InvokeCallableNode buildInvokeCallableNode() { return InvokeCallableNode.build( new CallArgumentInfo[] {new CallArgumentInfo()}, - InvokeCallableNode.DefaultsExecutionEnvironment.EXECUTE, - InvokeCallableNode.ArgumentsExecutionEnvironment.PRE_EXECUTED); + InvokeCallableNode.DefaultsExecutionMode.EXECUTE, + InvokeCallableNode.ArgumentsExecutionMode.PRE_EXECUTED); } UnresolvedSymbol buildSymbol() { diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/io/PrintlnNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/io/PrintlnNode.java index 5a8b69df142d..f2f0eb2b798c 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/io/PrintlnNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/io/PrintlnNode.java @@ -28,8 +28,8 @@ public abstract class PrintlnNode extends Node { private @Child InvokeCallableNode invokeCallableNode = InvokeCallableNode.build( new CallArgumentInfo[] {new CallArgumentInfo()}, - InvokeCallableNode.DefaultsExecutionEnvironment.EXECUTE, - InvokeCallableNode.ArgumentsExecutionEnvironment.PRE_EXECUTED); + InvokeCallableNode.DefaultsExecutionMode.EXECUTE, + InvokeCallableNode.ArgumentsExecutionMode.PRE_EXECUTED); abstract Object execute(VirtualFrame frame, State state, @AcceptsError Object message); @@ -79,8 +79,8 @@ UnresolvedSymbol buildSymbol() { InvokeCallableNode buildInvokeCallableNode() { return InvokeCallableNode.build( new CallArgumentInfo[] {new CallArgumentInfo()}, - InvokeCallableNode.DefaultsExecutionEnvironment.EXECUTE, - InvokeCallableNode.ArgumentsExecutionEnvironment.PRE_EXECUTED); + InvokeCallableNode.DefaultsExecutionMode.EXECUTE, + InvokeCallableNode.ArgumentsExecutionMode.PRE_EXECUTED); } static PrintlnNode build() { diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/meta/AtomWithAHoleNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/meta/AtomWithAHoleNode.java index d8fba28353da..86332206692c 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/meta/AtomWithAHoleNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/meta/AtomWithAHoleNode.java @@ -42,8 +42,8 @@ static AtomWithAHoleNode build() { static InvokeCallableNode callWithHole() { return InvokeCallableNode.build( new CallArgumentInfo[] {new CallArgumentInfo()}, - InvokeCallableNode.DefaultsExecutionEnvironment.EXECUTE, - InvokeCallableNode.ArgumentsExecutionEnvironment.PRE_EXECUTED); + InvokeCallableNode.DefaultsExecutionMode.EXECUTE, + InvokeCallableNode.ArgumentsExecutionMode.PRE_EXECUTED); } @Specialization @@ -123,8 +123,8 @@ static final class SwapAtomFieldNode extends RootNode { private SwapAtomFieldNode() { super(null); this.schema = new FunctionSchema(FunctionSchema.CallerFrameAccess.NONE, new ArgumentDefinition[]{ - new ArgumentDefinition(0, "lazy", ArgumentDefinition.ExecutionEnvironment.EXECUTE), - new ArgumentDefinition(1, "value", ArgumentDefinition.ExecutionEnvironment.EXECUTE) + new ArgumentDefinition(0, "lazy", ArgumentDefinition.ExecutionMode.EXECUTE), + new ArgumentDefinition(1, "value", ArgumentDefinition.ExecutionMode.EXECUTE) }, new boolean[]{ true, false }, new CallArgumentInfo[0], new Annotation[0]); diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/meta/EqualsAtomNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/meta/EqualsAtomNode.java index 1e567f6f75ed..e4ab96f17cb3 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/meta/EqualsAtomNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/meta/EqualsAtomNode.java @@ -11,8 +11,8 @@ import com.oracle.truffle.api.nodes.Node; import com.oracle.truffle.api.profiles.ConditionProfile; import java.util.Arrays; -import org.enso.interpreter.node.callable.InvokeCallableNode.ArgumentsExecutionEnvironment; -import org.enso.interpreter.node.callable.InvokeCallableNode.DefaultsExecutionEnvironment; +import org.enso.interpreter.node.callable.InvokeCallableNode.ArgumentsExecutionMode; +import org.enso.interpreter.node.callable.InvokeCallableNode.DefaultsExecutionMode; import org.enso.interpreter.node.callable.dispatch.InvokeFunctionNode; import org.enso.interpreter.node.expression.builtin.ordering.CustomComparatorNode; import org.enso.interpreter.runtime.EnsoContext; @@ -136,6 +136,6 @@ static InvokeFunctionNode invokeCompareNode(Function compareFn) { argsInfo[i] = new CallArgumentInfo(argDef.getName()); } return InvokeFunctionNode.build( - argsInfo, DefaultsExecutionEnvironment.EXECUTE, ArgumentsExecutionEnvironment.EXECUTE); + argsInfo, DefaultsExecutionMode.EXECUTE, ArgumentsExecutionMode.EXECUTE); } } diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/ordering/CustomComparatorNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/ordering/CustomComparatorNode.java index 568fa1dcaa29..dc31e8b9f741 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/ordering/CustomComparatorNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/ordering/CustomComparatorNode.java @@ -4,8 +4,8 @@ import com.oracle.truffle.api.dsl.GenerateUncached; import com.oracle.truffle.api.dsl.Specialization; import com.oracle.truffle.api.nodes.Node; -import org.enso.interpreter.node.callable.InvokeCallableNode.ArgumentsExecutionEnvironment; -import org.enso.interpreter.node.callable.InvokeCallableNode.DefaultsExecutionEnvironment; +import org.enso.interpreter.node.callable.InvokeCallableNode.ArgumentsExecutionMode; +import org.enso.interpreter.node.callable.InvokeCallableNode.DefaultsExecutionMode; import org.enso.interpreter.node.callable.InvokeConversionNode; import org.enso.interpreter.runtime.EnsoContext; import org.enso.interpreter.runtime.callable.UnresolvedConversion; @@ -59,6 +59,6 @@ static InvokeConversionNode buildConvertionNode() { argSchema[0] = new CallArgumentInfo(); argSchema[1] = new CallArgumentInfo(); - return InvokeConversionNode.build(argSchema, DefaultsExecutionEnvironment.EXECUTE, ArgumentsExecutionEnvironment.EXECUTE, 1); + return InvokeConversionNode.build(argSchema, DefaultsExecutionMode.EXECUTE, ArgumentsExecutionMode.EXECUTE, 1); } } diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/ordering/HashCallbackNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/ordering/HashCallbackNode.java index d3349b6c47a2..ad5f104b8009 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/ordering/HashCallbackNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/ordering/HashCallbackNode.java @@ -8,8 +8,8 @@ import com.oracle.truffle.api.interop.UnsupportedMessageException; import com.oracle.truffle.api.library.CachedLibrary; import com.oracle.truffle.api.nodes.Node; -import org.enso.interpreter.node.callable.InvokeCallableNode.ArgumentsExecutionEnvironment; -import org.enso.interpreter.node.callable.InvokeCallableNode.DefaultsExecutionEnvironment; +import org.enso.interpreter.node.callable.InvokeCallableNode.ArgumentsExecutionMode; +import org.enso.interpreter.node.callable.InvokeCallableNode.DefaultsExecutionMode; import org.enso.interpreter.node.callable.dispatch.InvokeFunctionNode; import org.enso.interpreter.runtime.EnsoContext; import org.enso.interpreter.runtime.callable.argument.CallArgumentInfo; @@ -68,8 +68,8 @@ long hashCallbackCached( static InvokeFunctionNode buildInvokeNodeWithAtomArgument() { return InvokeFunctionNode.build( new CallArgumentInfo[] {new CallArgumentInfo("self"), new CallArgumentInfo("atom")}, - DefaultsExecutionEnvironment.EXECUTE, - ArgumentsExecutionEnvironment.EXECUTE); + DefaultsExecutionMode.EXECUTE, + ArgumentsExecutionMode.EXECUTE); } @TruffleBoundary diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/resource/BracketNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/resource/BracketNode.java index 2ee52c165a99..a6e48e4ba3b2 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/resource/BracketNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/resource/BracketNode.java @@ -36,14 +36,14 @@ public abstract class BracketNode extends Node { private @Child InvokeCallableNode invokeDestructorNode = InvokeCallableNode.build( new CallArgumentInfo[] {new CallArgumentInfo()}, - InvokeCallableNode.DefaultsExecutionEnvironment.EXECUTE, - InvokeCallableNode.ArgumentsExecutionEnvironment.PRE_EXECUTED); + InvokeCallableNode.DefaultsExecutionMode.EXECUTE, + InvokeCallableNode.ArgumentsExecutionMode.PRE_EXECUTED); private @Child InvokeCallableNode invokeActionNode = InvokeCallableNode.build( new CallArgumentInfo[] {new CallArgumentInfo()}, - InvokeCallableNode.DefaultsExecutionEnvironment.EXECUTE, - InvokeCallableNode.ArgumentsExecutionEnvironment.PRE_EXECUTED); + InvokeCallableNode.DefaultsExecutionMode.EXECUTE, + InvokeCallableNode.ArgumentsExecutionMode.PRE_EXECUTED); static BracketNode build() { return BracketNodeGen.create(); diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/resource/WithNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/resource/WithNode.java index ce9f92a32eea..3753ea25bf09 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/resource/WithNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/resource/WithNode.java @@ -21,8 +21,8 @@ public abstract class WithNode extends Node { private @Child InvokeCallableNode invokeCallableNode = InvokeCallableNode.build( new CallArgumentInfo[] {new CallArgumentInfo()}, - InvokeCallableNode.DefaultsExecutionEnvironment.EXECUTE, - InvokeCallableNode.ArgumentsExecutionEnvironment.PRE_EXECUTED); + InvokeCallableNode.DefaultsExecutionMode.EXECUTE, + InvokeCallableNode.ArgumentsExecutionMode.PRE_EXECUTED); static WithNode build() { return WithNodeGen.create(); diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/runtime/NoInlineWithArgNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/runtime/NoInlineWithArgNode.java index e4789db37ff0..f7d0467fff72 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/runtime/NoInlineWithArgNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/runtime/NoInlineWithArgNode.java @@ -23,8 +23,8 @@ public class NoInlineWithArgNode extends Node { invokeCallableNode = InvokeCallableNode.build( new CallArgumentInfo[] {new CallArgumentInfo()}, - InvokeCallableNode.DefaultsExecutionEnvironment.EXECUTE, - InvokeCallableNode.ArgumentsExecutionEnvironment.EXECUTE); + InvokeCallableNode.DefaultsExecutionMode.EXECUTE, + InvokeCallableNode.ArgumentsExecutionMode.EXECUTE); invokeCallableNode.setTailStatus(TailStatus.NOT_TAIL); } diff --git a/engine/runtime/src/main/java/org/enso/interpreter/runtime/callable/argument/ArgumentDefinition.java b/engine/runtime/src/main/java/org/enso/interpreter/runtime/callable/argument/ArgumentDefinition.java index 02ea9f349c27..356d0708c603 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/runtime/callable/argument/ArgumentDefinition.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/runtime/callable/argument/ArgumentDefinition.java @@ -7,7 +7,7 @@ public final class ArgumentDefinition { /** Represents the mode of passing this argument to the function. */ - public enum ExecutionEnvironment { + public enum ExecutionMode { /** Argument should be passed fully executed. */ EXECUTE, /** Argument should be passed suspended, as a thunk. */ @@ -33,10 +33,10 @@ public boolean isSuspended() { * * @param position the position of the argument at the definition site * @param name the name of the argument - * @param ExecutionEnvironment the execution mode for this argument + * @param executionMode the execution mode for this argument */ - public ArgumentDefinition(int position, String name, ExecutionEnvironment ExecutionEnvironment) { - this(position, name, null, ExecutionEnvironment); + public ArgumentDefinition(int position, String name, ExecutionMode executionMode) { + this(position, name, null, executionMode); } /** @@ -45,14 +45,14 @@ public ArgumentDefinition(int position, String name, ExecutionEnvironment Execut * @param position the position of the argument at the definition site * @param name the name of the argument * @param defaultValue the default value of the argument - * @param ExecutionEnvironment the execution mode for this argument + * @param executionMode the execution mode for this argument */ public ArgumentDefinition( - int position, String name, ExpressionNode defaultValue, ExecutionEnvironment ExecutionEnvironment) { + int position, String name, ExpressionNode defaultValue, ExecutionMode executionMode) { this.position = position; this.name = name; this.defaultValue = Optional.ofNullable(defaultValue); - this.isSuspended = ExecutionEnvironment.isSuspended(); + this.isSuspended = executionMode.isSuspended(); } /** diff --git a/engine/runtime/src/main/java/org/enso/interpreter/runtime/callable/atom/AtomConstructor.java b/engine/runtime/src/main/java/org/enso/interpreter/runtime/callable/atom/AtomConstructor.java index 1f8ffbcbbe82..13886479f87c 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/runtime/callable/atom/AtomConstructor.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/runtime/callable/atom/AtomConstructor.java @@ -175,7 +175,7 @@ private void generateQualifiedAccessor() { callTarget, null, new FunctionSchema( - new ArgumentDefinition(0, "self", ArgumentDefinition.ExecutionEnvironment.EXECUTE))); + new ArgumentDefinition(0, "self", ArgumentDefinition.ExecutionMode.EXECUTE))); definitionScope.registerMethod(type.getEigentype(), this.name, function); } diff --git a/engine/runtime/src/main/java/org/enso/interpreter/runtime/callable/atom/unboxing/SuspendedFieldGetterNode.java b/engine/runtime/src/main/java/org/enso/interpreter/runtime/callable/atom/unboxing/SuspendedFieldGetterNode.java index dbec535fc5ed..5760f8515892 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/runtime/callable/atom/unboxing/SuspendedFieldGetterNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/runtime/callable/atom/unboxing/SuspendedFieldGetterNode.java @@ -22,7 +22,7 @@ final class SuspendedFieldGetterNode extends UnboxingAtom.FieldGetterNode { private UnboxingAtom.FieldGetterNode get; @Node.Child private InvokeFunctionNode invoke = InvokeFunctionNode.build( - new CallArgumentInfo[0], InvokeCallableNode.DefaultsExecutionEnvironment.EXECUTE, InvokeCallableNode.ArgumentsExecutionEnvironment.EXECUTE + new CallArgumentInfo[0], InvokeCallableNode.DefaultsExecutionMode.EXECUTE, InvokeCallableNode.ArgumentsExecutionMode.EXECUTE ); private SuspendedFieldGetterNode(UnboxingAtom.FieldGetterNode get, UnboxingAtom.FieldSetterNode set) { diff --git a/engine/runtime/src/main/java/org/enso/interpreter/runtime/callable/function/FunctionSchema.java b/engine/runtime/src/main/java/org/enso/interpreter/runtime/callable/function/FunctionSchema.java index c2b15523d06b..67a898481752 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/runtime/callable/function/FunctionSchema.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/runtime/callable/function/FunctionSchema.java @@ -76,7 +76,7 @@ public FunctionSchema( this.hasAnyPreApplied = hasAnyPreApplied; this.hasOversaturatedArguments = this.oversaturatedArguments.length > 0; - this.isFullyApplied = isFullyApplied(InvokeCallableNode.DefaultsExecutionEnvironment.EXECUTE); + this.isFullyApplied = isFullyApplied(InvokeCallableNode.DefaultsExecutionMode.EXECUTE); } /** @@ -242,14 +242,14 @@ public Annotation getAnnotation(String name) { /** * Checks whether the function is already fully applied. * - * @param defaultsExecutionEnvironment should defaulted arguments be taken as applied or not. + * @param defaultsExecutionMode should defaulted arguments be taken as applied or not. * @return whether or not the function is fully applied. */ @CompilerDirectives.TruffleBoundary - public boolean isFullyApplied(InvokeCallableNode.DefaultsExecutionEnvironment defaultsExecutionEnvironment) { + public boolean isFullyApplied(InvokeCallableNode.DefaultsExecutionMode defaultsExecutionMode) { boolean functionIsFullyApplied = true; for (int i = 0; i < getArgumentsCount(); i++) { - boolean hasValidDefault = hasDefaultAt(i) && !defaultsExecutionEnvironment.isIgnore(); + boolean hasValidDefault = hasDefaultAt(i) && !defaultsExecutionMode.isIgnore(); boolean hasPreappliedArg = hasPreAppliedAt(i); if (!(hasValidDefault || hasPreappliedArg)) { diff --git a/engine/runtime/src/main/java/org/enso/interpreter/runtime/data/Type.java b/engine/runtime/src/main/java/org/enso/interpreter/runtime/data/Type.java index dd87e81fdb0c..fb9d4b2f580f 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/runtime/data/Type.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/runtime/data/Type.java @@ -71,7 +71,7 @@ private void generateQualifiedAccessor() { node.getCallTarget(), null, new FunctionSchema( - new ArgumentDefinition(0, "this", ArgumentDefinition.ExecutionEnvironment.EXECUTE))); + new ArgumentDefinition(0, "this", ArgumentDefinition.ExecutionMode.EXECUTE))); definitionScope.registerMethod(definitionScope.getAssociatedType(), this.name, function); } @@ -168,7 +168,7 @@ public void generateGetters(EnsoLanguage language) { new ArgumentDefinition( 0, Constants.Names.SELF_ARGUMENT, - ArgumentDefinition.ExecutionEnvironment.EXECUTE))); + ArgumentDefinition.ExecutionMode.EXECUTE))); definitionScope.registerMethod(this, name, f); }); } diff --git a/engine/runtime/src/main/java/org/enso/interpreter/runtime/error/PanicException.java b/engine/runtime/src/main/java/org/enso/interpreter/runtime/error/PanicException.java index d42e9e014261..f74cd6947bff 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/runtime/error/PanicException.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/runtime/error/PanicException.java @@ -11,8 +11,8 @@ import com.oracle.truffle.api.source.SourceSection; import org.enso.interpreter.node.BaseNode.TailStatus; import org.enso.interpreter.node.callable.IndirectInvokeMethodNode; -import org.enso.interpreter.node.callable.InvokeCallableNode.ArgumentsExecutionEnvironment; -import org.enso.interpreter.node.callable.InvokeCallableNode.DefaultsExecutionEnvironment; +import org.enso.interpreter.node.callable.InvokeCallableNode.ArgumentsExecutionMode; +import org.enso.interpreter.node.callable.InvokeCallableNode.DefaultsExecutionMode; import org.enso.interpreter.node.expression.builtin.text.util.TypeToDisplayTextNode; import org.enso.interpreter.node.expression.builtin.text.util.TypeToDisplayTextNodeGen; import org.enso.interpreter.runtime.EnsoContext; @@ -107,8 +107,8 @@ Object getExceptionMessage( payload, new Object[] {payload}, new CallArgumentInfo[] {new CallArgumentInfo("self")}, - DefaultsExecutionEnvironment.EXECUTE, - ArgumentsExecutionEnvironment.EXECUTE, + DefaultsExecutionMode.EXECUTE, + ArgumentsExecutionMode.EXECUTE, TailStatus.NOT_TAIL, 0); try { diff --git a/engine/runtime/src/main/scala/org/enso/compiler/codegen/IrToTruffle.scala b/engine/runtime/src/main/scala/org/enso/compiler/codegen/IrToTruffle.scala index 1e0601fc9022..9980a306c2c9 100644 --- a/engine/runtime/src/main/scala/org/enso/compiler/codegen/IrToTruffle.scala +++ b/engine/runtime/src/main/scala/org/enso/compiler/codegen/IrToTruffle.scala @@ -736,7 +736,7 @@ class IrToTruffle( new ArgumentDefinition( 0, Constants.Names.SELF_ARGUMENT, - ArgumentDefinition.ExecutionEnvironment.EXECUTE + ArgumentDefinition.ExecutionMode.EXECUTE ) ) val fun = new RuntimeFunction(body, null, schema) @@ -752,7 +752,7 @@ class IrToTruffle( new ArgumentDefinition( 0, Constants.Names.SELF_ARGUMENT, - ArgumentDefinition.ExecutionEnvironment.EXECUTE + ArgumentDefinition.ExecutionMode.EXECUTE ) ) ) @@ -766,7 +766,7 @@ class IrToTruffle( new ArgumentDefinition( 0, Constants.Names.SELF_ARGUMENT, - ArgumentDefinition.ExecutionEnvironment.EXECUTE + ArgumentDefinition.ExecutionMode.EXECUTE ) ) ) @@ -1840,10 +1840,10 @@ class IrToTruffle( callArgs.append(arg) } - val defaultsExecutionEnvironment = if (hasDefaultsSuspended) { - InvokeCallableNode.DefaultsExecutionEnvironment.IGNORE + val defaultsExecutionMode = if (hasDefaultsSuspended) { + InvokeCallableNode.DefaultsExecutionMode.IGNORE } else { - InvokeCallableNode.DefaultsExecutionEnvironment.EXECUTE + InvokeCallableNode.DefaultsExecutionMode.EXECUTE } val appNode = application.getMetadata(ApplicationSaturation) match { @@ -1855,7 +1855,7 @@ class IrToTruffle( ApplicationNode.build( this.run(fn, subjectToInstrumentation), callArgs.toArray, - defaultsExecutionEnvironment + defaultsExecutionMode ) } @@ -2032,17 +2032,17 @@ class IrToTruffle( defaultExpression } - val ExecutionEnvironment = if (arg.suspended) { - ArgumentDefinition.ExecutionEnvironment.PASS_THUNK + val executionMode = if (arg.suspended) { + ArgumentDefinition.ExecutionMode.PASS_THUNK } else { - ArgumentDefinition.ExecutionEnvironment.EXECUTE + ArgumentDefinition.ExecutionMode.EXECUTE } new ArgumentDefinition( position, arg.name.name, defaultedValue, - ExecutionEnvironment + executionMode ) } } diff --git a/lib/scala/interpreter-dsl/src/main/java/org/enso/interpreter/dsl/MethodProcessor.java b/lib/scala/interpreter-dsl/src/main/java/org/enso/interpreter/dsl/MethodProcessor.java index 09fdbf1c720b..734a644484ee 100644 --- a/lib/scala/interpreter-dsl/src/main/java/org/enso/interpreter/dsl/MethodProcessor.java +++ b/lib/scala/interpreter-dsl/src/main/java/org/enso/interpreter/dsl/MethodProcessor.java @@ -333,19 +333,19 @@ private List generateMakeFunctionArgs(boolean staticInstance, List argumentDefs = new ArrayList<>(); int staticPrefix = 0; if (staticInstance) { - argumentDefs.add(" new ArgumentDefinition(0, \"selfStatic\", ArgumentDefinition.ExecutionEnvironment.EXECUTE)"); + argumentDefs.add(" new ArgumentDefinition(0, \"selfStatic\", ArgumentDefinition.ExecutionMode.EXECUTE)"); staticPrefix = 1; } for (MethodDefinition.ArgumentDefinition arg : args) { if (arg.isPositional()) { - String ExecutionEnvironment = arg.isSuspended() ? "PASS_THUNK" : "EXECUTE"; + String executionMode = arg.isSuspended() ? "PASS_THUNK" : "EXECUTE"; argumentDefs.add( " new ArgumentDefinition(" + (staticPrefix + arg.getPosition()) + ", \"" + arg.getName() - + "\", ArgumentDefinition.ExecutionEnvironment." - + ExecutionEnvironment + + "\", ArgumentDefinition.ExecutionMode." + + executionMode + ")"); } } From 11e293c47674e49527ff1a76e57ef75c1d8f1129 Mon Sep 17 00:00:00 2001 From: Michael Mauderer Date: Tue, 18 Apr 2023 23:39:13 +0100 Subject: [PATCH 10/23] Changelog. --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e00e9db3f06c..e3ef7747e20e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -132,6 +132,8 @@ quickly understand each button's function. - [File associations are created on Windows and macOS][6077]. This allows opening Enso files by double-clicking them in the file explorer. +- - [The IDE UI element for selecting the execution mode of the + project is now sending messages to the backend.][6341]. #### EnsoGL (rendering engine) @@ -194,6 +196,7 @@ [5895]: https://github.com/enso-org/enso/pull/6130 [6035]: https://github.com/enso-org/enso/pull/6035 [6097]: https://github.com/enso-org/enso/pull/6097 +[6097]: https://github.com/enso-org/enso/pull/6341 #### Enso Standard Library From 40f2bb77913d1eecb4156133704ac616c39695a4 Mon Sep 17 00:00:00 2001 From: Michael Mauderer Date: Fri, 21 Apr 2023 10:33:01 +0100 Subject: [PATCH 11/23] Review feedback. --- .../src/language_server/types.rs | 6 ++-- app/gui/src/controller/graph/executed.rs | 2 +- app/gui/src/model/execution_context.rs | 5 +++- app/gui/src/model/execution_context/plain.rs | 5 +++- .../model/execution_context/synchronized.rs | 14 +++++++--- app/gui/src/presenter/project.rs | 8 +++--- .../graph-editor/src/execution_environment.rs | 28 +++++++++++-------- app/gui/view/graph-editor/src/shortcuts.rs | 3 ++ 8 files changed, 45 insertions(+), 26 deletions(-) diff --git a/app/gui/controller/engine-protocol/src/language_server/types.rs b/app/gui/controller/engine-protocol/src/language_server/types.rs index 05b0e0eeee64..aa890c766af8 100644 --- a/app/gui/controller/engine-protocol/src/language_server/types.rs +++ b/app/gui/controller/engine-protocol/src/language_server/types.rs @@ -1201,9 +1201,9 @@ impl TryFrom<&str> for ExecutionEnvironment { type Error = (); fn try_from(value: &str) -> core::result::Result { - match value { - "design" | "Design" => Ok(ExecutionEnvironment::Design), - "live" | "Live" => Ok(ExecutionEnvironment::Live), + match value.to_lowercase().as_str() { + "design" => Ok(ExecutionEnvironment::Design), + "live" => Ok(ExecutionEnvironment::Live), _ => Err(()), } } diff --git a/app/gui/src/controller/graph/executed.rs b/app/gui/src/controller/graph/executed.rs index ddaf0feabef2..996aaf9ad5e2 100644 --- a/app/gui/src/controller/graph/executed.rs +++ b/app/gui/src/controller/graph/executed.rs @@ -322,7 +322,7 @@ impl Handle { /// Set the execution environment. pub async fn set_mode(&self, mode: ExecutionEnvironment) -> FallibleResult { - self.execution_ctx.set_mode(mode).await?; + self.execution_ctx.set_execution_environment(mode).await?; Ok(()) } } diff --git a/app/gui/src/model/execution_context.rs b/app/gui/src/model/execution_context.rs index 23c20dea2c53..bb8b1ece5a84 100644 --- a/app/gui/src/model/execution_context.rs +++ b/app/gui/src/model/execution_context.rs @@ -507,7 +507,10 @@ pub trait API: Debug { /// Set the execution environment of the context. #[allow(clippy::needless_lifetimes)] - fn set_mode<'a>(&'a self, mode: ExecutionEnvironment) -> BoxFuture<'a, FallibleResult>; + fn set_execution_environment<'a>( + &'a self, + mode: ExecutionEnvironment, + ) -> BoxFuture<'a, FallibleResult>; } // Note: Needless lifetimes diff --git a/app/gui/src/model/execution_context/plain.rs b/app/gui/src/model/execution_context/plain.rs index 85435a169004..f8542deaf7c8 100644 --- a/app/gui/src/model/execution_context/plain.rs +++ b/app/gui/src/model/execution_context/plain.rs @@ -279,7 +279,10 @@ impl model::execution_context::API for ExecutionContext { }); } - fn set_mode(&self, environment: ExecutionEnvironment) -> BoxFuture { + fn set_execution_environment( + &self, + environment: ExecutionEnvironment, + ) -> BoxFuture { info!("Setting execution environment to {environment:?}."); self.execution_environment.set(environment); futures::future::ready(Ok(())).boxed_local() diff --git a/app/gui/src/model/execution_context/synchronized.rs b/app/gui/src/model/execution_context/synchronized.rs index 16fbcc27c16f..f055bd71ab28 100644 --- a/app/gui/src/model/execution_context/synchronized.rs +++ b/app/gui/src/model/execution_context/synchronized.rs @@ -314,11 +314,17 @@ impl model::execution_context::API for ExecutionContext { self.model.rename_method_pointers(old_project_name, new_project_name); } - fn set_mode(&self, mode: ExecutionEnvironment) -> BoxFuture { - self.model.execution_environment.set(mode); + fn set_execution_environment( + &self, + execution_environment: ExecutionEnvironment, + ) -> BoxFuture { + self.model.execution_environment.set(execution_environment); async move { - info!("Setting execution environment to {mode:?}."); - self.language_server.client.set_execution_environment(&self.id, &mode).await?; + info!("Setting execution environment to {execution_environment:?}."); + self.language_server + .client + .set_execution_environment(&self.id, &execution_environment) + .await?; Ok(()) } .boxed_local() diff --git a/app/gui/src/presenter/project.rs b/app/gui/src/presenter/project.rs index e86e85408f34..d1083774a56d 100644 --- a/app/gui/src/presenter/project.rs +++ b/app/gui/src/presenter/project.rs @@ -282,17 +282,17 @@ impl Model { fn execution_environment_changed( &self, - mode: &ide_view::execution_environment_selector::ExecutionEnvironment, + execution_environment: &ide_view::execution_environment_selector::ExecutionEnvironment, ) { - if let Ok(mode) = mode.as_str().try_into() { + if let Ok(execution_environment) = execution_environment.as_str().try_into() { let graph_controller = self.graph_controller.clone_ref(); executor::global::spawn(async move { - if let Err(err) = graph_controller.set_mode(mode).await { + if let Err(err) = graph_controller.set_mode(execution_environment).await { error!("Error setting execution environment: {err}"); } }); } else { - error!("Invalid execution mode: {mode:?}"); + error!("Invalid execution environment: {execution_environment:?}"); } } } diff --git a/app/gui/view/graph-editor/src/execution_environment.rs b/app/gui/view/graph-editor/src/execution_environment.rs index ecaf7175dd3f..bf6d17fda707 100644 --- a/app/gui/view/graph-editor/src/execution_environment.rs +++ b/app/gui/view/graph-editor/src/execution_environment.rs @@ -25,39 +25,43 @@ pub fn init_frp(frp: &Frp, model: &GraphEditorModelWithNetwork) { let out = &frp.private.output; let network = frp.network(); let inputs = &model.frp; - let execution_environment_selector = &model.execution_environment_selector; + let selector = &model.execution_environment_selector; frp::extend! { network // === Execution Environment Changes === - execution_environment_selector.set_available_execution_environments <+ frp.set_available_execution_environments; - selected_execution_environment <- frp.set_execution_environment.map(|env| (*env).into()); - execution_environment_state <- all(out.execution_environment,frp.set_available_execution_environments); + selector.set_available_execution_environments <+ frp.set_available_execution_environments; + selected_environment <- frp.set_execution_environment.map(|env| (*env).into()); + environment_state + <- all(out.execution_environment,frp.set_available_execution_environments); - execution_environment_toggled <- execution_environment_state.sample(&frp.toggle_execution_environment); - toggled_execution_environment <- execution_environment_toggled.map(|(mode,available)| get_next_execution_environment(mode,available)).unwrap(); + environment_toggled <- environment_state.sample(&frp.toggle_execution_environment); + toggled_execution_environment <- environment_toggled.map(|(mode,available)| + get_next_execution_environment(mode,available)).unwrap(); - external_execution_environment_update <- any(selected_execution_environment,toggled_execution_environment); - execution_environment_selector.set_execution_environment <+ external_execution_environment_update; + external_update <- any(selected_environment,toggled_execution_environment); + selector.set_execution_environment <+ external_update; - execution_environment_update <- any(execution_environment_selector.selected_execution_environment,external_execution_environment_update); + execution_environment_update + <- any(selector.selected_execution_environment,external_update); out.execution_environment <+ execution_environment_update; - out.execution_environment_play_button_pressed <+ execution_environment_selector.play_press; + out.execution_environment_play_button_pressed <+ selector.play_press; // === Layout === init <- source::<()>(); - size_update <- all(init,execution_environment_selector.size,inputs.space_for_window_buttons); + size_update <- all(init,selector.size,inputs.space_for_window_buttons); eval size_update ([model]((_,size,gap_size)) { let y_offset = MACOS_TRAFFIC_LIGHTS_VERTICAL_CENTER; let traffic_light_width = traffic_lights_gap_width(); let execution_environment_selector_x = gap_size.x + traffic_light_width; model.execution_environment_selector.set_x(execution_environment_selector_x); - let breadcrumb_gap_width = execution_environment_selector_x + size.x + TOP_BAR_ITEM_MARGIN; + let breadcrumb_gap_width = + execution_environment_selector_x + size.x + TOP_BAR_ITEM_MARGIN; model.breadcrumbs.gap_width(breadcrumb_gap_width); model.execution_environment_selector.set_y(y_offset + size.y / 2.0); diff --git a/app/gui/view/graph-editor/src/shortcuts.rs b/app/gui/view/graph-editor/src/shortcuts.rs index 9f35d40f3ad2..62b6d4302206 100644 --- a/app/gui/view/graph-editor/src/shortcuts.rs +++ b/app/gui/view/graph-editor/src/shortcuts.rs @@ -3,6 +3,9 @@ use ensogl::application::shortcut::ActionType::*; +// ======================================= +// === Shortcuts for the graph editor. === +// ======================================= /// The list of all shortcuts used in the graph editor. pub const SHORTCUTS: &[(ensogl::application::shortcut::ActionType, &str, &str, &str)] = &[ From 74a692b5d79e76a9aadad6a2ca9552d72d619d88 Mon Sep 17 00:00:00 2001 From: Michael Mauderer Date: Fri, 21 Apr 2023 10:45:20 +0100 Subject: [PATCH 12/23] Removed another instance of "mode" --- app/gui/src/controller/graph/executed.rs | 7 +++++-- app/gui/src/model/execution_context.rs | 2 +- app/gui/src/presenter/project.rs | 4 +++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/app/gui/src/controller/graph/executed.rs b/app/gui/src/controller/graph/executed.rs index 996aaf9ad5e2..b8dd23585877 100644 --- a/app/gui/src/controller/graph/executed.rs +++ b/app/gui/src/controller/graph/executed.rs @@ -321,8 +321,11 @@ impl Handle { } /// Set the execution environment. - pub async fn set_mode(&self, mode: ExecutionEnvironment) -> FallibleResult { - self.execution_ctx.set_execution_environment(mode).await?; + pub async fn set_execution_environment( + &self, + execution_environment: ExecutionEnvironment, + ) -> FallibleResult { + self.execution_ctx.set_execution_environment(execution_environment).await?; Ok(()) } } diff --git a/app/gui/src/model/execution_context.rs b/app/gui/src/model/execution_context.rs index bb8b1ece5a84..7f3d4b3d2f4c 100644 --- a/app/gui/src/model/execution_context.rs +++ b/app/gui/src/model/execution_context.rs @@ -509,7 +509,7 @@ pub trait API: Debug { #[allow(clippy::needless_lifetimes)] fn set_execution_environment<'a>( &'a self, - mode: ExecutionEnvironment, + execution_environment: ExecutionEnvironment, ) -> BoxFuture<'a, FallibleResult>; } diff --git a/app/gui/src/presenter/project.rs b/app/gui/src/presenter/project.rs index d1083774a56d..6e3b163c024e 100644 --- a/app/gui/src/presenter/project.rs +++ b/app/gui/src/presenter/project.rs @@ -287,7 +287,9 @@ impl Model { if let Ok(execution_environment) = execution_environment.as_str().try_into() { let graph_controller = self.graph_controller.clone_ref(); executor::global::spawn(async move { - if let Err(err) = graph_controller.set_mode(execution_environment).await { + if let Err(err) = + graph_controller.set_execution_environment(execution_environment).await + { error!("Error setting execution environment: {err}"); } }); From bdf8a5a075771653968607395bb5c29c73f2c6d8 Mon Sep 17 00:00:00 2001 From: Michael Mauderer Date: Fri, 21 Apr 2023 10:58:42 +0100 Subject: [PATCH 13/23] Unify dummy data use. --- .../examples/execution-environment-dropdown/src/lib.rs | 9 +++------ app/gui/view/examples/interface/Cargo.toml | 1 + app/gui/view/examples/interface/src/lib.rs | 6 ++---- app/gui/view/execution-environment-selector/src/lib.rs | 5 +++++ 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/app/gui/view/examples/execution-environment-dropdown/src/lib.rs b/app/gui/view/examples/execution-environment-dropdown/src/lib.rs index 46b80b614cb4..36cc5c0ccc78 100644 --- a/app/gui/view/examples/execution-environment-dropdown/src/lib.rs +++ b/app/gui/view/examples/execution-environment-dropdown/src/lib.rs @@ -19,18 +19,14 @@ use ensogl::prelude::*; use ensogl::animation; use ensogl::application::Application; use ensogl_text_msdf::run_once_initialized; +use execution_environment_selector::make_dummy_execution_environments; use ide_view_execution_environment_selector as execution_environment_selector; -use ide_view_execution_environment_selector::ExecutionEnvironments; // ====================== // === Initialisation === // ====================== -fn make_entries() -> ExecutionEnvironments { - Rc::new(vec!["Design".to_string().into(), "Live".to_string().into()]) -} - fn init(app: &Application) { let app = app.clone_ref(); let world = &app.display; @@ -39,7 +35,8 @@ fn init(app: &Application) { let execution_environment_selector = execution_environment_selector::ExecutionEnvironmentSelector::new(&app); world.add_child(&execution_environment_selector); - execution_environment_selector.set_available_execution_environments(make_entries()); + execution_environment_selector + .set_available_execution_environments(make_dummy_execution_environments()); world .on diff --git a/app/gui/view/examples/interface/Cargo.toml b/app/gui/view/examples/interface/Cargo.toml index bb5d53a12b24..5a7ffe41c16b 100644 --- a/app/gui/view/examples/interface/Cargo.toml +++ b/app/gui/view/examples/interface/Cargo.toml @@ -20,6 +20,7 @@ span-tree = { path = "../../../language/span-tree" } uuid = { version = "0.8", features = ["v4", "wasm-bindgen"] } wasm-bindgen = { workspace = true } + # Stop wasm-pack from running wasm-opt, because we run it from our build scripts in order to customize options. [package.metadata.wasm-pack.profile.release] wasm-opt = false diff --git a/app/gui/view/examples/interface/src/lib.rs b/app/gui/view/examples/interface/src/lib.rs index d378af009009..ccaa4d31ef24 100644 --- a/app/gui/view/examples/interface/src/lib.rs +++ b/app/gui/view/examples/interface/src/lib.rs @@ -25,6 +25,7 @@ use ensogl::gui::text; use ensogl::system::web; use ensogl_hardcoded_theme as theme; use ensogl_text_msdf::run_once_initialized; +use ide_view::execution_environment_selector::make_dummy_execution_environments; use ide_view::graph_editor; use ide_view::graph_editor::component::node::vcs; use ide_view::graph_editor::component::node::Expression; @@ -256,10 +257,7 @@ fn init(app: &Application) { // === Execution Modes === - graph_editor.set_available_execution_environments(vec![ - "Live".to_string().into(), - "Design".to_string().into(), - ]); + graph_editor.set_available_execution_environments(make_dummy_execution_environments()); // === Rendering === diff --git a/app/gui/view/execution-environment-selector/src/lib.rs b/app/gui/view/execution-environment-selector/src/lib.rs index ecd7b8c85c8d..a0a1bd267309 100644 --- a/app/gui/view/execution-environment-selector/src/lib.rs +++ b/app/gui/view/execution-environment-selector/src/lib.rs @@ -94,6 +94,11 @@ pub type ExecutionEnvironment = ImString; /// A list of execution environments. pub type ExecutionEnvironments = Rc>; +/// Provide a dummy list of execution environments. Used for testing and demo scenes. +pub fn make_dummy_execution_environments() -> ExecutionEnvironments { + Rc::new(vec!["Design".to_string().into(), "Live".to_string().into()]) +} + ensogl::define_endpoints_2! { Input { set_available_execution_environments (ExecutionEnvironments), From 6bb1dfdd25fd8697310df8089d406aba830cdc41 Mon Sep 17 00:00:00 2001 From: Michael Mauderer Date: Fri, 21 Apr 2023 12:04:58 +0100 Subject: [PATCH 14/23] Fix merge issues. --- app/gui/src/presenter/graph.rs | 8 - .../execution-environment-dropdown/src/lib.rs | 3 - .../execution-environment-selector/src/lib.rs | 9 +- .../src/play_button.rs | 182 ++++++++++++++++++ .../src/play_button.rs | 182 ++++++++++++++++++ 5 files changed, 366 insertions(+), 18 deletions(-) create mode 100644 app/gui/view/execution-mode-selector/src/play_button.rs diff --git a/app/gui/src/presenter/graph.rs b/app/gui/src/presenter/graph.rs index 99d7a4c1d99e..1d4a58fb4158 100644 --- a/app/gui/src/presenter/graph.rs +++ b/app/gui/src/presenter/graph.rs @@ -718,14 +718,6 @@ impl Graph { })); - // === Execution Environment === - - // TODO(#5930): Delete me once we synchronise the execution environment with the - // language server. - view.set_execution_environment <+ view.toggle_execution_environment.map( - f_!(model.toggle_execution_environment())); - - // === Refreshing Nodes === remove_node <= update_data.map(|update| update.remove_nodes()); diff --git a/app/gui/view/examples/execution-environment-dropdown/src/lib.rs b/app/gui/view/examples/execution-environment-dropdown/src/lib.rs index a89cbfd1c859..17c56b1d6ce8 100644 --- a/app/gui/view/examples/execution-environment-dropdown/src/lib.rs +++ b/app/gui/view/examples/execution-environment-dropdown/src/lib.rs @@ -27,9 +27,6 @@ use ide_view_execution_environment_selector as execution_environment_selector; // === Initialisation === // ====================== -fn make_entries() -> execution_mode_selector::ExecutionModes { - Rc::new(vec!["design".to_string(), "live".to_string()]) -} fn init(app: &Application) { let app = app.clone_ref(); diff --git a/app/gui/view/execution-environment-selector/src/lib.rs b/app/gui/view/execution-environment-selector/src/lib.rs index eaa280e0753a..5928a5f59632 100644 --- a/app/gui/view/execution-environment-selector/src/lib.rs +++ b/app/gui/view/execution-environment-selector/src/lib.rs @@ -264,14 +264,9 @@ impl component::Frp for Frp { output.selected_execution_environment <+ selected_entry; eval selected_entry ([model] (execution_mode) { - // TODO(#5930): Revisit when connecting with externally set execution mode - let play_button_visibility = match execution_mode.as_str() { + let play_button_visibility = match execution_mode.to_lowercase().as_str() { "design" => true, - "live" => false, - _ => { - error!("Play button: invalid execution mode"); - false - } + _ => false, }; model.set_play_button_visibility(play_button_visibility); }); diff --git a/app/gui/view/execution-environment-selector/src/play_button.rs b/app/gui/view/execution-environment-selector/src/play_button.rs index e69de29bb2d1..85d3ae0b5eb4 100644 --- a/app/gui/view/execution-environment-selector/src/play_button.rs +++ b/app/gui/view/execution-environment-selector/src/play_button.rs @@ -0,0 +1,182 @@ +use enso_prelude::*; +use ensogl::prelude::*; + +use enso_frp as frp; +use ensogl::application::Application; +use ensogl::control::io::mouse; +use ensogl::display; +use ensogl::display::shape::StyleWatchFrp; +use ensogl_derive_theme::FromTheme; +use ensogl_gui_component::component; +use ensogl_hardcoded_theme::graph_editor::execution_environment_selector::play_button as theme; + + + +// ============= +// === Style === +// ============== + +#[derive(Debug, Clone, Copy, Default, FromTheme)] +#[base_path = "theme"] +pub struct Style { + triangle_size: f32, + offset: f32, + padding_x: f32, + padding_y: f32, +} + + + +// ============== +// === Shapes === +// ============== + +mod play_icon { + use super::*; + + use std::f32::consts::PI; + + ensogl::shape! { + above = [display::shape::compound::rectangle::shape]; + (style: Style) { + let triangle_size = style.get_number(theme::triangle_size); + let color = style.get_color(theme::color); + let triangle = Triangle(triangle_size, triangle_size).rotate((PI / 2.0).radians()); + let triangle = triangle.fill(color); + let bg_size = Var::canvas_size(); + let bg = Rect(bg_size).fill(INVISIBLE_HOVER_COLOR); + (bg + triangle).into() + } + } +} + +mod spinner_icon { + use super::*; + + use std::f32::consts::FRAC_PI_3; + + ensogl::shape! { + above = [display::shape::compound::rectangle::shape]; + (style: Style) { + let color = style.get_color(theme::spinner::color); + let speed = style.get_number(theme::spinner::speed); + let width = Var::::from("input_size.x"); + let time = Var::::from("input_time"); + let unit = &width / 16.0; + let arc = RoundedArc(&unit * 5.0, (4.0 * FRAC_PI_3).radians(), &unit * 2.0); + let rotated_arc = arc.rotate(time * speed); + rotated_arc.fill(color).into() + } + } +} + + + +// =========== +// === FRP === +// =========== + +ensogl::define_endpoints_2! { + Input { + reset (), + } + Output { + pressed (), + } +} + + + +// ============= +// === Model === +// ============= + +#[derive(Debug, Clone, CloneRef)] +pub struct Model { + display_object: display::object::Instance, + play_icon: play_icon::View, + spinner_icon: spinner_icon::View, +} + +impl Model { + fn update_style(&self, style: &Style) { + let triangle_size = Vector2::new(style.triangle_size, style.triangle_size); + let padding = Vector2::new(style.padding_x, style.padding_y); + let size = triangle_size + 2.0 * padding; + self.play_icon.set_size(size); + self.spinner_icon.set_size(size); + self.play_icon.set_x(-size.x / 2.0 - style.offset); + self.spinner_icon.set_x(-size.x / 2.0 - style.offset); + } + + fn set_playing(&self, playing: bool) { + if playing { + self.display_object.remove_child(&self.play_icon); + self.display_object.add_child(&self.spinner_icon); + } else { + self.display_object.remove_child(&self.spinner_icon); + self.display_object.add_child(&self.play_icon); + } + } +} + +impl display::Object for Model { + fn display_object(&self) -> &display::object::Instance { + &self.display_object + } +} + + + +// =================== +// === Play Button === +// =================== + +impl component::Model for Model { + fn label() -> &'static str { + "PlayButton" + } + + fn new(_app: &Application) -> Self { + let display_object = display::object::Instance::new(); + let play_icon = play_icon::View::new(); + let spinner_icon = spinner_icon::View::new(); + + display_object.add_child(&play_icon); + + Self { display_object, play_icon, spinner_icon } + } +} + +impl component::Frp for Frp { + fn init( + network: &enso_frp::Network, + frp: &::Private, + _app: &Application, + model: &Model, + style_watch: &StyleWatchFrp, + ) { + let play_icon = &model.play_icon; + let input = &frp.input; + let output = &frp.output; + + let style = Style::from_theme(network, style_watch); + + frp::extend! { network + eval style.update ((style) model.update_style(style)); + + eval_ input.reset (model.set_playing(false)); + + let play_icon_mouse_down = play_icon.on_event::(); + output.pressed <+ play_icon_mouse_down.constant(()); + + eval_ output.pressed (model.set_playing(true)); + } + style.init.emit(()); + } +} + +/// A button to execute the workflow in a fully enabled way within the current execution +/// environment. The button should be visible in any execution environment where one or more +/// contexts are disabled. +pub type PlayButton = component::ComponentView; diff --git a/app/gui/view/execution-mode-selector/src/play_button.rs b/app/gui/view/execution-mode-selector/src/play_button.rs new file mode 100644 index 000000000000..406b2e6a6189 --- /dev/null +++ b/app/gui/view/execution-mode-selector/src/play_button.rs @@ -0,0 +1,182 @@ +use enso_prelude::*; +use ensogl::prelude::*; + +use enso_frp as frp; +use ensogl::application::Application; +use ensogl::control::io::mouse; +use ensogl::display; +use ensogl::display::shape::StyleWatchFrp; +use ensogl_derive_theme::FromTheme; +use ensogl_gui_component::component; +use ensogl_hardcoded_theme::graph_editor::execution_mode_selector::play_button as theme; + + + +// ============= +// === Style === +// ============== + +#[derive(Debug, Clone, Copy, Default, FromTheme)] +#[base_path = "theme"] +pub struct Style { + triangle_size: f32, + offset: f32, + padding_x: f32, + padding_y: f32, +} + + + +// ============== +// === Shapes === +// ============== + +mod play_icon { + use super::*; + + use std::f32::consts::PI; + + ensogl::shape! { + above = [display::shape::compound::rectangle::shape]; + (style: Style) { + let triangle_size = style.get_number(theme::triangle_size); + let color = style.get_color(theme::color); + let triangle = Triangle(triangle_size, triangle_size).rotate((PI / 2.0).radians()); + let triangle = triangle.fill(color); + let bg_size = Var::canvas_size(); + let bg = Rect(bg_size).fill(INVISIBLE_HOVER_COLOR); + (bg + triangle).into() + } + } +} + +mod spinner_icon { + use super::*; + + use std::f32::consts::FRAC_PI_3; + + ensogl::shape! { + above = [display::shape::compound::rectangle::shape]; + (style: Style) { + let color = style.get_color(theme::spinner::color); + let speed = style.get_number(theme::spinner::speed); + let width = Var::::from("input_size.x"); + let time = Var::::from("input_time"); + let unit = &width / 16.0; + let arc = RoundedArc(&unit * 5.0, (4.0 * FRAC_PI_3).radians(), &unit * 2.0); + let rotated_arc = arc.rotate(time * speed); + rotated_arc.fill(color).into() + } + } +} + + + +// =========== +// === FRP === +// =========== + +ensogl::define_endpoints_2! { + Input { + reset (), + } + Output { + pressed (), + } +} + + + +// ============= +// === Model === +// ============= + +#[derive(Debug, Clone, CloneRef)] +pub struct Model { + display_object: display::object::Instance, + play_icon: play_icon::View, + spinner_icon: spinner_icon::View, +} + +impl Model { + fn update_style(&self, style: &Style) { + let triangle_size = Vector2::new(style.triangle_size, style.triangle_size); + let padding = Vector2::new(style.padding_x, style.padding_y); + let size = triangle_size + 2.0 * padding; + self.play_icon.set_size(size); + self.spinner_icon.set_size(size); + self.play_icon.set_x(-size.x / 2.0 - style.offset); + self.spinner_icon.set_x(-size.x / 2.0 - style.offset); + } + + fn set_playing(&self, playing: bool) { + if playing { + self.display_object.remove_child(&self.play_icon); + self.display_object.add_child(&self.spinner_icon); + } else { + self.display_object.remove_child(&self.spinner_icon); + self.display_object.add_child(&self.play_icon); + } + } +} + +impl display::Object for Model { + fn display_object(&self) -> &display::object::Instance { + &self.display_object + } +} + + + +// =================== +// === Play Button === +// =================== + +impl component::Model for Model { + fn label() -> &'static str { + "PlayButton" + } + + fn new(_app: &Application) -> Self { + let display_object = display::object::Instance::new(); + let play_icon = play_icon::View::new(); + let spinner_icon = spinner_icon::View::new(); + + display_object.add_child(&play_icon); + + Self { display_object, play_icon, spinner_icon } + } +} + +impl component::Frp for Frp { + fn init( + network: &enso_frp::Network, + frp: &::Private, + _app: &Application, + model: &Model, + style_watch: &StyleWatchFrp, + ) { + let play_icon = &model.play_icon; + let input = &frp.input; + let output = &frp.output; + + let style = Style::from_theme(network, style_watch); + + frp::extend! { network + eval style.update ((style) model.update_style(style)); + + eval_ input.reset (model.set_playing(false)); + + let play_icon_mouse_down = play_icon.on_event::(); + output.pressed <+ play_icon_mouse_down.constant(()); + + eval_ output.pressed (model.set_playing(true)); + } + style.init.emit(()); + } +} + +/// A button to execute the workflow in a fully enabled way within the current execution +/// environment. The button should be visible in any execution environment where one or more +/// contexts are disabled. +pub type PlayButton = component::ComponentView; From 468d25b3727d4bc7fa973d777db8d7c505e9e21f Mon Sep 17 00:00:00 2001 From: Michael Mauderer Date: Fri, 21 Apr 2023 12:07:17 +0100 Subject: [PATCH 15/23] Remove whitespace. --- app/gui/view/graph-editor/src/lib.rs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/app/gui/view/graph-editor/src/lib.rs b/app/gui/view/graph-editor/src/lib.rs index 2a91ae497b56..ca9c646c2f98 100644 --- a/app/gui/view/graph-editor/src/lib.rs +++ b/app/gui/view/graph-editor/src/lib.rs @@ -655,10 +655,6 @@ ensogl::define_endpoints_2! { /// Drop an edge that is being dragged. drop_dragged_edge (), - - - - } Output { From c1ffc83da5b8b8793d35c4091bc741c2a5955318 Mon Sep 17 00:00:00 2001 From: Michael Mauderer Date: Fri, 21 Apr 2023 13:09:27 +0100 Subject: [PATCH 16/23] Restore debug functionality. --- app/gui/src/presenter/graph.rs | 8 ++++++++ app/gui/view/execution-environment-selector/src/lib.rs | 5 +---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/app/gui/src/presenter/graph.rs b/app/gui/src/presenter/graph.rs index 1d4a58fb4158..99d7a4c1d99e 100644 --- a/app/gui/src/presenter/graph.rs +++ b/app/gui/src/presenter/graph.rs @@ -718,6 +718,14 @@ impl Graph { })); + // === Execution Environment === + + // TODO(#5930): Delete me once we synchronise the execution environment with the + // language server. + view.set_execution_environment <+ view.toggle_execution_environment.map( + f_!(model.toggle_execution_environment())); + + // === Refreshing Nodes === remove_node <= update_data.map(|update| update.remove_nodes()); diff --git a/app/gui/view/execution-environment-selector/src/lib.rs b/app/gui/view/execution-environment-selector/src/lib.rs index 5928a5f59632..b896f71da137 100644 --- a/app/gui/view/execution-environment-selector/src/lib.rs +++ b/app/gui/view/execution-environment-selector/src/lib.rs @@ -264,10 +264,7 @@ impl component::Frp for Frp { output.selected_execution_environment <+ selected_entry; eval selected_entry ([model] (execution_mode) { - let play_button_visibility = match execution_mode.to_lowercase().as_str() { - "design" => true, - _ => false, - }; + let play_button_visibility = matches!(execution_mode.to_lowercase().as_str(), "design"); model.set_play_button_visibility(play_button_visibility); }); play_button.reset <+ selected_entry.constant(()); From bad2e6e0c5f7599a74c2e9ed5d2f8c92ec33bb94 Mon Sep 17 00:00:00 2001 From: Michael Mauderer Date: Mon, 24 Apr 2023 10:12:51 +0100 Subject: [PATCH 17/23] Resolve merge conflicts. --- CHANGELOG.md | 4 ++-- .../view/examples/execution-environment-dropdown/src/lib.rs | 1 + app/gui/view/examples/interface/Cargo.toml | 1 - app/gui/view/graph-editor/src/execution_environment.rs | 1 + app/gui/view/graph-editor/src/shortcuts.rs | 1 + 5 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5be487d75fc0..7d4aabc0558f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -132,8 +132,8 @@ quickly understand each button's function. - [File associations are created on Windows and macOS][6077]. This allows opening Enso files by double-clicking them in the file explorer. -- - [The IDE UI element for selecting the execution mode of the - project is now sending messages to the backend.][6341]. +- - [The IDE UI element for selecting the execution mode of the project is now + sending messages to the backend.][6341]. #### EnsoGL (rendering engine) diff --git a/app/gui/view/examples/execution-environment-dropdown/src/lib.rs b/app/gui/view/examples/execution-environment-dropdown/src/lib.rs index 17c56b1d6ce8..c7731b3e871c 100644 --- a/app/gui/view/examples/execution-environment-dropdown/src/lib.rs +++ b/app/gui/view/examples/execution-environment-dropdown/src/lib.rs @@ -23,6 +23,7 @@ use execution_environment_selector::make_dummy_execution_environments; use ide_view_execution_environment_selector as execution_environment_selector; + // ====================== // === Initialisation === // ====================== diff --git a/app/gui/view/examples/interface/Cargo.toml b/app/gui/view/examples/interface/Cargo.toml index 5a7ffe41c16b..bb5d53a12b24 100644 --- a/app/gui/view/examples/interface/Cargo.toml +++ b/app/gui/view/examples/interface/Cargo.toml @@ -20,7 +20,6 @@ span-tree = { path = "../../../language/span-tree" } uuid = { version = "0.8", features = ["v4", "wasm-bindgen"] } wasm-bindgen = { workspace = true } - # Stop wasm-pack from running wasm-opt, because we run it from our build scripts in order to customize options. [package.metadata.wasm-pack.profile.release] wasm-opt = false diff --git a/app/gui/view/graph-editor/src/execution_environment.rs b/app/gui/view/graph-editor/src/execution_environment.rs index bf6d17fda707..f10353b52446 100644 --- a/app/gui/view/graph-editor/src/execution_environment.rs +++ b/app/gui/view/graph-editor/src/execution_environment.rs @@ -7,6 +7,7 @@ use crate::Frp; use ide_view_execution_environment_selector::ExecutionEnvironment; + // ============================= // === Execution Environment === // ============================= diff --git a/app/gui/view/graph-editor/src/shortcuts.rs b/app/gui/view/graph-editor/src/shortcuts.rs index 62b6d4302206..73c5139f9969 100644 --- a/app/gui/view/graph-editor/src/shortcuts.rs +++ b/app/gui/view/graph-editor/src/shortcuts.rs @@ -3,6 +3,7 @@ use ensogl::application::shortcut::ActionType::*; + // ======================================= // === Shortcuts for the graph editor. === // ======================================= From 4588e5766ae2e18e4cc98e94cbb77c06c104e3af Mon Sep 17 00:00:00 2001 From: Michael Mauderer Date: Mon, 24 Apr 2023 10:32:53 +0100 Subject: [PATCH 18/23] Review feedback. --- CHANGELOG.md | 4 ++-- app/gui/src/model/execution_context/plain.rs | 2 +- app/gui/view/execution-environment-selector/src/lib.rs | 4 ++-- app/gui/view/graph-editor/src/lib.rs | 3 ++- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d4aabc0558f..e19cef1f176e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -132,8 +132,8 @@ quickly understand each button's function. - [File associations are created on Windows and macOS][6077]. This allows opening Enso files by double-clicking them in the file explorer. -- - [The IDE UI element for selecting the execution mode of the project is now - sending messages to the backend.][6341]. +- [The IDE UI element for selecting the execution mode of the project is now + sending messages to the backend.][6341]. #### EnsoGL (rendering engine) diff --git a/app/gui/src/model/execution_context/plain.rs b/app/gui/src/model/execution_context/plain.rs index f8542deaf7c8..057ed4a000af 100644 --- a/app/gui/src/model/execution_context/plain.rs +++ b/app/gui/src/model/execution_context/plain.rs @@ -63,7 +63,7 @@ pub struct ExecutionContext { /// Component groups defined in libraries imported into the execution context. pub component_groups: RefCell>>, /// Execution environment of the context. - pub execution_environment: Rc>, + pub execution_environment: Cell, } impl ExecutionContext { diff --git a/app/gui/view/execution-environment-selector/src/lib.rs b/app/gui/view/execution-environment-selector/src/lib.rs index b896f71da137..a43eac6ca09c 100644 --- a/app/gui/view/execution-environment-selector/src/lib.rs +++ b/app/gui/view/execution-environment-selector/src/lib.rs @@ -180,9 +180,9 @@ impl display::Object for Model { -// ============================= +// ==================================== // === ExecutionEnvironmentDropdown === -// ============================= +// ==================================== impl component::Model for Model { fn label() -> &'static str { diff --git a/app/gui/view/graph-editor/src/lib.rs b/app/gui/view/graph-editor/src/lib.rs index 6379c7435f57..1e90e9ad4e48 100644 --- a/app/gui/view/graph-editor/src/lib.rs +++ b/app/gui/view/graph-editor/src/lib.rs @@ -79,6 +79,7 @@ use ensogl_component::text::buffer::selection::Selection; use ensogl_component::tooltip::Tooltip; use ensogl_hardcoded_theme as theme; use ide_view_execution_environment_selector as execution_environment_selector; +use ide_view_execution_environment_selector::ExecutionEnvironmentSelector; // =============== @@ -1795,7 +1796,7 @@ pub struct GraphEditorModel { profiling_button: component::profiling::Button, styles_frp: StyleWatchFrp, selection_controller: selection::Controller, - execution_environment_selector: execution_environment_selector::ExecutionEnvironmentSelector, + execution_environment_selector: ExecutionEnvironmentSelector, } From 7ca79ad94ec0143b352e43035839aa56e091a57d Mon Sep 17 00:00:00 2001 From: Michael Mauderer Date: Tue, 25 Apr 2023 14:26:21 +0100 Subject: [PATCH 19/23] QA feedback. --- app/gui/docs/product/shortcuts.md | 15 ++++++++------- app/gui/src/controller/graph/widget.rs | 2 +- app/gui/src/presenter/project.rs | 19 +++++++++++++------ 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/app/gui/docs/product/shortcuts.md b/app/gui/docs/product/shortcuts.md index 1d7a7edd64e4..d3e552ba3ba1 100644 --- a/app/gui/docs/product/shortcuts.md +++ b/app/gui/docs/product/shortcuts.md @@ -35,7 +35,7 @@ broken and require further investigation. #### General Shortcuts | Shortcut | Action | -| ------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +|---------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | cmd+alt+shift+t | Toggle light/dark application style. Currently doesn't work properly, as the Theme Switcher is not created yet. (https://github.com/enso-org/ide/issues/795) | | ctrl+` | Show Code Editor. Please note that the Code Editor implementation is in a very early stage and you should not use it. Even just openning it can cause errors in the IDE. Do not try using the graph editor while having the code editor tab openned. | | cmd+o | Open project | @@ -50,11 +50,12 @@ broken and require further investigation. | escape | Cancel current action. For example, drop currently dragged connection. | | cmd+shift+t | Terminate the program execution | | cmd+shift+r | Re-execute the program | +| cmd+shift+e | Toggle the execution environment between Live and Design. | #### Navigation | Shortcut | Action | -| ------------------------------------------------ | ------------------------------- | +|--------------------------------------------------|---------------------------------| | Drag gesture (two fingers) | Pan the scene. | | Pinch gesture (two fingers) | Zoom the scene. | | MMB drag | Pan the scene. | @@ -67,14 +68,14 @@ broken and require further investigation. #### Node Layout | Shortcut | Action | -| ------------------------------------------ | ----------------------------------------------------------------- | +|--------------------------------------------|-------------------------------------------------------------------| | LMB drag non-selected node name | Move the node to new position (dragging do not modify selection). | | LMB drag selected node name | Move all selected nodes the node to new positions. | #### Node Selection | Shortcut | Action | -| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------- | +|------------------------------------------------------------------------------------------------|------------------------------------------------------------| | LMB click node name | Deselect all nodes. Select the target node. | | LMB click background | Deselect all nodes. | | :warning: LMB drag background | Select nodes using selection-box. | @@ -93,7 +94,7 @@ broken and require further investigation. #### Node Editing | Shortcut | Action | -| ------------------------------------------------ | ----------------------------------------------------------- | +|--------------------------------------------------|-------------------------------------------------------------| | tab | Open Component Browser to create a new node . | | backspace or delete | Remove selected nodes. | | cmd+g | Collapse (group) selected nodes. | @@ -106,7 +107,7 @@ broken and require further investigation. #### Visualization | Shortcut | Action | -| ----------------------------------------- | ------------------------------------------------------------- | +|-------------------------------------------|---------------------------------------------------------------| | space | Toggle visualization visibility of the selected node. | | space hold | Preview visualization of the selected node (hide on release). | | :warning: space double press | Toggle visualization fullscreen mode | @@ -116,7 +117,7 @@ broken and require further investigation. #### Visualizations Implementations | Shortcut | Action | -| ----------------------------- | -------------------------------------------------- | +|-------------------------------|----------------------------------------------------| | cmd + a | Show all points if available in visualization. | | cmd + z | Zoom into selection if available in visualization. | diff --git a/app/gui/src/controller/graph/widget.rs b/app/gui/src/controller/graph/widget.rs index b87648a78a54..c1ba6d40a2e2 100644 --- a/app/gui/src/controller/graph/widget.rs +++ b/app/gui/src/controller/graph/widget.rs @@ -93,7 +93,7 @@ impl Controller { let input = &frp.input; let output = &frp.private.output; - frp::extend! { network + frp::extend! { TRACE_ALL network updates_from_cache <- input.request_widgets.filter_map( f!((definition) model.borrow_mut().request_widget(definition)) ); diff --git a/app/gui/src/presenter/project.rs b/app/gui/src/presenter/project.rs index 8c939b7f9b97..d361096c509b 100644 --- a/app/gui/src/presenter/project.rs +++ b/app/gui/src/presenter/project.rs @@ -204,10 +204,15 @@ impl Model { fn toggle_read_only(&self) -> bool { let current_state = self.controller.model.read_only(); let new_state = !current_state; - self.controller.model.set_read_only(new_state); - info!("New read only state: {}.", new_state); + self.set_read_only(new_state); new_state } + /// Toggle the read-only mode, return the new state. + + fn set_read_only(&self, new_state: bool) { + self.controller.model.set_read_only(new_state); + error!("New read only state: {}.", new_state); + } fn restore_project_snapshot(&self) { let controller = self.controller.clone_ref(); @@ -404,9 +409,13 @@ impl Project { eval_ view.execution_context_restart(model.execution_context_restart()); view.set_read_only <+ view.toggle_read_only.map(f_!(model.toggle_read_only())); - eval graph_view.execution_environment((mode) model.execution_environment_changed(mode)); + eval graph_view.execution_environment((env) model.execution_environment_changed(env)); + view.set_read_only <+ graph_view.execution_environment.map(f!([model](env) { + let read_only = ExecutionEnvironment::try_from(env.as_ref()).map(|env| !env.output_context_enabled()).unwrap_or(false); + model.set_read_only(read_only); + read_only + })); - eval_ view.toggle_read_only(model.toggle_read_only()); } let graph_controller = self.model.graph_controller.clone_ref(); @@ -422,8 +431,6 @@ impl Project { let graph = &self.model.view.graph(); let entries = Rc::new(ExecutionEnvironment::list_all_as_imstrings()); graph.set_available_execution_environments(entries); - let default_mode = ExecutionEnvironment::default(); - graph.set_execution_environment(default_mode); self } From 21397f507b051a684f2e06629796069d44424300 Mon Sep 17 00:00:00 2001 From: Michael Mauderer Date: Tue, 25 Apr 2023 14:53:04 +0100 Subject: [PATCH 20/23] Revert debug logging. --- app/gui/src/presenter/project.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/gui/src/presenter/project.rs b/app/gui/src/presenter/project.rs index d361096c509b..4919f1e97beb 100644 --- a/app/gui/src/presenter/project.rs +++ b/app/gui/src/presenter/project.rs @@ -211,7 +211,7 @@ impl Model { fn set_read_only(&self, new_state: bool) { self.controller.model.set_read_only(new_state); - error!("New read only state: {}.", new_state); + info!("New read only state: {}.", new_state); } fn restore_project_snapshot(&self) { From ee8fec730aae982253059fec24fbfa455015cc56 Mon Sep 17 00:00:00 2001 From: Michael Mauderer Date: Tue, 25 Apr 2023 15:13:16 +0100 Subject: [PATCH 21/23] Fix shortcuts. Revert read only refactoring. --- app/gui/src/presenter/project.rs | 13 +-------- app/gui/view/graph-editor/src/shortcuts.rs | 34 +++++++++++----------- 2 files changed, 18 insertions(+), 29 deletions(-) diff --git a/app/gui/src/presenter/project.rs b/app/gui/src/presenter/project.rs index 4919f1e97beb..7f8ffc5f6689 100644 --- a/app/gui/src/presenter/project.rs +++ b/app/gui/src/presenter/project.rs @@ -204,14 +204,9 @@ impl Model { fn toggle_read_only(&self) -> bool { let current_state = self.controller.model.read_only(); let new_state = !current_state; - self.set_read_only(new_state); - new_state - } - /// Toggle the read-only mode, return the new state. - - fn set_read_only(&self, new_state: bool) { self.controller.model.set_read_only(new_state); info!("New read only state: {}.", new_state); + new_state } fn restore_project_snapshot(&self) { @@ -410,12 +405,6 @@ impl Project { view.set_read_only <+ view.toggle_read_only.map(f_!(model.toggle_read_only())); eval graph_view.execution_environment((env) model.execution_environment_changed(env)); - view.set_read_only <+ graph_view.execution_environment.map(f!([model](env) { - let read_only = ExecutionEnvironment::try_from(env.as_ref()).map(|env| !env.output_context_enabled()).unwrap_or(false); - model.set_read_only(read_only); - read_only - })); - } let graph_controller = self.model.graph_controller.clone_ref(); diff --git a/app/gui/view/graph-editor/src/shortcuts.rs b/app/gui/view/graph-editor/src/shortcuts.rs index 73c5139f9969..73ab6b14c048 100644 --- a/app/gui/view/graph-editor/src/shortcuts.rs +++ b/app/gui/view/graph-editor/src/shortcuts.rs @@ -10,15 +10,15 @@ use ensogl::application::shortcut::ActionType::*; /// The list of all shortcuts used in the graph editor. pub const SHORTCUTS: &[(ensogl::application::shortcut::ActionType, &str, &str, &str)] = &[ - (Press, "!node_editing", "tab", "start_node_creation"), - (Press, "!node_editing", "enter", "start_node_creation"), + (Press, "!node_editing & !read_only", "tab", "start_node_creation"), + (Press, "!node_editing & !read_only", "enter", "start_node_creation"), // === Drag === (Press, "", "left-mouse-button", "node_press"), (Release, "", "left-mouse-button", "node_release"), - (Press, "!node_editing", "backspace", "remove_selected_nodes"), - (Press, "!node_editing", "delete", "remove_selected_nodes"), + (Press, "!node_editing & !read_only", "backspace", "remove_selected_nodes"), + (Press, "!node_editing & !read_only", "delete", "remove_selected_nodes"), (Press, "has_detached_edge", "escape", "drop_dragged_edge"), - (Press, "", "cmd g", "collapse_selected_nodes"), + (Press, "!read_only", "cmd g", "collapse_selected_nodes"), // === Visualization === (Press, "!node_editing", "space", "press_visualization_visibility"), (DoublePress, "!node_editing", "space", "double_press_visualization_visibility"), @@ -45,24 +45,24 @@ pub const SHORTCUTS: &[(ensogl::application::shortcut::ActionType, &str, &str, & "ctrl space", "cycle_visualization_for_selected_node", ), - (DoublePress, "", "left-mouse-button", "enter_hovered_node"), - (DoublePress, "", "left-mouse-button", "start_node_creation_from_port"), - (Press, "", "right-mouse-button", "start_node_creation_from_port"), - (Press, "!node_editing", "cmd enter", "enter_selected_node"), - (Press, "", "alt enter", "exit_node"), + (DoublePress, "!read_only", "left-mouse-button", "enter_hovered_node"), + (DoublePress, "!read_only", "left-mouse-button", "start_node_creation_from_port"), + (Press, "!read_only", "right-mouse-button", "start_node_creation_from_port"), + (Press, "!node_editing & !read_only", "cmd enter", "enter_selected_node"), + (Press, "!read_only", "alt enter", "exit_node"), // === Node Editing === - (Press, "", "cmd", "edit_mode_on"), - (Release, "", "cmd", "edit_mode_off"), - (Press, "", "cmd left-mouse-button", "edit_mode_on"), - (Release, "", "cmd left-mouse-button", "edit_mode_off"), - (Press, "node_editing", "cmd enter", "stop_editing"), + (Press, "!read_only", "cmd", "edit_mode_on"), + (Release, "!read_only", "cmd", "edit_mode_off"), + (Press, "!read_only", "cmd left-mouse-button", "edit_mode_on"), + (Release, "!read_only", "cmd left-mouse-button", "edit_mode_off"), + (Press, "node_editing & !read_only", "cmd enter", "stop_editing"), // === Profiling Mode === (Press, "", "cmd p", "toggle_profiling_mode"), - // === Execution Mode === - (Press, "", "shift ctrl e", "toggle_execution_environment"), // === Debug === (Press, "debug_mode", "ctrl d", "debug_set_test_visualization_data_for_selected_node"), (Press, "debug_mode", "ctrl shift enter", "debug_push_breadcrumb"), (Press, "debug_mode", "ctrl shift up", "debug_pop_breadcrumb"), (Press, "debug_mode", "ctrl n", "add_node_at_cursor"), + // === Execution Mode === + (Press, "", "shift ctrl e", "toggle_execution_environment"), ]; From ed4af57e727c1f49d113437adea1d92087aeace4 Mon Sep 17 00:00:00 2001 From: Ilya Bogdanov Date: Tue, 25 Apr 2023 22:24:11 +0300 Subject: [PATCH 22/23] Remove TRACE_ALL --- app/gui/src/controller/graph/widget.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/gui/src/controller/graph/widget.rs b/app/gui/src/controller/graph/widget.rs index c1ba6d40a2e2..b87648a78a54 100644 --- a/app/gui/src/controller/graph/widget.rs +++ b/app/gui/src/controller/graph/widget.rs @@ -93,7 +93,7 @@ impl Controller { let input = &frp.input; let output = &frp.private.output; - frp::extend! { TRACE_ALL network + frp::extend! { network updates_from_cache <- input.request_widgets.filter_map( f!((definition) model.borrow_mut().request_widget(definition)) ); From a5cafbaab68ff6d850b2db4d9802b1c81fae49d1 Mon Sep 17 00:00:00 2001 From: Ilya Bogdanov Date: Tue, 25 Apr 2023 23:38:42 +0400 Subject: [PATCH 23/23] Fix compilation and formatting --- app/gui/docs/product/shortcuts.md | 14 +++---- .../graph-editor/src/execution_environment.rs | 2 +- app/gui/view/graph-editor/src/lib.rs | 38 +++++++++---------- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/app/gui/docs/product/shortcuts.md b/app/gui/docs/product/shortcuts.md index d3e552ba3ba1..d109fb96c52c 100644 --- a/app/gui/docs/product/shortcuts.md +++ b/app/gui/docs/product/shortcuts.md @@ -35,7 +35,7 @@ broken and require further investigation. #### General Shortcuts | Shortcut | Action | -|---------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| ------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | cmd+alt+shift+t | Toggle light/dark application style. Currently doesn't work properly, as the Theme Switcher is not created yet. (https://github.com/enso-org/ide/issues/795) | | ctrl+` | Show Code Editor. Please note that the Code Editor implementation is in a very early stage and you should not use it. Even just openning it can cause errors in the IDE. Do not try using the graph editor while having the code editor tab openned. | | cmd+o | Open project | @@ -55,7 +55,7 @@ broken and require further investigation. #### Navigation | Shortcut | Action | -|--------------------------------------------------|---------------------------------| +| ------------------------------------------------ | ------------------------------- | | Drag gesture (two fingers) | Pan the scene. | | Pinch gesture (two fingers) | Zoom the scene. | | MMB drag | Pan the scene. | @@ -68,14 +68,14 @@ broken and require further investigation. #### Node Layout | Shortcut | Action | -|--------------------------------------------|-------------------------------------------------------------------| +| ------------------------------------------ | ----------------------------------------------------------------- | | LMB drag non-selected node name | Move the node to new position (dragging do not modify selection). | | LMB drag selected node name | Move all selected nodes the node to new positions. | #### Node Selection | Shortcut | Action | -|------------------------------------------------------------------------------------------------|------------------------------------------------------------| +| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------- | | LMB click node name | Deselect all nodes. Select the target node. | | LMB click background | Deselect all nodes. | | :warning: LMB drag background | Select nodes using selection-box. | @@ -94,7 +94,7 @@ broken and require further investigation. #### Node Editing | Shortcut | Action | -|--------------------------------------------------|-------------------------------------------------------------| +| ------------------------------------------------ | ----------------------------------------------------------- | | tab | Open Component Browser to create a new node . | | backspace or delete | Remove selected nodes. | | cmd+g | Collapse (group) selected nodes. | @@ -107,7 +107,7 @@ broken and require further investigation. #### Visualization | Shortcut | Action | -|-------------------------------------------|---------------------------------------------------------------| +| ----------------------------------------- | ------------------------------------------------------------- | | space | Toggle visualization visibility of the selected node. | | space hold | Preview visualization of the selected node (hide on release). | | :warning: space double press | Toggle visualization fullscreen mode | @@ -117,7 +117,7 @@ broken and require further investigation. #### Visualizations Implementations | Shortcut | Action | -|-------------------------------|----------------------------------------------------| +| ----------------------------- | -------------------------------------------------- | | cmd + a | Show all points if available in visualization. | | cmd + z | Zoom into selection if available in visualization. | diff --git a/app/gui/view/graph-editor/src/execution_environment.rs b/app/gui/view/graph-editor/src/execution_environment.rs index f10353b52446..43bb57bb0a08 100644 --- a/app/gui/view/graph-editor/src/execution_environment.rs +++ b/app/gui/view/graph-editor/src/execution_environment.rs @@ -25,7 +25,7 @@ fn get_next_execution_environment( pub fn init_frp(frp: &Frp, model: &GraphEditorModelWithNetwork) { let out = &frp.private.output; let network = frp.network(); - let inputs = &model.frp; + let inputs = &frp.private.input; let selector = &model.execution_environment_selector; frp::extend! { network diff --git a/app/gui/view/graph-editor/src/lib.rs b/app/gui/view/graph-editor/src/lib.rs index 869dc1226ef9..fd99f9058edc 100644 --- a/app/gui/view/graph-editor/src/lib.rs +++ b/app/gui/view/graph-editor/src/lib.rs @@ -1783,25 +1783,25 @@ impl GraphEditorModelWithNetwork { #[derive(Debug, Clone, CloneRef)] #[allow(missing_docs)] // FIXME[everyone] Public-facing API should be documented. pub struct GraphEditorModel { - pub display_object: display::object::Instance, - pub app: Application, - pub breadcrumbs: component::Breadcrumbs, - pub cursor: cursor::Cursor, - pub nodes: Nodes, - pub edges: Edges, - pub vis_registry: visualization::Registry, - pub drop_manager: ensogl_drop_manager::Manager, - pub navigator: Navigator, - pub add_node_button: Rc, - tooltip: Tooltip, - touch_state: TouchState, - visualisations: Visualisations, - frp: api::Private, - frp_public: api::Public, - profiling_statuses: profiling::Statuses, - profiling_button: component::profiling::Button, - styles_frp: StyleWatchFrp, - selection_controller: selection::Controller, + pub display_object: display::object::Instance, + pub app: Application, + pub breadcrumbs: component::Breadcrumbs, + pub cursor: cursor::Cursor, + pub nodes: Nodes, + pub edges: Edges, + pub vis_registry: visualization::Registry, + pub drop_manager: ensogl_drop_manager::Manager, + pub navigator: Navigator, + pub add_node_button: Rc, + tooltip: Tooltip, + touch_state: TouchState, + visualisations: Visualisations, + frp: api::Private, + frp_public: api::Public, + profiling_statuses: profiling::Statuses, + profiling_button: component::profiling::Button, + styles_frp: StyleWatchFrp, + selection_controller: selection::Controller, execution_environment_selector: ExecutionEnvironmentSelector, }