예제 #1
0
 public Local GetLocalWithValue(Type type, Compiler.Local fromValue)
 {
     if (fromValue != null)
     {
         if (fromValue.Type == type) return fromValue.AsCopy();
         // otherwise, load onto the stack and let the default handling (below) deal with it
         LoadValue(fromValue);
         if (!type.IsValueType && (fromValue.Type == null || !type.IsAssignableFrom(fromValue.Type)))
         { // need to cast
             Cast(type);
         }
     }
     // need to store the value from the stack
     Local result = new Local(this, type);
     StoreValue(result);
     return result;
 }
 public Local GetLocalWithValue(Type type, Compiler.Local fromValue) {
     if (fromValue != null) { return fromValue.AsCopy(); }
     // need to store the value from the stack
     Local result = new Local(this, type);
     StoreValue(result);
     return result;
 }