예제 #1
0
 public T Load <T>(CecilatorBase cecilatorBase) where T : class
 {
     if (cecilatorBase is Field field)
     {
         return(this.Load(field) as T ?? throw new InvalidCastException($"Can't be casted to {typeof(T).FullName}"));
     }
     if (cecilatorBase is LocalVariable variable)
     {
         return(this.Load(variable) as T ?? throw new InvalidCastException($"Can't be casted to {typeof(T).FullName}"));
     }
     throw new NotImplementedException("This is only available for Field and LocalVariable");
 }
예제 #2
0
    public static void ImplementAssignMethodAttribute(Builder builder, AssignMethodAttributeInfo[] assignMethodAttributeInfos, CecilatorBase cecilatorBase, BuilderType contentType, Coder coder)
    {
        switch (cecilatorBase)
        {
        case Field field:
            ImplementAssignMethodAttribute(builder, assignMethodAttributeInfos, field, contentType, coder);
            break;

        case LocalVariable variable:
            ImplementAssignMethodAttribute(builder, assignMethodAttributeInfos, variable, contentType, coder);
            break;

        default:
            throw new NotImplementedException("This is only available for Field and LocalVariable");
        }
    }