mirror of
https://github.com/exaloop/codon.git
synced 2025-06-03 15:03:52 +08:00
clang-format
This commit is contained in:
parent
4e80861aa0
commit
7882c562e0
@ -14,8 +14,8 @@
|
|||||||
#include "codon/compiler/compiler.h"
|
#include "codon/compiler/compiler.h"
|
||||||
#include "codon/compiler/error.h"
|
#include "codon/compiler/error.h"
|
||||||
#include "codon/compiler/jit.h"
|
#include "codon/compiler/jit.h"
|
||||||
#include "codon/util/jupyter.h"
|
|
||||||
#include "codon/util/common.h"
|
#include "codon/util/common.h"
|
||||||
|
#include "codon/util/jupyter.h"
|
||||||
#include "llvm/Support/CommandLine.h"
|
#include "llvm/Support/CommandLine.h"
|
||||||
#include "llvm/Support/FileSystem.h"
|
#include "llvm/Support/FileSystem.h"
|
||||||
|
|
||||||
|
@ -943,8 +943,8 @@ std::pair<bool, ExprPtr> TypecheckVisitor::transformInternalStaticFn(CallExpr *e
|
|||||||
auto idx = ctx->getStaticInt(expr->expr->type->getFunc()->funcGenerics[0].type);
|
auto idx = ctx->getStaticInt(expr->expr->type->getFunc()->funcGenerics[0].type);
|
||||||
seqassert(idx, "expected a static integer");
|
seqassert(idx, "expected a static integer");
|
||||||
auto &args = fn->getArgTypes();
|
auto &args = fn->getArgTypes();
|
||||||
return {true, transform(
|
return {true, transform(N<BoolExpr>(*idx >= 0 && *idx < args.size() &&
|
||||||
N<BoolExpr>(*idx >= 0 && *idx < args.size() && args[*idx]->canRealize()))};
|
args[*idx]->canRealize()))};
|
||||||
} else if (expr->expr->isId("std.internal.static.fn_arg_get_type")) {
|
} else if (expr->expr->isId("std.internal.static.fn_arg_get_type")) {
|
||||||
auto fn = expr->args[0].value->type->getFunc();
|
auto fn = expr->args[0].value->type->getFunc();
|
||||||
if (!fn)
|
if (!fn)
|
||||||
@ -1015,7 +1015,7 @@ std::pair<bool, ExprPtr> TypecheckVisitor::transformInternalStaticFn(CallExpr *e
|
|||||||
return {true, nullptr};
|
return {true, nullptr};
|
||||||
|
|
||||||
std::vector<ExprPtr> tupArgs;
|
std::vector<ExprPtr> tupArgs;
|
||||||
for (auto &a: zzz->getCall()->args)
|
for (auto &a : zzz->getCall()->args)
|
||||||
tupArgs.push_back(a.value);
|
tupArgs.push_back(a.value);
|
||||||
return {true, transform(N<TupleExpr>(tupArgs))};
|
return {true, transform(N<TupleExpr>(tupArgs))};
|
||||||
} else {
|
} else {
|
||||||
|
@ -249,7 +249,9 @@ void TypecheckVisitor::visit(GeneratorExpr *expr) {
|
|||||||
|
|
||||||
seqassert(expr->loops[0].vars->getId(), "tuple() not simplified");
|
seqassert(expr->loops[0].vars->getId(), "tuple() not simplified");
|
||||||
std::vector<std::string> vars{expr->loops[0].vars->getId()->value};
|
std::vector<std::string> vars{expr->loops[0].vars->getId()->value};
|
||||||
auto suiteVec = expr->expr->getStmtExpr() ? expr->expr->getStmtExpr()->stmts[0]->getSuite() : nullptr;
|
auto suiteVec = expr->expr->getStmtExpr()
|
||||||
|
? expr->expr->getStmtExpr()->stmts[0]->getSuite()
|
||||||
|
: nullptr;
|
||||||
auto oldSuite = suiteVec ? suiteVec->clone() : nullptr;
|
auto oldSuite = suiteVec ? suiteVec->clone() : nullptr;
|
||||||
for (int validI = 0; suiteVec && validI < suiteVec->stmts.size(); validI++) {
|
for (int validI = 0; suiteVec && validI < suiteVec->stmts.size(); validI++) {
|
||||||
if (auto a = suiteVec->stmts[validI]->getAssign())
|
if (auto a = suiteVec->stmts[validI]->getAssign())
|
||||||
@ -263,9 +265,9 @@ void TypecheckVisitor::visit(GeneratorExpr *expr) {
|
|||||||
}
|
}
|
||||||
if (vars.size() > 1)
|
if (vars.size() > 1)
|
||||||
vars.erase(vars.begin());
|
vars.erase(vars.begin());
|
||||||
auto [ok, staticItems] = transformStaticLoopCall(
|
auto [ok, staticItems] =
|
||||||
vars, expr->loops[0].gen, [&](StmtPtr wrap) {
|
transformStaticLoopCall(vars, expr->loops[0].gen, [&](StmtPtr wrap) {
|
||||||
return N<StmtExpr>( wrap, clone(expr->expr));
|
return N<StmtExpr>(wrap, clone(expr->expr));
|
||||||
});
|
});
|
||||||
if (ok) {
|
if (ok) {
|
||||||
std::vector<ExprPtr> tupleItems;
|
std::vector<ExprPtr> tupleItems;
|
||||||
@ -277,7 +279,6 @@ void TypecheckVisitor::visit(GeneratorExpr *expr) {
|
|||||||
expr->expr->getStmtExpr()->stmts[0] = oldSuite;
|
expr->expr->getStmtExpr()->stmts[0] = oldSuite;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
auto tuple = gen->type->getRecord();
|
auto tuple = gen->type->getRecord();
|
||||||
if (!tuple ||
|
if (!tuple ||
|
||||||
!(startswith(tuple->name, TYPE_TUPLE) || startswith(tuple->name, TYPE_KWTUPLE)))
|
!(startswith(tuple->name, TYPE_TUPLE) || startswith(tuple->name, TYPE_KWTUPLE)))
|
||||||
|
@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
#include "llvm/Support/Path.h"
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "llvm/Support/Path.h"
|
|
||||||
|
|
||||||
namespace codon {
|
namespace codon {
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -7,7 +7,8 @@ namespace codon {
|
|||||||
int startJupyterKernel(const std::string &argv0,
|
int startJupyterKernel(const std::string &argv0,
|
||||||
const std::vector<std::string> &plugins,
|
const std::vector<std::string> &plugins,
|
||||||
const std::string &configPath) {
|
const std::string &configPath) {
|
||||||
fprintf(stderr, "Jupyter support not included. Please install Codon Jupyter plugin.\n");
|
fprintf(stderr,
|
||||||
|
"Jupyter support not included. Please install Codon Jupyter plugin.\n");
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user