public override void ExitInterfaceType(GolangParser.InterfaceTypeContext context) { if (context.methodSpec()?.Length == 0) { // Handle empty interface type as a special case Types[context.Parent.Parent] = TypeInfo.EmptyInterfaceType; } else { // All other intra-function scoped declared interfaces // are defined as dynamic so they can behave like ducks Types[context.Parent.Parent] = TypeInfo.DynamicType; } }
public override void ExitInterfaceType(GolangParser.InterfaceTypeContext context) { if (context.methodSpec()?.Length == 0) { // Handle empty interface type as a special case Types[context.Parent.Parent] = TypeInfo.ObjectType; // Object is more universal than EmptyInterface - which is handy when literals are involved //Types[context.Parent.Parent] = TypeInfo.EmptyInterfaceType; } else { // TODO: Turn into a strongly typed object and declare prior to function // All other intra-function scoped declared interfaces // are defined as dynamic so they can behave like ducks Types[context.Parent.Parent] = TypeInfo.DynamicType; } }