public void Export(TextWriter writer, int intent) { if (Attribute != null) { Attribute.Export(writer, intent); } writer.WriteIntent(intent); writer.Write("{0} ", Keyword); if (IsNew) { writer.Write("new "); } string name = Type.GetTypeNestedName(DeclaringType); name = ScriptType.IsEngineObject(Type.Namespace, name) ? $"{Type.Namespace}.{name}" : name; writer.WriteLine("{0} {1};", name, Name); }
private string GetTypeNestedName(ScriptExportType type) { if (ScriptType.IsEngineObject(type.Namespace, type.Name)) { return($"{type.Namespace}.{type.Name}"); } if (type.DeclaringType == null) { return(type.Name); } if (type.DeclaringType == DeclaringType) { return(type.Name); } string declaringName = GetTypeNestedName(type.DeclaringType); return($"{declaringName}.{type.Name}"); }
public string GetTypeNestedName(ScriptExportType relativeType) { if(relativeType == null) { return Name; } if (ScriptType.IsEngineObject(Namespace, Name)) { return $"{Namespace}.{Name}"; } if (DeclaringType == null) { return TypeName; } if (relativeType == DeclaringType) { return TypeName; } string declaringName = DeclaringType.GetTypeNestedName(relativeType); return $"{declaringName}.{TypeName}"; }