Beispiel #1
0
        protected override void DoExpand(MacroContext context)
        {
            if (context.Invocation.Arguments.Count < 1)
            {
                context.ReportMessage(
                    Message.Error(
                        string.Format(Resources.Pack_Usage_obj_missing, Alias),
                        context.Invocation.Position, MessageClasses.PackUsage));
                return;
            }

            context.EstablishMacroContext();

            // [| context.StoreForTransport(boxed($arg0)) |]

            var getContext = context.CreateIndirectCall(context.CreateCall(
                EntityRef.Variable.Local.Create(MacroAliases.ContextAlias)));
            var boxedArg0 = context.CreateCall(EntityRef.Command.Create(Engine.BoxedAlias),PCall.Get,
                                               context.Invocation.Arguments[0]);
            context.Block.Expression = context.CreateGetSetMember(getContext, PCall.Get, "StoreForTransport", boxedArg0);
        }
Beispiel #2
0
 private static void _extractReturnVariant(MacroContext context, string resultV,
     string retVarV)
 {
     var inv = context.Invocation;
     var intT = new AstConstantTypeExpression(inv.File, inv.Line, inv.Column,
         IntPType.Literal);
     var getRetVar =
         context.CreateGetSetMember(context.CreateCall(EntityRef.Variable.Local.Create(resultV)), PCall.Get,
                                    "Key");
     var asInt = new AstTypecast(inv.File, inv.Line, inv.Column, getRetVar, intT);
     var setRetVar = context.CreateCall(EntityRef.Variable.Local.Create(retVarV), PCall.Set, asInt);
     context.Block.Add(setRetVar);
 }
Beispiel #3
0
 private static void _extractReturnValue(MacroContext context, string resultV,
     string retValueV)
 {
     var getRetValue =
         context.CreateGetSetMember(
             context.CreateCall(EntityRef.Variable.Local.Create(resultV)), PCall.Get, "Value");
     var setRetValue = context.CreateCall(EntityRef.Variable.Local.Create(retValueV), PCall.Set, getRetValue);
     context.Block.Add(setRetValue);
 }