From 82544603ea9cc31565309ecfda13de7e8ebfe45b Mon Sep 17 00:00:00 2001 From: Emil Valeev Date: Thu, 8 Feb 2024 00:49:32 +0600 Subject: [PATCH] fix(vscode): launch json for examples --- .vscode/launch.json | 92 +++++++++++++------ .../main.neva | 0 .../{with_selectors => with_sugar}/main.neva | 0 internal/compiler/analyzer/component_nodes.go | 6 +- 4 files changed, 67 insertions(+), 31 deletions(-) rename examples/5_add_real_numbers/{with_error_handling => with_err_handling}/main.neva (100%) rename examples/7_struct_selector/{with_selectors => with_sugar}/main.neva (100%) diff --git a/.vscode/launch.json b/.vscode/launch.json index 6f7f7722..e8494866 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -31,108 +31,144 @@ "type": "go", "request": "launch", "mode": "auto", - "program": "${workspaceFolder}/cmd/interpreter", + "program": "${workspaceFolder}/cmd/neva", "cwd": "${workspaceFolder}/examples", - "args": ["do_nothing"] + "args": ["run", "0_do_nothing"] }, { "name": "Interpreter: echo", "type": "go", "request": "launch", "mode": "auto", - "program": "${workspaceFolder}/cmd/interpreter", + "program": "${workspaceFolder}/cmd/neva", "cwd": "${workspaceFolder}/examples", - "args": ["echo"] + "args": ["run", "1_echo"] }, { "name": "Interpreter: hello_world/verbose", "type": "go", "request": "launch", "mode": "auto", - "program": "${workspaceFolder}/cmd/interpreter", + "program": "${workspaceFolder}/cmd/neva", "cwd": "${workspaceFolder}/examples", - "args": ["hello_world/verbose"] + "args": ["run", "2_hello_world/0_verbose"] }, { "name": "Interpreter: hello_world/with_const_sender", "type": "go", "request": "launch", "mode": "auto", - "program": "${workspaceFolder}/cmd/interpreter", + "program": "${workspaceFolder}/cmd/neva", "cwd": "${workspaceFolder}/examples", - "args": ["hello_world/with_const_sender"] + "args": ["run", "2_hello_world/1_with_const_sender"] }, { "name": "Interpreter: hello_world/with_then_connection", "type": "go", "request": "launch", "mode": "auto", - "program": "${workspaceFolder}/cmd/interpreter", + "program": "${workspaceFolder}/cmd/neva", "cwd": "${workspaceFolder}/examples", - "args": ["hello_world/with_then_connection"] + "args": ["run", "2_hello_world/2_with_then_connection"] }, { - "name": "Interpreter: add_numbers/naive", + "name": "Interpreter: hello_world/with_then_connection", "type": "go", "request": "launch", "mode": "auto", - "program": "${workspaceFolder}/cmd/interpreter", + "program": "${workspaceFolder}/cmd/neva", "cwd": "${workspaceFolder}/examples", - "args": ["add_numbers/naive"] + "args": ["run", "2_hello_world/3_with_literal_senders"] }, { "name": "Interpreter: interfaces", "type": "go", "request": "launch", "mode": "auto", - "program": "${workspaceFolder}/cmd/interpreter", + "program": "${workspaceFolder}/cmd/neva", + "cwd": "${workspaceFolder}/examples", + "args": ["run", "3_interfaces"] + }, + { + "name": "Interpreter: add_numbers/naive", + "type": "go", + "request": "launch", + "mode": "auto", + "program": "${workspaceFolder}/cmd/neva", + "cwd": "${workspaceFolder}/examples", + "args": ["run", "4_add_numbers/verbose"] + }, + { + "name": "Interpreter: add_numbers/naive", + "type": "go", + "request": "launch", + "mode": "auto", + "program": "${workspaceFolder}/cmd/neva", "cwd": "${workspaceFolder}/examples", - "args": ["interfaces"] + "args": ["run", "4_add_numbers/with_bridge"] }, { - "name": "Interpreter: struct_fields/verbose", + "name": "Interpreter: 5_add_real_numbers/naive", "type": "go", "request": "launch", "mode": "auto", - "program": "${workspaceFolder}/cmd/interpreter", + "program": "${workspaceFolder}/cmd/neva", "cwd": "${workspaceFolder}/examples", - "args": ["struct_fields/verbose"] + "args": ["run", "5_add_real_numbers/naive"] }, { - "name": "Interpreter: struct_fields/with_selectors", + "name": "Interpreter: 5_add_real_numbers/with_err_handling", "type": "go", "request": "launch", "mode": "auto", - "program": "${workspaceFolder}/cmd/interpreter", + "program": "${workspaceFolder}/cmd/neva", "cwd": "${workspaceFolder}/examples", - "args": ["struct_fields/with_selectors"] + "args": ["run", "5_add_real_numbers/with_err_handling"] }, { - "name": "Interpreter: map_keys", + "name": "Interpreter: 5_add_real_numbers/with_sub_components", "type": "go", "request": "launch", "mode": "auto", - "program": "${workspaceFolder}/cmd/interpreter", + "program": "${workspaceFolder}/cmd/neva", "cwd": "${workspaceFolder}/examples", - "args": ["map_keys"] + "args": ["run", "5_add_real_numbers/with_sub_components"] }, { "name": "Interpreter: struct_builder/verbose", "type": "go", "request": "launch", "mode": "auto", - "program": "${workspaceFolder}/cmd/interpreter", + "program": "${workspaceFolder}/cmd/neva", "cwd": "${workspaceFolder}/examples", - "args": ["struct_builder/verbose"] + "args": ["run", "6_struct_builder/verbose"] }, { "name": "Interpreter: struct_builder/with_sugar", "type": "go", "request": "launch", "mode": "auto", - "program": "${workspaceFolder}/cmd/interpreter", + "program": "${workspaceFolder}/cmd/neva", + "cwd": "${workspaceFolder}/examples", + "args": ["run", "6_struct_builder/with_sugar"] + }, + { + "name": "Interpreter: struct_selectors/verbose", + "type": "go", + "request": "launch", + "mode": "auto", + "program": "${workspaceFolder}/cmd/neva", + "cwd": "${workspaceFolder}/examples", + "args": ["run", "7_struct_selectors/verbose"] + }, + { + "name": "Interpreter: struct_selectors/with_sugar", + "type": "go", + "request": "launch", + "mode": "auto", + "program": "${workspaceFolder}/cmd/neva", "cwd": "${workspaceFolder}/examples", - "args": ["struct_builder/with_sugar"] + "args": ["run", "7_struct_selectors/with_sugar"] }, // === Other === { diff --git a/examples/5_add_real_numbers/with_error_handling/main.neva b/examples/5_add_real_numbers/with_err_handling/main.neva similarity index 100% rename from examples/5_add_real_numbers/with_error_handling/main.neva rename to examples/5_add_real_numbers/with_err_handling/main.neva diff --git a/examples/7_struct_selector/with_selectors/main.neva b/examples/7_struct_selector/with_sugar/main.neva similarity index 100% rename from examples/7_struct_selector/with_selectors/main.neva rename to examples/7_struct_selector/with_sugar/main.neva diff --git a/internal/compiler/analyzer/component_nodes.go b/internal/compiler/analyzer/component_nodes.go index 14b937fe..8f51a3f0 100644 --- a/internal/compiler/analyzer/component_nodes.go +++ b/internal/compiler/analyzer/component_nodes.go @@ -60,8 +60,8 @@ func (a Analyzer) analyzeComponentNode(node src.Node, scope src.Scope) (src.Node } } - runtimeMsgArgs, hasRuntimeMsg := node.Directives[compiler.BindDirective] - if hasRuntimeMsg && len(runtimeMsgArgs) != 1 { + bindDirectiveArgs, usesBindDirective := node.Directives[compiler.BindDirective] + if usesBindDirective && len(bindDirectiveArgs) != 1 { return src.Node{}, src.Interface{}, &compiler.Error{ Err: ErrBindDirectiveArgs, Location: &location, @@ -69,7 +69,7 @@ func (a Analyzer) analyzeComponentNode(node src.Node, scope src.Scope) (src.Node } } - iface, aerr := a.getResolvedNodeInterface(entity, hasRuntimeMsg, location, node, scope) + iface, aerr := a.getResolvedNodeInterface(entity, usesBindDirective, location, node, scope) if aerr != nil { return src.Node{}, src.Interface{}, aerr }