Use make_intrusive/make_shared for smart pointer construction.

This commit is contained in:
Twan van Laarhoven
2020-04-23 23:51:34 +02:00
parent 815df01ba5
commit 708b4389a0
67 changed files with 313 additions and 329 deletions
+3 -3
View File
@@ -68,13 +68,13 @@ private:
// Unify two values from different execution paths
void unify(ScriptValueP& a, const ScriptValueP& b) {
assert(a && b);
if (a != b) a = intrusive(new DependencyUnion(a,b));
if (a != b) a = make_intrusive<DependencyUnion>(a,b);
}
// Unify two values from different execution paths
ScriptValueP unified(const ScriptValueP& a, const ScriptValueP& b) {
assert(a && b);
if (a == b) return a;
else return intrusive(new DependencyUnion(a,b));
else return make_intrusive<DependencyUnion>(a,b);
}
/// Behaves like script_nil, but with a name
@@ -293,7 +293,7 @@ ScriptValueP Context::dependencies(const Dependency& dep, const Script& script)
case I_GET_VAR: {
ScriptValueP value = variables[i.data].value;
if (!value) {
value = intrusive(new ScriptMissingVariable(variable_to_string((Variable)i.data))); // no errors here
value = make_intrusive<ScriptMissingVariable>(variable_to_string((Variable)i.data)); // no errors here
}
value->dependencyThis(dep);
stack.push_back(value);