Package org.openquark.cal.compiler.SourceModel.TypeConstructorDefn.AlgebraicType

Examples of org.openquark.cal.compiler.SourceModel.TypeConstructorDefn.AlgebraicType.DataConsDefn


        for (int i = 0; i < fieldNames.length; i++) {
            typeArguments[i] = DataConsDefn.TypeArgument.make(SourceModel.Name.Field.make(fieldNames[i]), SourceModel.TypeExprDefn.Unit.make(), false);
        }
       
        // Create the data constructor definition.
        DataConsDefn dataConsDefnWithRepeatedArgName = DataConsDefn.make(DEFAULT_DATA_CONS_NAME, Scope.PRIVATE, typeArguments);
       
        // Create the type constructor with the data cons definition.
        SourceModel.TypeConstructorDefn typeConsDefn =
            SourceModel.TypeConstructorDefn.AlgebraicType.make(DEFAULT_DATA_CONS_NAME, Scope.PRIVATE, null,
                                                               new DataConsDefn[]{dataConsDefnWithRepeatedArgName},
View Full Code Here


                if (tlse instanceof SourceModel.TypeConstructorDefn.AlgebraicType){
                    SourceModel.TypeConstructorDefn.AlgebraicType at = (SourceModel.TypeConstructorDefn.AlgebraicType) tlse;
                    // This is a hacky way of finding out where the cursor is until the source model is richer.
                    final int nDataConstructors = at.getNDataConstructors();
                    for(int j = 0; j < nDataConstructors; ++j){
                        DataConsDefn dcd = at.getNthDataConstructor(j);
                        if (SourcePosition.compareByPosition.compare(dcd.getSourceRangeOfName().getStartSourcePosition(), pos) <= 0){
                            SourcePosition end = null;
                            if (dcd.getNTypeArgs() != 0){
                                // look for the position of the last arg
                                end = dcd.getNthTypeArg(dcd.getNTypeArgs()-1).getSourcePosition();
                            }
                            if (end == null){
                                // no args so just just the position of the end of the data cons.
                                end = dcd.getSourceRangeOfDefn().getEndSourcePosition();
                            }
                            
                            if (SourcePosition.compareByPosition.compare(pos, end) <= 0){
                                return new SourceElement[] {tlse, dcd};
                            }
View Full Code Here

TOP

Related Classes of org.openquark.cal.compiler.SourceModel.TypeConstructorDefn.AlgebraicType.DataConsDefn

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.