public override Value EmitValue(EmitContext context) { if (SourceExpression == null || SourceExpression.IsThis) { return(context.GetUserValue(Field)); } TypeSymbol stringType = context.GetTypeSymbol(SpecialType.System_String); MethodSymbol setProgramVariableMethod = context.GetTypeSymbol(typeof(UdonSharpBehaviour)) .GetMembers <MethodSymbol>("GetProgramVariable", context) .First(e => e.Parameters.Length == 1 && e.Parameters[0].Type == stringType); return(context.CastValue(context.EmitValue(BoundInvocationExpression.CreateBoundInvocation(context, SyntaxNode, setProgramVariableMethod, SourceExpression, new BoundExpression[] { BindAccess(context.GetConstantValue(stringType, Field.Name)) })), Field.Type, true)); }
public override Value EmitValue(EmitContext context) { return(context.CastValue(context.EmitValue(SourceExpression), TargetType, IsExplicit)); }