Пример #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));
 }
Пример #2
0
 public PostOpReference(PostOpDeclaration op, Expression oper, SourcePosition start, SourcePosition end)
     : base(ASTNodeType.InOpRef, start, end)
 {
     Operator = op;
     Operand  = oper;
 }
Пример #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;
        }
Пример #4
0
 public PostOpReference(PostOpDeclaration op, Expression oper, SourcePosition start, SourcePosition end)
     : base(ASTNodeType.InOpRef, start, end)
 {
     Operator = op;
     Operand = oper;
 }
Пример #5
0
 public bool IdenticalSignature(PostOpDeclaration other)
 {
     return base.IdenticalSignature(other)
         && this.Operand.VarType.Name.ToLower() == other.Operand.VarType.Name.ToLower();
 }
Пример #6
0
 public bool IdenticalSignature(PostOpDeclaration other)
 {
     return(base.IdenticalSignature(other) &&
            this.Operand.VarType.Name.ToLower() == other.Operand.VarType.Name.ToLower());
 }