Exemplo n.º 1
0
        public override (DMReference Reference, bool Conditional) EmitReference(DMObject dmObject, DMProc proc)
        {
            _expr.EmitPushValue(dmObject, proc);
            _index.EmitPushValue(dmObject, proc);

            return(DMReference.ListIndex, _conditional);
        }
Exemplo n.º 2
0
 public override void EmitPushValue(DMObject dmObject, DMProc proc)
 {
     _x.EmitPushValue(dmObject, proc);
     _y.EmitPushValue(dmObject, proc);
     _z.EmitPushValue(dmObject, proc);
     proc.LocateCoordinates();
 }
Exemplo n.º 3
0
 public override void EmitPushValue(DMObject dmObject, DMProc proc)
 {
     _var.EmitPushValue(dmObject, proc);
     _start.EmitPushValue(dmObject, proc);
     _end.EmitPushValue(dmObject, proc);
     proc.IsInRange();
 }
Exemplo n.º 4
0
        public override void EmitPushValue(DMObject dmObject, DMProc proc)
        {
            if (_b != null)
            {
                _b.EmitPushValue(dmObject, proc);
            }

            _a.EmitPushValue(dmObject, proc);
            _procArgs.EmitPushArguments(dmObject, proc);
            proc.CallStatement();
        }
Exemplo n.º 5
0
        public override void EmitPushValue(DMObject dmObject, DMProc proc)
        {
            string cLabel   = proc.NewLabelName();
            string endLabel = proc.NewLabelName();

            _a.EmitPushValue(dmObject, proc);
            proc.JumpIfFalse(cLabel);
            _b.EmitPushValue(dmObject, proc);
            proc.Jump(endLabel);
            proc.AddLabel(cLabel);
            _c.EmitPushValue(dmObject, proc);
            proc.AddLabel(endLabel);
        }
Exemplo n.º 6
0
        public override void EmitPushValue(DMObject dmObject, DMProc proc)
        {
            bool weighted = false;

            foreach (PickValue pickValue in _values)
            {
                if (pickValue.Weight != null)
                {
                    weighted = true;
                    break;
                }
            }

            if (weighted)
            {
                if (_values.Length == 1)
                {
                    DMCompiler.Warning(new CompilerWarning(Location, "Weighted pick() with one argument"));
                }

                foreach (PickValue pickValue in _values)
                {
                    DMExpression weight = pickValue.Weight ?? DMExpression.Create(dmObject, proc, new DMASTConstantInteger(Location, 100)); //Default of 100

                    weight.EmitPushValue(dmObject, proc);
                    pickValue.Value.EmitPushValue(dmObject, proc);
                }

                proc.PickWeighted(_values.Length);
            }
            else
            {
                foreach (PickValue pickValue in _values)
                {
                    if (pickValue.Value is Arglist args)
                    {
                        args.EmitPushArglist(dmObject, proc);
                    }
                    else
                    {
                        pickValue.Value.EmitPushValue(dmObject, proc);
                    }
                }

                proc.PickUnweighted(_values.Length);
            }
        }
Exemplo n.º 7
0
        public override void EmitPushValue(DMObject dmObject, DMProc proc)
        {
            _path.EmitPushValue(dmObject, proc);

            if (_container != null)
            {
                _container.EmitPushValue(dmObject, proc);
            }
            else
            {
                if (DMCompiler.Settings.NoStandard)
                {
                    throw new CompileErrorException(Location, "Implicit locate() container is not available with --no-standard");
                }

                DMReference world = DMReference.CreateGlobal(dmObject.GetGlobalVariableId("world").Value);
                proc.PushReferenceValue(world);
            }

            proc.Locate();
        }
Exemplo n.º 8
0
 public override void EmitPushValue(DMObject dmObject, DMProc proc)
 {
     Expr.EmitPushValue(dmObject, proc);
     Arguments.EmitPushArguments(dmObject, proc);
     proc.CreateObject();
 }
Exemplo n.º 9
0
 public void EmitPushArglist(DMObject dmObject, DMProc proc)
 {
     _expr.EmitPushValue(dmObject, proc);
     proc.PushArgumentList();
 }
Exemplo n.º 10
0
 public override void EmitPushValue(DMObject dmObject, DMProc proc)
 {
     _expr.EmitPushValue(dmObject, proc);
     proc.PushPath(_path);
     proc.IsType();
 }
Exemplo n.º 11
0
 public override void EmitPushValue(DMObject dmObject, DMProc proc)
 {
     P.EmitPushValue(dmObject, proc);
     proc.Prob();
 }
Exemplo n.º 12
0
 public override void EmitPushInitial(DMObject dmObject, DMProc proc)
 {
     _expr.EmitPushValue(dmObject, proc);
     proc.Initial(PropertyName);
 }
Exemplo n.º 13
0
 public override (DMReference Reference, bool Conditional) EmitReference(DMObject dmObject, DMProc proc)
 {
     _expr.EmitPushValue(dmObject, proc);
     return(DMReference.CreateProc(_field), _conditional);
 }