Inheritance: CompositeNode, ICloneable
Exemplo n.º 1
0
Arquivo: class.cs Projeto: shugo/babel
 public virtual void IncludeTo(ClassDefinition cls,
                       FeatureModifier featureModifier)
 {
 }
Exemplo n.º 2
0
Arquivo: class.cs Projeto: shugo/babel
 public virtual void IncludeTo(ClassDefinition cls,
                               FeatureModifier featureModifier)
 {
     AttrDefinition attr = (AttrDefinition) Clone();
     attr.name = featureModifier.NewName;
     switch (featureModifier.NewModifier) {
     case IncludeModifier.None:
         attr.modifier = AttrModifier.None;
         break;
     case IncludeModifier.Private:
         attr.modifier = AttrModifier.Private;
         break;
     case IncludeModifier.Readonly:
         attr.modifier = AttrModifier.Readonly;
         break;
     }
     cls.AddChild(attr);
 }
Exemplo n.º 3
0
Arquivo: class.cs Projeto: shugo/babel
 public virtual void IncludeTo(ClassDefinition cls,
                               FeatureModifier featureModifier)
 {
     ConstDefinition constDef = (ConstDefinition) Clone();
     constDef.name = featureModifier.NewName;
     switch (featureModifier.NewModifier) {
     case IncludeModifier.None:
         constDef.modifier = ConstModifier.None;
         break;
     case IncludeModifier.Private:
         constDef.modifier = ConstModifier.Private;
         break;
     }
     cls.AddChild(constDef);
 }
Exemplo n.º 4
0
 public override void VisitClass(ClassDefinition cls)
 {
     ClassDefinition prevClass = currentClass;
     currentClass = cls;
     cls.Children.Accept(this);
     currentClass = prevClass;
 }
Exemplo n.º 5
0
Arquivo: class.cs Projeto: shugo/babel
 public virtual void IncludeTo(ClassDefinition cls,
                               FeatureModifier featureModifier)
 {
     RoutineDefinition rout = (RoutineDefinition) Clone();
     rout.name = featureModifier.NewName;
     switch (featureModifier.NewModifier) {
     case IncludeModifier.None:
         rout.modifier = RoutineModifier.None;
         break;
     case IncludeModifier.Private:
         rout.modifier = RoutineModifier.Private;
         break;
     case IncludeModifier.Readonly:
         // FIXME
         break;
     }
     cls.AddChild(rout);
 }
Exemplo n.º 6
0
 protected virtual void CreateAdapterMethods(ClassDefinition cls)
 {
     foreach (SupertypingAdapter adapter in cls.Adapters) {
         adapter.AdapteeField =
             adapter.TypeBuilder.DefineField("__adaptee",
                                             adapter.AdapteeType.RawType,
                                             FieldAttributes.Private);
         Type[] types = new Type[] { adapter.AdapteeType.RawType };
         adapter.Constructor =
             DefineConstructor(adapter.TypeBuilder,
                               MethodAttributes.Public,
                               CallingConventions.Standard,
                               types);
         ArrayList adapteeMethods =
             adapter.AdapteeType.Methods;
         ArrayList supertypeMethods =
             adapter.TypeData.AncestorMethods;
         foreach (MethodData adapteeMethod in adapteeMethods) {
             ArrayList conformableMethods =
                 CheckMethodConformance(adapteeMethod, supertypeMethods);
             foreach (MethodData m in conformableMethods) {
                 AddAdapterMethod(adapter,
                                  m.MethodInfo,
                                  adapteeMethod.MethodInfo);
             }
         }
         TypeData builtinMethodContainer =
             typeManager.GetBuiltinMethodContainer(adapter.AdapteeType);
         if (builtinMethodContainer != null) {
             ArrayList adapteeBuiltinMethods =
                 builtinMethodContainer.Methods;
             foreach (MethodData adapteeMethod in adapteeBuiltinMethods) {
                 ArrayList conformableMethods =
                     CheckMethodConformance(adapteeMethod,
                                            supertypeMethods);
                 foreach (MethodData m in conformableMethods) {
                     AddAdapterMethod(adapter,
                                      m.MethodInfo,
                                      adapteeMethod.MethodInfo);
                 }
             }
         }
         foreach (MethodData method in supertypeMethods) {
             report.Error(cls.Location,
                          "no implementation for {0} in {1}",
                          method, adapter.AdapteeType.FullName);
         }
     }
 }
Exemplo n.º 7
0
 public override void VisitClass(ClassDefinition cls)
 {
     ClassDefinition prevClass = currentClass;
     int prevIterCount = iterCount;
     ArrayList prevAncestorMethods = ancestorMethods;
     currentClass = cls;
     iterCount = 0;
     if (cls.Kind == ClassKind.Abstract) {
         ancestorMethods = null;
     }
     else {
         ancestorMethods = new ArrayList();
         foreach (MethodData m in cls.TypeData.AncestorMethods) {
             if (!m.IsIterCreator)
                 ancestorMethods.Add(m);
         }
     }
     cls.Children.Accept(this);
     if (cls.Kind != ClassKind.Abstract && ancestorMethods.Count > 0) {
         foreach (MethodData method in ancestorMethods) {
             report.Error(cls.Location,
                          "no implementation for {0} in {1}",
                          method,
                          cls.TypeData.FullName);
         }
     }
     CreateAdapterMethods(cls);
     currentClass = prevClass;
     iterCount = prevIterCount;
     ancestorMethods = prevAncestorMethods;
 }
Exemplo n.º 8
0
 public override void VisitClass(ClassDefinition cls)
 {
     currentClass = cls;
     currentType = cls.TypeBuilder;
     nestedTypes = new ArrayList();
     cls.Children.Accept(this);
     if (cls.StaticConstructor != null) {
         cls.StaticConstructorIL.Emit(OpCodes.Ret);
     }
     currentType.CreateType();
     foreach (SupertypingAdapter adapter in cls.Adapters) {
         GenerateAdapter(adapter);
     }
     foreach (TypeBuilder nestedType in nestedTypes) {
         nestedType.CreateType();
     }
 }
Exemplo n.º 9
0
 public virtual void AddClass(ClassDefinition cls)
 {
     classes.Add(cls.Name.ToLower(), cls);
 }
Exemplo n.º 10
0
Arquivo: node.cs Projeto: shugo/babel
 public virtual void VisitClass(ClassDefinition cls)
 {
 }