MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / assign

Method assign

Engine/source/console/compiler.cpp:158–176  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

156using namespace Compiler;
157
158S32 FuncVars::assign(StringTableEntry var, TypeReq currentType, S32 lineNumber, bool isConstant)
159{
160 std::unordered_map<StringTableEntry, Var>::iterator found = vars.find(var);
161 if (found != vars.end())
162 {
163 if (found->second.isConstant)
164 {
165 const char* str = avar("Script Warning: Reassigning variable %s when it is a constant. File: %s Line : %d", var, CodeBlock::smCurrentParser->getCurrentFile(), lineNumber);
166 scriptErrorHandler(str);
167 }
168 return found->second.reg;
169 }
170
171 S32 id = counter++;
172 vars[var] = { id, currentType, var, isConstant };
173 variableNameMap[id] = var;
174
175 return id;
176}
177
178S32 FuncVars::lookup(StringTableEntry var, S32 lineNumber)
179{

Callers 2

compileStmtMethod · 0.45
compileMethod · 0.45

Calls 4

avarFunction · 0.85
scriptErrorHandlerFunction · 0.85
findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected