Package org.openquark.cal.compiler.SourceModel

Examples of org.openquark.cal.compiler.SourceModel.FieldPattern


        if(argBindings instanceof ArgBindings.Matching) {
           
            ArgBindings.Matching matchingArgBindings = (ArgBindings.Matching)argBindings;
           
            for (int i = 0; i < matchingArgBindings.getNFieldPatterns(); i++) {
                FieldPattern fieldPattern = matchingArgBindings.getNthFieldPattern(i);
                Pattern pattern = fieldPattern.getPattern();
               
                if (pattern == null) {
                    // punning.
                   
                    // Textual field names become Vars of the same name.
                    // Ordinal field names become wildcards ("_").
                    FieldName fieldName = fieldPattern.getFieldName().getName();
                    if (fieldName instanceof FieldName.Textual) {
                        pattern = Pattern.Var.make(fieldName.getCalSourceForm());
                    }
                }
               
View Full Code Here


    public R visit_Expr_Case_Alt_UnpackRecord(UnpackRecord record, Object arg) {

        enterScope();
       
        for(int i = 0; i < record.getNFieldPatterns(); i++) {
            FieldPattern pattern = record.getNthFieldPattern(i);
           
            if(pattern.getPattern() != null &&
               pattern.getPattern() instanceof Pattern.Var) {
                Pattern.Var patternVar = (Pattern.Var)pattern.getPattern();
                addRegularBinding(patternVar.getName(), patternVar);

            } else if (pattern.getPattern() == null) {
                addRegularBinding(pattern.getFieldName().getName().getCalSourceForm(), pattern);
            }
        }
       
        if(record.getBaseRecordPattern() != null) {
            if(record.getBaseRecordPattern() instanceof Pattern.Var) {
View Full Code Here

TOP

Related Classes of org.openquark.cal.compiler.SourceModel.FieldPattern

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.