Ejemplo n.º 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));
        }
Ejemplo n.º 2
0
        public CmlScriptValue_Argument AddArgument(CmlScriptValue_Argument to_add)
        {
            arguments.Add(to_add);
            to_add.Initialize(GetILValue().GetILIndexed(arguments.GetFinalIndex()));

            return(to_add);
        }
Ejemplo n.º 3
0
        public CmlScriptValue GetParentValue()
        {
            if (parent_argument == null)
            {
                parent_argument = GetTargetInfo().GetImmediateParent()
                                  .IfNotNull(p => AddSecondaryArgument(new CmlScriptValue_Argument_Single_Constant(p)));
            }

            return(parent_argument);
        }
Ejemplo n.º 4
0
        public void AddPrimaryArgument(CmlScriptValue_Argument to_add)
        {
            arguments.Add(to_add);

            to_add.Initialize(
                new ILVirtualParameter(
                    to_add.GetValueType(),
                    arguments.GetFinalIndex()
                    )
                );
        }
Ejemplo n.º 5
0
        public CmlScriptValue InsertThisRepresentationValue()
        {
            if (this_representation_argument == null)
            {
                this_representation_argument = context.GetRepresentationSpace()
                                               .IfNotNull(s => s.GetRepresentation())
                                               .IfNotNull(r => AddSecondaryArgument(new CmlScriptValue_Argument_Single_Constant(r)));
            }

            return(this_representation_argument);
        }
Ejemplo n.º 6
0
        public CmlScriptRequest(CmlContext c)
        {
            context = c;

            arguments       = new List <CmlScriptValue_Argument>();
            indirect_values = new Dictionary <string, CmlScriptValue>();

            this_argument = AddPrimaryArgument(new CmlScriptValue_Argument_Single_Constant(context.GetTargetInfo().GetTarget()));
            host_argument = AddPrimaryArgument(new CmlScriptValue_Argument_Host());

            parent_argument          = null;
            parent_of_type_arguments = new Dictionary <Type, CmlScriptValue_Argument>();

            this_representation_argument = null;
            insert_representation_values = new Dictionary <string, CmlScriptValue>();
        }
Ejemplo n.º 7
0
 public CmlScriptValue_Argument AddSecondaryArgument(CmlScriptValue_Argument to_add)
 {
     return(host_argument.AddArgument(to_add));
 }