diff --git a/Sema.fu b/Sema.fu index 24a936a5..0d1a6344 100644 --- a/Sema.fu +++ b/Sema.fu @@ -2148,6 +2148,8 @@ public class FuSema method.Type = this.Host.Program.System.VoidType; else ResolveType(method); + if (method.Name == "ToString" && method.CallType != FuCallType.Static && method.Parameters.Count() == 1) + method.Id = FuId.ClassToString; for (FuVar!? param = method.FirstParameter(); param != null; param = param.NextVar()) { ResolveType(param); if (param.Value != null) { @@ -2213,8 +2215,6 @@ public class FuSema } break; case FuMethod! method: - if (method.Name == "ToString" && method.CallType != FuCallType.Static && method.Parameters.Count() == 1) - method.Id = FuId.ClassToString; if (method.Body != null) { if (method.CallType == FuCallType.Override || method.CallType == FuCallType.Sealed) { if (klass.Parent.TryLookup(method.Name, false) is FuMethod! baseMethod) { diff --git a/libfut.cpp b/libfut.cpp index 34df369b..6356c6b2 100644 --- a/libfut.cpp +++ b/libfut.cpp @@ -6515,6 +6515,8 @@ void FuSema::resolveTypes(FuClass * klass) method->type = this->host->program->system->voidType; else resolveType(method); + if (method->name == "ToString" && method->callType != FuCallType::static_ && method->parameters.count() == 1) + method->id = FuId::classToString; for (FuVar * param = method->firstParameter(); param != nullptr; param = param->nextVar()) { resolveType(param); if (param->value != nullptr) { @@ -6581,8 +6583,6 @@ void FuSema::resolveCode(FuClass * klass) } } else if (FuMethod *method = dynamic_cast(symbol)) { - if (method->name == "ToString" && method->callType != FuCallType::static_ && method->parameters.count() == 1) - method->id = FuId::classToString; if (method->body != nullptr) { if (method->callType == FuCallType::override_ || method->callType == FuCallType::sealed) { if (FuMethod *baseMethod = dynamic_cast(klass->parent->tryLookup(method->name, false).get())) { diff --git a/libfut.cs b/libfut.cs index 201fe727..2ddd5956 100644 --- a/libfut.cs +++ b/libfut.cs @@ -6612,6 +6612,8 @@ void ResolveTypes(FuClass klass) method.Type = this.Host.Program.System.VoidType; else ResolveType(method); + if (method.Name == "ToString" && method.CallType != FuCallType.Static && method.Parameters.Count() == 1) + method.Id = FuId.ClassToString; for (FuVar param = method.FirstParameter(); param != null; param = param.NextVar()) { ResolveType(param); if (param.Value != null) { @@ -6677,8 +6679,6 @@ void ResolveCode(FuClass klass) } break; case FuMethod method: - if (method.Name == "ToString" && method.CallType != FuCallType.Static && method.Parameters.Count() == 1) - method.Id = FuId.ClassToString; if (method.Body != null) { if (method.CallType == FuCallType.Override || method.CallType == FuCallType.Sealed) { if (klass.Parent.TryLookup(method.Name, false) is FuMethod baseMethod) { diff --git a/libfut.js b/libfut.js index 81afcbf9..6177245b 100644 --- a/libfut.js +++ b/libfut.js @@ -6977,6 +6977,8 @@ export class FuSema method.type = this.#host.program.system.voidType; else this.#resolveType(method); + if (method.name == "ToString" && method.callType != FuCallType.STATIC && method.parameters.count() == 1) + method.id = FuId.CLASS_TO_STRING; for (let param = method.firstParameter(); param != null; param = param.nextVar()) { this.#resolveType(param); if (param.value != null) { @@ -7043,8 +7045,6 @@ export class FuSema } else if (symbol instanceof FuMethod) { const method = symbol; - if (method.name == "ToString" && method.callType != FuCallType.STATIC && method.parameters.count() == 1) - method.id = FuId.CLASS_TO_STRING; if (method.body != null) { if (method.callType == FuCallType.OVERRIDE || method.callType == FuCallType.SEALED) { let baseMethod;