Package org.apache.flex.compiler.definitions

Examples of org.apache.flex.compiler.definitions.IClassDefinition


    public IVariableDefinition resolveID()
    {
        // Get the variable definition for the id from the class scope.
        MXMLClassDefinitionNode classDefinitionNode =
                (MXMLClassDefinitionNode)getClassDefinitionNode();
        IClassDefinition classDefinition = classDefinitionNode.getClassDefinition();
        ASScope classScope = (ASScope)classDefinition.getContainedScope();
        IDefinitionSet definitionSet = classScope.getLocalDefinitionSetByName(id);
        int n = definitionSet.getSize();
        for (int i = 0; i < n; i++)
        {
            IDefinition definition = definitionSet.getDefinition(i);
View Full Code Here


        {
            IMXMLTagData tag = (IMXMLTagData)contentUnits.get(0);
            IDefinition type = builder.getFileScope().resolveTagToDefinition(tag);
            if (type instanceof ClassDefinition)
            {
                IClassDefinition tagClass = (IClassDefinition)type;
                MXMLInstanceNode childInstanceNode = MXMLInstanceNode.createInstanceNode(builder, type.getQualifiedName(), this);
                childInstanceNode.setClassReference(project, tagClass);
                childNode = childInstanceNode;
                childInstanceNode.initializeFromTag(builder, tag);
            }
View Full Code Here

    }

    @Override
    public void emitMethodDoc(IFunctionNode node, ICompilerProject project)
    {
        IClassDefinition classDefinition = resolveClassDefinition(node);

        if (node instanceof IFunctionNode)
        {
            boolean hasDoc = false;

            if (node.isConstructor())
            {
                begin();
                hasDoc = true;

                emitJSDocLine(JSEmitterTokens.CONSTRUCTOR);

                IClassDefinition parent = (IClassDefinition) node
                        .getDefinition().getParent();
                IClassDefinition superClass = parent.resolveBaseClass(project);
                String qname = superClass.getQualifiedName();

                if (superClass != null
                        && !qname.equals(IASLanguageConstants.Object))
                    emitExtends(superClass, superClass.getPackageName());

                IReference[] references = classDefinition
                        .getImplementedInterfaceReferences();
                for (IReference iReference : references)
                {
View Full Code Here

        eventCounter = 0;
        idCounter = 0;

        // visit MXML
        IClassDefinition cdef = node.getClassDefinition();
        IASEmitter asEmitter = ((IMXMLBlockWalker) getMXMLWalker())
                .getASEmitter();
        ((JSFlexJSEmitter) asEmitter).thisClass = cdef;

        // visit tags
View Full Code Here

        eventCounter = 0;
        oldIdCounter = idCounter;
        idCounter = 0;

        // visit MXML
        IClassDefinition cdef = node.getContainedClassDefinition();
        IASEmitter asEmitter = ((IMXMLBlockWalker) getMXMLWalker())
                .getASEmitter();
        ((JSFlexJSEmitter) asEmitter).thisClass = cdef;

        IASNode classNode = node.getContainedClassDefinitionNode();
        // visit tags
        final int len = classNode.getChildCount();
        for (int i = 0; i < len; i++)
        {
            getMXMLWalker().walk(classNode.getChild(i));
        }

        String cname = cdef.getQualifiedName();
        subDocumentNames.add(cname);
        String baseClassName = cdef.getBaseClassAsDisplayString();

        emitClassDeclStart(cname, baseClassName, false);

        emitPropertyDecls();
       
View Full Code Here

    public void emitInstance(IMXMLInstanceNode node)
    {
        if (isStateDependent(node) && !inStatesOverride)
            return;
       
        IClassDefinition cdef = node
                .getClassReference((ICompilerProject) getMXMLWalker()
                        .getProject());

        MXMLDescriptorSpecifier currentPropertySpecifier = getCurrentDescriptor("ps");

        String id = node.getID();
        if (id == null)
            id = node.getEffectiveID();
        if (id == null)
            id = MXMLFlexJSEmitterTokens.ID_PREFIX.getToken() + idCounter++;

        MXMLDescriptorSpecifier currentInstance = new MXMLDescriptorSpecifier();
        currentInstance.isProperty = false;
        currentInstance.id = id;
        currentInstance.name = cdef.getQualifiedName();
        currentInstance.parent = currentPropertySpecifier;

        if (currentPropertySpecifier != null)
            currentPropertySpecifier.propertySpecifiers.add(currentInstance);
        else if (inMXMLContent)
View Full Code Here

    {
        thisClass = node.getDefinition();

        project = getWalker().getProject();

        IClassDefinition definition = node.getDefinition();

        IFunctionDefinition ctorDefinition = definition.getConstructor();

        // Static-only (Singleton) classes may not have a constructor
        if (ctorDefinition != null)
        {
            IFunctionNode ctorNode = (IFunctionNode) ctorDefinition.getNode();
            if (ctorNode != null)
            {
                // constructor
                emitMethod(ctorNode);
                write(ASEmitterTokens.SEMICOLON);
            }
            else
            {
                String qname = definition.getQualifiedName();
                if (qname != null && !qname.equals(""))
                {
                    write(qname);
                    write(ASEmitterTokens.SPACE);
                    writeToken(ASEmitterTokens.EQUAL);
View Full Code Here

    }

    private static IClassDefinition getSuperClassDefinition(
            IDefinitionNode node, ICompilerProject project)
    {
        IClassDefinition parent = (IClassDefinition) node.getDefinition()
                .getParent();
        IClassDefinition superClass = parent.resolveBaseClass(project);
        return superClass;
    }
View Full Code Here

    @Override
    public void emitClass(IClassNode node)
    {
        //ICompilerProject project = getWalker().getProject();

        IClassDefinition definition = node.getDefinition();
        final String className = definition.getBaseName();

        write("AS3.compilationUnit($exports, function($primaryDeclaration){");
        indentPush();
        writeNewline();

        // write constructor
        emitConstructor((IFunctionNode) definition.getConstructor().getNode());
        writeNewline();

        // base class
        IReference baseClassReference = definition.getBaseClassReference();
        boolean hasSuper = baseClassReference != null
                && !baseClassReference.getName().equals("Object");
        if (hasSuper)
        {
            String baseName = baseClassReference.getName();
            write("var Super = (" + baseName + "._ || " + baseName
                    + "._$get());");
            writeNewline();
            write("var super$ = Super.prototype;");
            writeNewline();
        }

        write("$primaryDeclaration(AS3.class_({");
        indentPush();
        writeNewline();

        // write out package
        write("package_: \"" + definition.getPackageName() + "\",");
        writeNewline();
        // write class
        write("class_: \"" + definition.getBaseName() + "\",");
        writeNewline();
        if (hasSuper)
        {
            write("extends_: Super,");
            writeNewline();
        }

        IReference[] references = definition
                .getImplementedInterfaceReferences();
        int len = references.length;

        // write implements
        write("implements_:");
View Full Code Here

        IVariableDefinition definition = (IVariableDefinition) node
                .getDefinition();

        if (definition.isStatic())
        {
            IClassDefinition parent = (IClassDefinition) definition.getParent();
            write(parent.getBaseName());
            write(".");
            write(definition.getBaseName());
            write(" = ");
            emitFieldInitialValue(node);
            return;
View Full Code Here

TOP

Related Classes of org.apache.flex.compiler.definitions.IClassDefinition

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.