Ejemplo n.º 1
0
 public CastSymbol(PrimitiveType type, ClassSymbol from, ClassSymbol to)
     : base(RoutineType.FunctionConverter, TokenType.Unknoun)
 {
     Name = to.Name;
     PrimitiveType = type;
     _Arguments = ArgumentSymbol.MakeParameters(from);
     _CallReturnType = to;
 }
Ejemplo n.º 2
0
 private static bool ContainClass(ClassSymbol cls, Scope type)
 {
     if(type is ClassTemplateInstance)
     {
         var tis = (ClassTemplateInstance)type;
         return tis.ContainClass(cls);
     }
     else if(type is ClassSymbol)
     {
         return cls == type;
     }
     else
     {
         return false;
     }
 }
 internal bool ContainClass(ClassSymbol cls)
 {
     var m = Type as ModifyTypeSymbol;
     if (m != null && ModifyTypeSymbol.HasInheritModify(m.ModifyType))
     {
         return Parameters[0] == cls;
     }
     return false;
 }
Ejemplo n.º 4
0
 public ThisSymbol(ClassSymbol dataType)
     : base(VariantType.Var)
 {
     Name = "this";
     _DataType = dataType;
 }
Ejemplo n.º 5
0
 private ClassSymbol ImportPureType(Type type)
 {
     var elem = new ClassSymbol();
     if (ImportDictionary.ContainsKey(type))
     {
         return (ClassSymbol)ImportDictionary[type];
     }
     ImportDictionary.Add(type, elem);
     ClassType classType;
     var attribute = new List<AttributeSymbol>();
     AppendEmbededAttribute(attribute, type, out classType);
     var generic = CreateGenericList(type.GetGenericArguments());
     var inherit = CreateInheritList(type);
     var block = new ProgramContext();
     var ctor = type.GetConstructors(Binding);
     foreach (var c in ctor)
     {
         if(c.IsAssembly || c.IsFamilyAndAssembly || c.IsPrivate)
         {
             continue;
         }
         block.Append(ImportConstructor(c));
     }
     //todo Eventのインポートに対応する。
     //var eve = type.GetEvents();
     //foreach (var e in eve)
     //{
     //    block.Append(ImportEvent(e));
     //}
     var property = type.GetProperties(Binding);
     foreach (var p in property)
     {
         var name = p.GetIndexParameters().Count() > 0 ? RoutineSymbol.AliasCallIdentifier : p.Name;
         var g = p.GetMethod;
         if (g != null && !g.IsAssembly && !g.IsFamilyAndAssembly && !g.IsPrivate)
         {
             block.Append(ImportProperty(p.GetMethod, name));
         }
         var s = p.SetMethod;
         if (s != null && !s.IsAssembly && !s.IsFamilyAndAssembly && !s.IsPrivate)
         {
             block.Append(ImportProperty(p.SetMethod, name));
         }
     }
     var method = type.GetMethods(Binding);
     foreach (var m in method)
     {
         if (m.IsAssembly || m.IsFamilyAndAssembly || m.IsPrivate)
         {
             continue;
         }
         if(ImportDictionary.ContainsKey(m))
         {
             continue;
         }
         block.Append(ImportMethod(m));
     }
     var field = type.GetFields(Binding);
     foreach (var f in field)
     {
         if (f.IsAssembly || f.IsFamilyAndAssembly || f.IsPrivate)
         {
             continue;
         }
         block.Append(ImportField(f));
     }
     var nested = type.GetNestedTypes(Binding);
     foreach (var n in nested)
     {
         if (n.IsNestedAssembly || n.IsNestedFamANDAssem || n.IsNestedPrivate)
         {
             continue;
         }
         block.Append(ImportType(n));
     }
     elem.Initialize(TrimTypeNameMangling(type.Name), classType, block, attribute, generic, inherit);
     return elem;
 }