示例#1
0
 public DMVariable(DreamPath?type, string name, bool isGlobal)
 {
     Type     = type;
     Name     = name;
     IsGlobal = isGlobal;
     Value    = null;
 }
示例#2
0
 public ListIndex(Location location, DMExpression expr, DMExpression index, DreamPath?path, bool conditional)
     : base(location, path)
 {
     _expr        = expr;
     _index       = index;
     _conditional = conditional;
 }
示例#3
0
 public Dereference(Location location, DreamPath?path, DMExpression expr, bool conditional, string propertyName)
     : base(location, null)
 {
     _expr        = expr;
     _conditional = conditional;
     PropertyName = propertyName;
     _path        = path;
 }
示例#4
0
        public void VisitUpwardPathSearch(DMASTUpwardPathSearch constant)
        {
            DMExpression.TryConstant(_dmObject, _proc, constant.Path, out var pathExpr);
            if (pathExpr is not Expressions.Path)
            {
                throw new CompileErrorException(constant.Location, "Cannot do an upward path search on " + pathExpr);
            }

            DreamPath path      = ((Expressions.Path)pathExpr).Value;
            DreamPath?foundPath = DMObjectTree.UpwardSearch(path, constant.Search.Path);

            if (foundPath == null)
            {
                throw new CompileErrorException(constant.Location, $"Invalid path {path}.{constant.Search.Path}");
            }

            Result = new Expressions.Path(constant.Location, foundPath.Value);
        }
示例#5
0
 public LocalConstVariable(int id, DreamPath?type, Expressions.Constant value) : base(id, false, type)
 {
     Value = value;
 }
示例#6
0
 public LocalVariable(int id, bool isParameter, DreamPath?type)
 {
     Id          = id;
     IsParameter = isParameter;
     Type        = type;
 }
示例#7
0
 public LValue(Location location, DreamPath?path) : base(location)
 {
     _path = path;
 }
示例#8
0
 public Src(Location location, DreamPath?path)
     : base(location, path)
 {
 }
示例#9
0
 public GlobalField(Location location, DreamPath?path, int id)
     : base(location, path)
 {
     Id = id;
 }
示例#10
0
 internal DMVisitorExpression(DMObject dmObject, DMProc proc, DreamPath?inferredPath)
 {
     _dmObject     = dmObject;
     _proc         = proc;
     _inferredPath = inferredPath;
 }
示例#11
0
 public DreamValueAsObjectEnumerator(IEnumerable <DreamValue> dreamValues, DreamPath?filterType = null)
 {
     _dreamValueEnumerator = dreamValues.GetEnumerator();
     _filterType           = filterType;
 }
示例#12
0
 public DreamObjectEnumerator(IEnumerable <DreamObject> dreamObjects, DreamPath?filterType = null)
 {
     _dreamObjectEnumerator = dreamObjects.GetEnumerator();
     _filterType            = filterType;
 }
示例#13
0
 public DMLocalVariable(int id, DreamPath?type)
 {
     Id   = id;
     Type = type;
 }
示例#14
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);
        }
示例#15
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);
        }