Пример #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));
        }
Пример #2
0
        public void Compile(CmlContext context, CmlScriptRequest request, CmlScriptValue this_value)
        {
            CmlScriptValue_Argument_Host parameter_host = request.AddPrimaryArgument(new CmlScriptValue_Argument_Host());

            GetFunctionParameters().Process(p => p.Inject(parameter_host, request));
        }