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/error.h"
|
||||
#include "codon/compiler/jit.h"
|
||||
#include "codon/util/jupyter.h"
|
||||
#include "codon/util/common.h"
|
||||
#include "codon/util/jupyter.h"
|
||||
#include "llvm/Support/CommandLine.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);
|
||||
seqassert(idx, "expected a static integer");
|
||||
auto &args = fn->getArgTypes();
|
||||
return {true, transform(
|
||||
N<BoolExpr>(*idx >= 0 && *idx < args.size() && args[*idx]->canRealize()))};
|
||||
return {true, transform(N<BoolExpr>(*idx >= 0 && *idx < args.size() &&
|
||||
args[*idx]->canRealize()))};
|
||||
} else if (expr->expr->isId("std.internal.static.fn_arg_get_type")) {
|
||||
auto fn = expr->args[0].value->type->getFunc();
|
||||
if (!fn)
|
||||
@ -1015,7 +1015,7 @@ std::pair<bool, ExprPtr> TypecheckVisitor::transformInternalStaticFn(CallExpr *e
|
||||
return {true, nullptr};
|
||||
|
||||
std::vector<ExprPtr> tupArgs;
|
||||
for (auto &a: zzz->getCall()->args)
|
||||
for (auto &a : zzz->getCall()->args)
|
||||
tupArgs.push_back(a.value);
|
||||
return {true, transform(N<TupleExpr>(tupArgs))};
|
||||
} else {
|
||||
|
@ -249,7 +249,9 @@ void TypecheckVisitor::visit(GeneratorExpr *expr) {
|
||||
|
||||
seqassert(expr->loops[0].vars->getId(), "tuple() not simplified");
|
||||
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;
|
||||
for (int validI = 0; suiteVec && validI < suiteVec->stmts.size(); validI++) {
|
||||
if (auto a = suiteVec->stmts[validI]->getAssign())
|
||||
@ -263,10 +265,10 @@ void TypecheckVisitor::visit(GeneratorExpr *expr) {
|
||||
}
|
||||
if (vars.size() > 1)
|
||||
vars.erase(vars.begin());
|
||||
auto [ok, staticItems] = transformStaticLoopCall(
|
||||
vars, expr->loops[0].gen, [&](StmtPtr wrap) {
|
||||
return N<StmtExpr>( wrap, clone(expr->expr));
|
||||
});
|
||||
auto [ok, staticItems] =
|
||||
transformStaticLoopCall(vars, expr->loops[0].gen, [&](StmtPtr wrap) {
|
||||
return N<StmtExpr>(wrap, clone(expr->expr));
|
||||
});
|
||||
if (ok) {
|
||||
std::vector<ExprPtr> tupleItems;
|
||||
for (auto &i : staticItems)
|
||||
@ -277,7 +279,6 @@ void TypecheckVisitor::visit(GeneratorExpr *expr) {
|
||||
expr->expr->getStmtExpr()->stmts[0] = oldSuite;
|
||||
}
|
||||
|
||||
|
||||
auto tuple = gen->type->getRecord();
|
||||
if (!tuple ||
|
||||
!(startswith(tuple->name, TYPE_TUPLE) || startswith(tuple->name, TYPE_KWTUPLE)))
|
||||
|
@ -2,11 +2,11 @@
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#include "llvm/Support/Path.h"
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "llvm/Support/Path.h"
|
||||
|
||||
namespace codon {
|
||||
namespace {
|
||||
|
@ -7,7 +7,8 @@ namespace codon {
|
||||
int startJupyterKernel(const std::string &argv0,
|
||||
const std::vector<std::string> &plugins,
|
||||
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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user