Package org.apache.flex.compiler.internal.parsing.as

Examples of org.apache.flex.compiler.internal.parsing.as.IncludeHandler


                {
                    final Workspace workspace = builder.getWorkspace();
                    final FlexProject project = builder.getProject();
                    final Collection<ICompilerProblem> problems = builder.getProblems();

                    final IncludeHandler includeHandler = new IncludeHandler(builder.getFileSpecificationGetter());
                    includeHandler.setProjectAndCompilationUnit(project, builder.getCompilationUnit());

                    final ScopedBlockNode node = ASParser.parseFragment2(
                            mxmlTextData.getCompilableText(),
                            sourcePath,
                            mxmlTextData.getCompilableTextStart(),
                            mxmlTextData.getCompilableTextLine() - 1,
                            mxmlTextData.getCompilableTextColumn() - 1,
                            problems,
                            workspace,
                            builder.getFileNode(),
                            containingScope,
                            project.getProjectConfigVariables(),
                            EnumSet.of(PostProcessStep.CALCULATE_OFFSETS, buildOrReconnect),
                            true, //follow includes
                            includeHandler
                            );
                    ((MXMLFileNode)ancestorFileNode).updateIncludeTreeLastModified(includeHandler.getLastModified());
                    nodes.add(node);
                }
            }
        }
        return nodes;
View Full Code Here


                IFileSpecification sourceFileSpec = workspace.getFileSpecification(sourcePath);
                String scriptText = builder.readExternalFile(attribute, sourcePath);

                if (scriptText != null)
                {
                    final IncludeHandler includeHandler = new IncludeHandler(builder.getFileSpecificationGetter());
                    includeHandler.setProjectAndCompilationUnit(project, builder.getCompilationUnit());
                    includeHandler.enterFile(sourcePath);
                    final MXMLFileScope fileScope = builder.getFileScope();
                    final OffsetLookup offsetLookup = fileScope.getOffsetLookup();
                    assert offsetLookup != null : "Expected OffsetLookup on FileScope.";
                    final int[] absoluteOffset = offsetLookup.getAbsoluteOffset(sourcePath, 0);

                    final ScopedBlockNode fragment = ASParser.parseFragment2(
                            scriptText,
                            sourceFileSpec.getPath(),
                            absoluteOffset[0],
                            0,
                            0,
                            problems,
                            workspace,
                            builder.getFileNode(),
                            classScope,
                            project.getProjectConfigVariables(),
                            EnumSet.of(PostProcessStep.CALCULATE_OFFSETS, PostProcessStep.RECONNECT_DEFINITIONS),
                            true /* follow includes */,
                            includeHandler);

                    builder.getFileNode().updateIncludeTreeLastModified(includeHandler.getLastModified());

                    // Make the statements inside the script tag the children of this node.
                    int n = fragment.getChildCount();
                    asNodes = new IASNode[n];
                    for (int i = 0; i < n; i++)
View Full Code Here

                        final int[] absoluteOffsets = offsetLookup.getAbsoluteOffset(sourcePath, localOffset);
                        final int absoluteOffset = absoluteOffsets[0];

                        // create an include handler and mock its state as if it is
                        // before parsing for scope building
                        final IncludeHandler includeHandler = IncludeHandler.createForASTBuilding(
                                builder.getFileSpecificationGetter(),
                                sourcePath,
                                localOffset,
                                absoluteOffset);

                        // parse and build AST
                        final EnumSet<PostProcessStep> postProcess = EnumSet.of(
                                PostProcessStep.CALCULATE_OFFSETS,
                                PostProcessStep.RECONNECT_DEFINITIONS);
                        final ScopedBlockNode node = ASParser.parseInlineScript(
                                builder.getFileNode(),
                                mxmlTextData,
                                builder.getProblems(),
                                classScope,
                                project.getProjectConfigVariables(),
                                includeHandler,
                                postProcess);
                        MXMLFileNode filenode = builder.getFileNode();
                        filenode.updateIncludeTreeLastModified(includeHandler.getLastModified());
                        assert node != null : "Expected node from ASParser.getScopesFromInlineScript().";
                        scriptNodes.add(node);
                    }
                }
            }
View Full Code Here

        packageDefinition.setContainedScope(packageScope);
        fileScope.addDefinition(packageDefinition);
       
        problems = new LinkedList<ICompilerProblem>();

        includeHandler = new IncludeHandler(fileSpecGetter);
        includeHandler.setProjectAndCompilationUnit(project, compilationUnit);

        this.fileSpecGetter = fileSpecGetter;
        assert fileSpecGetter != null;
    }
View Full Code Here

        this.fileSpecGetter = fileSpecGetter;
        this.fileSpec = fileSpec;
       
        setSourcePath(fileSpec.getPath());
       
        includeHandler = new IncludeHandler(fileSpecGetter);
        embedNodes = new LinkedList<IEmbedResolver>();
        requiredResourceBundles = new HashSet<String>();
        deferredFunctionNodes = new HashSet<FunctionNode>();
       
        // Create the implicit import nodes.
View Full Code Here

        assert offsetLookup != null : "Expected OffsetLookup on FileScope.";
        final String filePath = getContainingFilePath();
        final int[] absoluteOffsets =
                offsetLookup.getAbsoluteOffset(filePath, startOffsetLocal);
        final int startOffsetAbsolute = absoluteOffsets[0];
        final IncludeHandler includeHandler =
                IncludeHandler.createForASTBuilding(builder.getFileSpecificationGetter(), filePath, startOffsetLocal, startOffsetAbsolute);
        includeHandler.setProjectAndCompilationUnit(project, builder.getCompilationUnit());
        final String scriptFragment = attribute.getRawValue();
        if (scriptFragment.isEmpty())
        {
            MXMLEmptyEventHandlerProblem problem = new MXMLEmptyEventHandlerProblem(attribute);
            problems.add(problem);
        }
        final ScopedBlockNode node = ASParser.parseFragment2(
                scriptFragment,
                filePath,
                0,
                attribute.getValueLine(),
                attribute.getValueColumn(),
                problems,
                workspace,
                builder.getFileNode(),
                scope,
                project.getProjectConfigVariables(),
                EnumSet.of(PostProcessStep.CALCULATE_OFFSETS, PostProcessStep.POPULATE_SCOPE),
                true, //follow includes
                includeHandler);
        builder.getFileNode().updateIncludeTreeLastModified(includeHandler.getLastModified());
        processHandlerCode(builder, Collections.singletonList(node));
    }
View Full Code Here

TOP

Related Classes of org.apache.flex.compiler.internal.parsing.as.IncludeHandler

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.