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

            // always succeed
            return(new BoolExpr(expr.Position, true));
        }
Beispiel #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);
        }
Beispiel #3
0
 bool IPatternVisitor <bool> .Visit(VariablePattern expr)
 {
     FullyCovered = true;
     return(false);
 }