Exemple #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);
        }
Exemple #2
0
        protected override void DoExpand(MacroContext context)
        {
            if (context.Invocation.Arguments.Count < 1)
            {
                context.ReportMessage(
                    Message.Error(
                        string.Format(
                            "{0} requires at least one argument, the id of the object to unpack.", Alias),
                        context.Invocation.Position, MessageClasses.UnpackUsage));
                return;
            }

            context.EstablishMacroContext();

            // [| macro\unpack\impl(context, $arg0) |]

            var getContext =
                context.CreateIndirectCall(context.CreateCall(EntityRef.Variable.Local.Create(MacroAliases.ContextAlias)));

            context.Block.Expression = context.CreateCall(EntityRef.Command.Create(Impl.Alias),
                                                          PCall.Get, getContext, context.Invocation.Arguments[0]);
        }