예제 #1
0
        private IType checkOperator(Context context, IType other, bool tryReverse, Operator oper)
        {
            IDeclaration actual = getDeclaration(context);

            if (actual is ConcreteCategoryDeclaration)
            {
                try
                {
                    IMethodDeclaration method = ((ConcreteCategoryDeclaration)actual).findOperator(context, oper, other);
                    if (method == null)
                    {
                        return(null);
                    }
                    context = context.newInstanceContext(this, false);
                    Context local = context.newLocalContext();
                    method.registerParameters(local);
                    return(method.check(local));
                }
                catch (SyntaxError)
                {
                    // ok to pass, will try reverse
                }
            }
            if (tryReverse)
            {
                return(null);
            }
            else
            {
                throw new SyntaxError("Unsupported operation: " + this.typeName + " " + Enums.OperatorToString(oper) + " " + other.GetTypeName());
            }
        }
예제 #2
0
 private IType lightCheck(IMethodDeclaration declaration, Context parent, Context local)
 {
     declaration.registerParameters(local);
     return(declaration.check(local));
 }
예제 #3
0
 public IType check(Context context)
 {
     return(wrapped.check(context));
 }