Package org.openquark.cal.compiler.SourceModel

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


            root.addChild(letNode);
            stack.push(letNode);

            final int nLocalDefns = let.getNLocalDefinitions();
            for (int i = 0; i < nLocalDefns; i++) {
                LocalDefn localDefn = let.getNthLocalDefinition(i);

                localDefn.accept(this, options);
            }

            stack.pop();

            SourceTextNode inNode = new SourceTextNode(
View Full Code Here


                    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) {
                    insertionPosition = ((LocalDefn.Function.Definition)localDefn).getSourceRangeExcludingCaldoc().getStartSourcePosition();
                } else {
                    // in this case the localDefn should be a LocalDefn.PatternMatch
                    insertionPosition = localDefn.getSourceRange().getStartSourcePosition();
                }
                String insertionText = makeIndentedSourceElementText(typeDecl, insertionPosition, sourceText, noLeadingNewline);
                sourceModifier.addSourceModification(new SourceModification.InsertText(insertionText, insertionPosition));

                if(refactoringStatistics != null) {
View Full Code Here

             * {@inheritDoc}
             */
            @Override
            void processLocalDefinitionBinding(final String name, final SourceModel.SourceElement localDefinition, final LocalDefn arg) {
                final LocalFunctionIdentifier localFunctionIdentifier = localFunctionIdentifierGenerator.generateLocalFunctionIdentifier(getModuleName(), name);
                final LocalDefn localDefn = arg;
                localDefns.put(localFunctionIdentifier, localDefn);
                checkLeadingPosition(localFunctionIdentifier);
            }
View Full Code Here

TOP

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

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.