Commit 7b3dc080 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Change some internal names to start with # and not !

I don't know how well this is followed in practice, but "!"
is supposed to just be for irgen-specific names that should
not make it to other tiers.  The closure and generator variables
are more like part of the inter-tier contract, so I think make more
sense as "#" names.
parent c0c53c3d
......@@ -272,9 +272,9 @@ static std::vector<const std::string*>* getKeywordNameStorage(AST_Call* node) {
return rtn;
}
const std::string CREATED_CLOSURE_NAME = "!created_closure";
const std::string PASSED_CLOSURE_NAME = "!passed_closure";
const std::string PASSED_GENERATOR_NAME = "!passed_generator";
const std::string CREATED_CLOSURE_NAME = "#created_closure";
const std::string PASSED_CLOSURE_NAME = "#passed_closure";
const std::string PASSED_GENERATOR_NAME = "#passed_generator";
bool isIsDefinedName(const std::string& name) {
return startswith(name, "!is_defined_");
......@@ -878,7 +878,7 @@ private:
assert(!is_kill);
assert(scope_info->takesClosure());
CompilerVariable* closure = _getFake(internString(PASSED_CLOSURE_NAME), false);
CompilerVariable* closure = symbol_table[internString(PASSED_CLOSURE_NAME)];
assert(closure);
return closure->getattr(emitter, getEmptyOpInfo(unw_info), &node->id.str(), false);
......@@ -1071,7 +1071,8 @@ private:
}
CompilerVariable* evalYield(AST_Yield* node, UnwindInfo unw_info) {
CompilerVariable* generator = _getFake(internString(PASSED_GENERATOR_NAME), false);
CompilerVariable* generator = symbol_table[internString(PASSED_GENERATOR_NAME)];
assert(generator);
ConcreteCompilerVariable* convertedGenerator = generator->makeConverted(emitter, generator->getBoxType());
......@@ -1271,7 +1272,7 @@ private:
_popFake(defined_name, true);
if (scope_info->saveInClosure(name)) {
CompilerVariable* closure = _getFake(internString(CREATED_CLOSURE_NAME), false);
CompilerVariable* closure = symbol_table[internString(CREATED_CLOSURE_NAME)];
assert(closure);
closure->setattr(emitter, getEmptyOpInfo(unw_info), &name.str(), val);
......@@ -1419,7 +1420,7 @@ private:
// TODO duplication with _createFunction:
CompilerVariable* created_closure = NULL;
if (scope_info->takesClosure()) {
created_closure = _getFake(internString(CREATED_CLOSURE_NAME), false);
created_closure = symbol_table[internString(CREATED_CLOSURE_NAME)];
assert(created_closure);
}
......@@ -1574,10 +1575,10 @@ private:
if (takes_closure) {
if (irstate->getScopeInfo()->createsClosure()) {
created_closure = _getFake(internString(CREATED_CLOSURE_NAME), false);
created_closure = symbol_table[internString(CREATED_CLOSURE_NAME)];
} else {
assert(irstate->getScopeInfo()->passesThroughClosure());
created_closure = _getFake(internString(PASSED_CLOSURE_NAME), false);
created_closure = symbol_table[internString(PASSED_CLOSURE_NAME)];
}
assert(created_closure);
}
......@@ -2279,7 +2280,8 @@ public:
if (scope_info->takesClosure()) {
passed_closure = AI;
_setFake(internString(PASSED_CLOSURE_NAME), new ConcreteCompilerVariable(getPassedClosureType(), AI, true));
symbol_table[internString(PASSED_CLOSURE_NAME)]
= new ConcreteCompilerVariable(getPassedClosureType(), AI, true);
++AI;
}
......@@ -2288,12 +2290,12 @@ public:
passed_closure = embedConstantPtr(nullptr, g.llvm_closure_type_ptr);
llvm::Value* new_closure = emitter.getBuilder()->CreateCall(g.funcs.createClosure, passed_closure);
_setFake(internString(CREATED_CLOSURE_NAME),
new ConcreteCompilerVariable(getCreatedClosureType(), new_closure, true));
symbol_table[internString(CREATED_CLOSURE_NAME)]
= new ConcreteCompilerVariable(getCreatedClosureType(), new_closure, true);
}
if (irstate->getSourceInfo()->is_generator) {
_setFake(internString(PASSED_GENERATOR_NAME), new ConcreteCompilerVariable(GENERATOR, AI, true));
symbol_table[internString(PASSED_GENERATOR_NAME)] = new ConcreteCompilerVariable(GENERATOR, AI, true);
++AI;
}
......
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