public void CheckSemantic(FeatureListNode node, IScope scope = null) { if (node.Features == null) { return; } foreach (var featureNode in node.Features) { switch (featureNode) { case LocalOrFieldInit localOrFieldInit: CheckSemantic(localOrFieldInit, scope); break; case MethodNode method: CheckSemantic(method, scope); break; } } }
public void CheckSemantic(FeatureListNode node, IScope scope = null) { if (node.Features == null) { return; } foreach (var feature in node.Features) { switch (feature) { case LocalOrFieldInit localOrFieldInit: CheckSemantic(localOrFieldInit, scope); break; case MethodNode methodNode: var cls = scope as IType; CheckSemantic(methodNode, scope); if (methodNode.FuncName != "main") { continue; } if (cls.Name != "Main" || !cls.IsDefinedMethod(methodNode.FuncName, out var method)) { continue; } if (method.Arguments.Count() > 0) { Logger.LogError(methodNode.Line, methodNode.CharPositionInLine, $"The '{cls}' class must have a method '{method.Name}' that no takes no formal parameters"); } break; } } }