Esempio n. 1
0
        IUnboundExpr IPatternVisitor <IUnboundExpr> .Visit(VariablePattern expr)
        {
            // bind the variable
            mVariables[expr.Name] = mValue;

            // always succeed
            return(new BoolExpr(expr.Position, true));
        }
Esempio n. 2
0
        bool IPatternVisitor <bool> .Visit(VariablePattern expr)
        {
            // make sure the pattern is linear
            if (mUsedVariables.ContainsKey(expr.Name))
            {
                throw new CompileException(
                          expr.Position, "The variable \"" + expr.Name + "\" cannot appear more than once in a single pattern.");
            }

            mUsedVariables[expr.Name] = true;

            // a variable pattern matches any type
            return(true);
        }
Esempio n. 3
0
 bool IPatternVisitor <bool> .Visit(VariablePattern expr)
 {
     FullyCovered = true;
     return(false);
 }