コード例 #1
0
ファイル: CastSymbol.cs プロジェクト: B-head/Dreit-prototype
 public CastSymbol(PrimitiveType type, ClassSymbol from, ClassSymbol to)
     : base(RoutineType.FunctionConverter, TokenType.Unknoun)
 {
     Name = to.Name;
     PrimitiveType = type;
     _Arguments = ArgumentSymbol.MakeParameters(from);
     _CallReturnType = to;
 }
コード例 #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;
     }
 }
コード例 #3
0
 internal bool ContainClass(ClassSymbol cls)
 {
     var m = Type as ModifyTypeSymbol;
     if (m != null && ModifyTypeSymbol.HasInheritModify(m.ModifyType))
     {
         return Parameters[0] == cls;
     }
     return false;
 }
コード例 #4
0
ファイル: ThisSymbol.cs プロジェクト: B-head/Dreit-prototype
 public ThisSymbol(ClassSymbol dataType)
     : base(VariantType.Var)
 {
     Name = "this";
     _DataType = dataType;
 }
コード例 #5
0
ファイル: CilImport.cs プロジェクト: B-head/Dreit-prototype
 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;
 }