Skip to content

Commit

Permalink
fix(json compiler): disable import solver in json compiler
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperFola committed Sep 28, 2024
1 parent 244dd03 commit ee54f06
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/arkscript/JsonCompiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
using namespace Ark::internal;

JsonCompiler::JsonCompiler(unsigned debug, const std::vector<std::filesystem::path>& lib_env) :
m_welder(debug, lib_env)
m_welder(debug, lib_env, Ark::DefaultFeatures & ~Ark::FeatureImportSolver)
{}

void JsonCompiler::feed(const std::string& filename)
Expand Down
2 changes: 1 addition & 1 deletion tests/unittests/resources/ASTSuite/error.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"type": "Begin", "children": [{"type": "Let", "name": {"type": "Symbol", "name": "throw"}, "value": {"type": "Fun", "args": [{"type": "Symbol", "name": "_x"}], "body": {"type": "Fun", "args": [{"type": "Symbol", "name": "_injl"}, {"type": "Symbol", "name": "_injr"}, {"type": "Capture", "name": "_x"}], "body": {"type": "FunctionCall", "name": {"type": "Symbol", "name": "_injl"}, "args": [{"type": "Symbol", "name": "_x"}]}}}}, {"type": "Let", "name": {"type": "Symbol", "name": "return"}, "value": {"type": "Fun", "args": [{"type": "Symbol", "name": "_y"}], "body": {"type": "Fun", "args": [{"type": "Symbol", "name": "_injl"}, {"type": "Symbol", "name": "_injr"}, {"type": "Capture", "name": "_y"}], "body": {"type": "FunctionCall", "name": {"type": "Symbol", "name": "_injr"}, "args": [{"type": "Symbol", "name": "_y"}]}}}}, {"type": "Let", "name": {"type": "Symbol", "name": "try"}, "value": {"type": "Fun", "args": [{"type": "Symbol", "name": "_either"}, {"type": "Symbol", "name": "_continue"}, {"type": "Symbol", "name": "_handle"}], "body": {"type": "FunctionCall", "name": {"type": "Symbol", "name": "_either"}, "args": [{"type": "Symbol", "name": "_handle"}, {"type": "Symbol", "name": "_continue"}]}}}, {"type": "Let", "name": {"type": "Symbol", "name": "invert"}, "value": {"type": "Fun", "args": [{"type": "Symbol", "name": "x"}], "body": {"type": "Begin", "children": [{"type": "If", "condition": {"type": "FunctionCall", "name": {"type": "Symbol", "name": "="}, "args": [{"type": "Symbol", "name": "x"}, {"type": "Number", "value": 0}]}, "then": {"type": "FunctionCall", "name": {"type": "Symbol", "name": "throw"}, "args": [{"type": "String", "value": "cannot divide by zero"}]}, "else": {"type": "FunctionCall", "name": {"type": "Symbol", "name": "return"}, "args": [{"type": "FunctionCall", "name": {"type": "Symbol", "name": "/"}, "args": [{"type": "Number", "value": 1}, {"type": "Symbol", "name": "x"}]}]}}]}}}, {"type": "FunctionCall", "name": {"type": "Symbol", "name": "try"}, "args": [{"type": "FunctionCall", "name": {"type": "Symbol", "name": "invert"}, "args": [{"type": "Number", "value": 0}]}, {"type": "Fun", "args": [{"type": "Symbol", "name": "inverted"}], "body": {"type": "FunctionCall", "name": {"type": "Symbol", "name": "print"}, "args": [{"type": "Symbol", "name": "inverted"}]}}, {"type": "Fun", "args": [{"type": "Symbol", "name": "err"}], "body": {"type": "FunctionCall", "name": {"type": "Symbol", "name": "print"}, "args": [{"type": "Symbol", "name": "err"}]}}]}]}
{"type": "Begin", "children": [{"type": "Import", "package": "std.Exceptions", "glob": false, "symbols": []}, {"type": "Let", "name": {"type": "Symbol", "name": "invert"}, "value": {"type": "Fun", "args": [{"type": "Symbol", "name": "x"}], "body": {"type": "Begin", "children": [{"type": "If", "condition": {"type": "FunctionCall", "name": {"type": "Symbol", "name": "="}, "args": [{"type": "Symbol", "name": "x"}, {"type": "Number", "value": 0}]}, "then": {"type": "FunctionCall", "name": {"type": "Symbol", "name": "throw"}, "args": [{"type": "String", "value": "cannot divide by zero"}]}, "else": {"type": "FunctionCall", "name": {"type": "Symbol", "name": "return"}, "args": [{"type": "FunctionCall", "name": {"type": "Symbol", "name": "/"}, "args": [{"type": "Number", "value": 1}, {"type": "Symbol", "name": "x"}]}]}}]}}}, {"type": "FunctionCall", "name": {"type": "Symbol", "name": "try"}, "args": [{"type": "FunctionCall", "name": {"type": "Symbol", "name": "invert"}, "args": [{"type": "Number", "value": 0}]}, {"type": "Fun", "args": [{"type": "Symbol", "name": "inverted"}], "body": {"type": "FunctionCall", "name": {"type": "Symbol", "name": "print"}, "args": [{"type": "Symbol", "name": "inverted"}]}}, {"type": "Fun", "args": [{"type": "Symbol", "name": "err"}], "body": {"type": "FunctionCall", "name": {"type": "Symbol", "name": "print"}, "args": [{"type": "Symbol", "name": "err"}]}}]}]}

0 comments on commit ee54f06

Please sign in to comment.