private void GenLoadConst(Runtime.IType c) { // Every constant can be null. if (c == null) { Gen(new I.LoadNull { }); } // The constant is data. else if (c is Runtime.IDataType) { Program.Const.Register(c as Runtime.IDataType); Gen(new I.LoadStaticField { StaticClass = "Constants", Name = "const" + c.GetHashCode() }); } // The constant is a function. // -> Need a better way to determine if a constant is a function. else if (c.GetType().Namespace.StartsWith("Runtime.Function")) { Gen(new I.NewObject { Type = new RuntimeObject { Type = c.GetType() } }); } // It seems that there aren't other types of constant. else { // This should not happen. throw new NotImplementedException(); } }
public ImmediateNumber(Runtime.IType i) { Imm = i; }