Example #1
0
        public static DMExpression Create(DMObject dmObject, DMProc proc, DMASTExpression expression, DreamPath?inferredPath = null)
        {
            var instance = new DMVisitorExpression(dmObject, proc, inferredPath);

            expression.Visit(instance);
            return(instance.Result);
        }
Example #2
0
 // Emits a reference that is to be used in an opcode that assigns/gets a value
 // May throw if this expression is unable to be referenced
 public virtual (DMReference Reference, bool Conditional) EmitReference(DMObject dmObject, DMProc proc)
 {
     throw new CompileErrorException(Location, $"attempt to reference r-value");
 }
Example #3
0
 // Emits code that pushes the result of this expression to the proc's stack
 // May throw if this expression is unable to be pushed to the stack
 public abstract void EmitPushValue(DMObject dmObject, DMProc proc);
Example #4
0
        public static bool TryConstant(DMObject dmObject, DMProc proc, DMASTExpression expression, out Expressions.Constant constant)
        {
            var expr = Create(dmObject, proc, expression, null);

            return(expr.TryAsConstant(out constant));
        }
Example #5
0
        public static void Emit(DMObject dmObject, DMProc proc, DMASTExpression expression, DreamPath?inferredPath = null)
        {
            var expr = Create(dmObject, proc, expression, inferredPath);

            expr.EmitPushValue(dmObject, proc);
        }