Ejemplo n.º 1
0
        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}");
        }
Ejemplo n.º 3
0
		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}";
		}