Beispiel #1
0
 public bool IdenticalSignature(PostOpDeclaration other)
 {
     return(base.IdenticalSignature(other) &&
            string.Equals(this.Operand.VarType.Name.ToLower(), other.Operand.VarType.Name.ToLower(), StringComparison.OrdinalIgnoreCase));
 }
Beispiel #2
0
 public PostOpReference(PostOpDeclaration op, Expression oper, SourcePosition start, SourcePosition end)
     : base(ASTNodeType.InOpRef, start, end)
 {
     Operator = op;
     Operand  = oper;
 }
Beispiel #3
0
        public Expression DecompileNativeFunction(UInt16 index)
        {
            var parameters = new List<Expression>();
            while (!CurrentIs(StandardByteCodes.EndFunctionParms))
            {
                var param = DecompileExpression();
                if (param == null)
                    return null; // ERROR

                parameters.Add(param);
            }
            PopByte();

            var entry = NativeTable[index];
            Expression call = null;

            switch (entry.Type)
            {
                case NativeType.Function:
                    var func = new SymbolReference(null, null, null, entry.Name);
                    call = new FunctionCall(func, parameters, null, null);
                    break;

                case NativeType.Operator:   // TODO: table should hold precedence, currently all have 0 and it'll be a mess.
                    var op = new InOpDeclaration(entry.Name, entry.Precedence, false, null, null, null, null, null, null, null);
                    call = new InOpReference(op, parameters[0], parameters[1], null, null);
                    break;

                case NativeType.PreOperator:   // TODO: table should hold precedence, currently all have 0 and it'll be a mess.
                    var preOp = new PreOpDeclaration(entry.Name, false, null, null, null, null, null, null);
                    call = new PreOpReference(preOp, parameters[0], null, null);
                    break;

                case NativeType.PostOperator:   // TODO: table should hold precedence, currently all have 0 and it'll be a mess.
                    var postOp = new PostOpDeclaration(entry.Name, false, null, null, null, null, null, null);
                    call = new PostOpReference(postOp, parameters[0], null, null);
                    break;
            }

            StartPositions.Pop();
            return call;
        }
Beispiel #4
0
 public PostOpReference(PostOpDeclaration op, Expression oper, SourcePosition start, SourcePosition end)
     : base(ASTNodeType.InOpRef, start, end)
 {
     Operator = op;
     Operand = oper;
 }
Beispiel #5
0
 public bool IdenticalSignature(PostOpDeclaration other)
 {
     return base.IdenticalSignature(other)
         && this.Operand.VarType.Name.ToLower() == other.Operand.VarType.Name.ToLower();
 }
Beispiel #6
0
 public bool IdenticalSignature(PostOpDeclaration other)
 {
     return(base.IdenticalSignature(other) &&
            this.Operand.VarType.Name.ToLower() == other.Operand.VarType.Name.ToLower());
 }