Package org.openquark.cal.compiler.SourceModel

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


        }
                   
        // Create the type signature.
        final Class<?> instanceMemberClass = isStatic  || javaMember instanceof Constructor<?> ? null : javaClass;
       
        final TypeSignature typeSignature =
            getTypeSignature(paramTypes, returnType, instanceMemberClass, generationInfo);
       
       
        return Foreign.make((SourceModel.CALDoc.Comment.Function)null, functionName, scope, true, externalName, typeSignature);
    }
View Full Code Here


                argTypes[i] = constructor.getParamType(i);
            }
            argTypes[nArgs] = javaClass.getClassName();
               
            TypeExprDefn argTypeDef = getTypeExprDefn(argTypes);
            TypeSignature declaredType = TypeSignature.make(argTypeDef);
           
            SourceModel.CALDoc.Comment.Function constructorFunctionComment;
            {
                SourceModel.CALDoc.TextSegment.Plain textSegment =
                    SourceModel.CALDoc.TextSegment.Plain.make(
View Full Code Here

        CALDoc.Comment.ClassMethod newCALDocComment = null;
        if (defn.getCALDocComment() != null) {
            newCALDocComment = (CALDoc.Comment.ClassMethod)defn.getCALDocComment().accept(this, arg);
        }
       
        TypeSignature newTypeSignature = (TypeSignature)defn.getTypeSignature().accept(this, arg);
       
        Name.Function newDefaultClassMethodName = null;
        if (defn.getDefaultClassMethodName() != null) {
            newDefaultClassMethodName = (Name.Function)defn.getDefaultClassMethodName().accept(this, arg);
        }
View Full Code Here

            Set<ModuleName> importsThatProduceConflicts = new HashSet<ModuleName>();
            boolean noConflicts = updateWithUnimportedModules(unimportedModules, importsThatProduceConflicts, moduleTypeInfo, typeExpr);

            if (noConflicts) {
                TypeSignature typeSignature = typeExpr.toSourceModel(null, namingPolicy);
                FunctionTypeDeclaration typeDecl = FunctionTypeDeclaration.make(function.getName(), typeSignature);

                SourcePosition insertionPosition = function.getSourceRangeExcludingCaldoc().getStartSourcePosition();

                String insertionText = makeIndentedSourceElementText(typeDecl, insertionPosition, sourceText, false);
                sourceModifier.addSourceModification(new SourceModification.InsertText(insertionText, insertionPosition));

                if(refactoringStatistics != null) {
                    refactoringStatistics.recordAddedToplevelTypeDeclaration(containsClassConstraints(typeExpr));
                }
               
            } else {
                if(refactoringStatistics != null) {
                    refactoringStatistics.recordTypeDeclarationNotAddedDueToPotentialImportConflict(importsThatProduceConflicts);
                }
            }
        }
               
        // Add SourceModifications for unannotated local functions
        LinkedHashSet<LocalFunctionIdentifier> unannotatedLocalFunctions = visitor.getUnannotatedLocalFunctions();
        for (final LocalFunctionIdentifier identifier : unannotatedLocalFunctions) {
            TypeExpr typeExpr = computeLocalTypeExpr(moduleTypeInfo, identifier);
            if(typeExpr == null) {
                if(refactoringStatistics != null) {
                    refactoringStatistics.recordLocalTypeDeclarationNotAdded();
                }
                continue;
            }
    
            LocalDefn localDefn = visitor.getLocalDefn(identifier);


            if (sourceRange != null){
                final SourceRange functionSourceRange = localDefn.getSourceRange();
                if (functionSourceRange != null){
                    if (!sourceRange.overlaps(functionSourceRange)){
                        continue;
                    }
                }
            }
           
            Set<ModuleName> importsThatProduceConflicts = new HashSet<ModuleName>();
            boolean noConflicts = updateWithUnimportedModules(unimportedModules, importsThatProduceConflicts, moduleTypeInfo, typeExpr);

            if (noConflicts) {
                TypeSignature typeSignature = typeExpr.toSourceModel(null, namingPolicy);
                LocalDefn.Function.TypeDeclaration typeDecl = LocalDefn.Function.TypeDeclaration.make(identifier.getLocalFunctionName(), typeSignature);

                boolean noLeadingNewline = visitor.doesTypeDeclNeedLeadingNewline(identifier);
                final SourcePosition insertionPosition;
                if (localDefn instanceof LocalDefn.Function.Definition) {
View Full Code Here

TOP

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

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.