Beispiel #1
0
        public VariableInstance CompileVariableInstance(CmlContext context)
        {
            CmlScriptRequest request = InitializeRequest(context);

            ILValue il_value        = GetExpression().GetValue().GetILValue();
            Type    expression_type = il_value.GetValueType();

            CmlScriptValue_Argument value_argument = request.AddPrimaryArgument(
                new CmlScriptValue_Argument_Single_Placeholder(expression_type)
                );

            CmlScriptDefinition_Link definition = definitions.GetOrCreateValue(request.GetSignature(), delegate() {
                return(new CmlScriptDefinition_Link(
                           expression_type,

                           "CmlLink[" + stored_text + "]",

                           il_value.CanStore().IfTrue(() =>
                                                      GetType().CreateDynamicMethodDelegate <Process <object, object, object> >(
                                                          "CmlLink_Store[" + stored_text + "]",
                                                          new ILAssign(il_value, value_argument.GetILValue())
                                                          )
                                                      ),

                           il_value.CanLoad().IfTrue(() =>
                                                     GetType().CreateDynamicMethodDelegate <Operation <object, object, object, object> >(
                                                         "CmlLink_Load[" + stored_text + "]",
                                                         new ILReturn(il_value)
                                                         )
                                                     )
                           ));
            });

            return(definition.CreateVariableInstance(request));
        }
Beispiel #2
0
 public override ILValue GetILValue()
 {
     return(this_argument.GetILValue());
 }