Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ CompileNewExpression()

void System.Linq.Expressions.Interpreter.LightCompiler.CompileNewExpression ( Expression expr)
inlineprivate

Definition at line 1790 of file LightCompiler.cs.

1791 {
1792 NewExpression newExpression = (NewExpression)expr;
1793 if (newExpression.Constructor != null)
1794 {
1795 if (newExpression.Constructor.DeclaringType.IsAbstract)
1796 {
1797 throw Error.NonAbstractConstructorRequired();
1798 }
1799 ParameterInfo[] parametersCached = newExpression.Constructor.GetParametersCached();
1800 List<ByRefUpdater> list = null;
1801 for (int i = 0; i < parametersCached.Length; i++)
1802 {
1803 Expression argument = newExpression.GetArgument(i);
1804 if (parametersCached[i].ParameterType.IsByRef)
1805 {
1806 ByRefUpdater byRefUpdater = CompileAddress(argument, i);
1807 if (byRefUpdater != null)
1808 {
1809 if (list == null)
1810 {
1811 list = new List<ByRefUpdater>();
1812 }
1813 list.Add(byRefUpdater);
1814 }
1815 }
1816 else
1817 {
1819 }
1820 }
1821 if (list != null)
1822 {
1824 }
1825 else
1826 {
1828 }
1829 }
1830 else
1831 {
1832 Type type = newExpression.Type;
1833 if (type.IsNullableType())
1834 {
1835 _instructions.EmitLoad(null);
1836 }
1837 else
1838 {
1840 }
1841 }
1842 }
void EmitNew(ConstructorInfo constructorInfo, ParameterInfo[] parameters)
void EmitByRefNew(ConstructorInfo constructorInfo, ParameterInfo[] parameters, ByRefUpdater[] updaters)
void Compile(Expression expr, bool asVoid)
ByRefUpdater CompileAddress(Expression node, int index)

References System.Linq.Expressions.Interpreter.LightCompiler._instructions, System.Linq.Expressions.Interpreter.LightCompiler.Compile(), System.Linq.Expressions.Interpreter.LightCompiler.CompileAddress(), System.Linq.Expressions.Interpreter.InstructionList.EmitByRefNew(), System.Linq.Expressions.Interpreter.InstructionList.EmitDefaultValue(), System.Linq.Expressions.Interpreter.InstructionList.EmitLoad(), System.Linq.Expressions.Interpreter.InstructionList.EmitNew(), System.list, System.Linq.Expressions.Error.NonAbstractConstructorRequired(), and System.type.

Referenced by System.Linq.Expressions.Interpreter.LightCompiler.CompileNoLabelPush().