예제 #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);
        }
예제 #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");
 }
예제 #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);
예제 #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));
        }
예제 #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);
        }