Commit 2760ef6e authored by Kevin Modzelewski's avatar Kevin Modzelewski

minor

parent 6781ec24
......@@ -1522,7 +1522,8 @@ private:
SourceInfo* source = irstate->getSourceInfo();
SourceInfo* si = new SourceInfo(source->parent_module, source->scoping, node, body);
if (args)
cl = new CLFunction(args->args.size(), args->defaults.size(), args->vararg.size(), args->kwarg.size(), si);
cl = new CLFunction(args->args.size(), args->defaults.size(), args->vararg.size(), args->kwarg.size(),
si);
else
cl = new CLFunction(0, 0, 0, 0, si);
}
......
......@@ -218,6 +218,8 @@ public:
};
ArgNames arg_names;
// TODO we're currently copying the body of the AST into here, since lambdas don't really have a statement-based
// body and we have to create one. Ideally, we'd be able to avoid the space duplication for non-lambdas.
const std::vector<AST_stmt*> body;
const std::string getName();
......
......@@ -10,3 +10,8 @@ print t("test \tstr\ni\n ng")
def T(y):
return (lambda x: x < y)
print T(10)(1), T(10)(20)
# Lambda closures:
def f(x):
print map(lambda y: x * y, range(10))
f(3)
......@@ -35,7 +35,7 @@ TEST_F(AnalysisTest, augassign) {
ASSERT_FALSE(scope_info->refersToGlobal("a"));
ASSERT_FALSE(scope_info->refersToGlobal("b"));
SourceInfo* si = new SourceInfo(createModule("__main__", fn), scoping, func);
SourceInfo* si = new SourceInfo(createModule("__main__", fn), scoping, func, func->body);
CFG* cfg = computeCFG(si, func->body);
LivenessAnalysis* liveness = computeLivenessInfo(cfg);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment