Package flex2.compiler.abc

Examples of flex2.compiler.abc.AbcClass


        {
            watcher.addChangeEvent("resultForBinding");
        }
        else if (srcTypeName != null)
        {
            AbcClass watchedClass = typeTable.getClass(srcTypeName);

            if (watchedClass != null)
            {
                if ( watchedClass.isSubclassOf(standardDefs.CLASS_OBJECTPROXY) )
                {
                    watcher.setPartOfAnonObjectGraph(true);
                }

                List metaData = watchedClass.getMetaData(BINDABLE, true);
                boolean foundEvents = addBindables(watcher, metaData);
                boolean foundSource = false;

                Variable variable = getVariable(context, watchedClass, ref, multiName);

                if (variable != null)
                {
                    metaData = variable.getMetaData(BINDABLE);
                    foundEvents = addBindables(watcher, metaData) || foundEvents;
                    metaData = variable.getMetaData(CHANGE_EVENT);
                    foundEvents = addChangeEvents(watcher, metaData) || foundEvents;
                    metaData = variable.getMetaData(NON_COMMITTING_CHANGE_EVENT);
                    foundEvents = addNonCommittingChangeEvents(watcher, metaData) || foundEvents;

                    // Object has a public static const variable names "length", which is
                    // some legacy compatibility crap left over from EMCA script 262, so
                    // we ignore it.
                    if (variable.isConst() &&
                        !(multiName.getLocalPart().equals("length") &&
                          variable.getDeclaringClassName().equals(SymbolTable.OBJECT)))
                    {
                        // We didn't really find any events, but we want
                        // to follow the same code path below as if we did.
                        foundEvents = true;
                        //    TODO will this ever be something besides a PropertyWatcher?
                        if (watcher instanceof PropertyWatcher)
                        {
                            ((PropertyWatcher) watcher).suppress();
                        }
                    }

                    // See comment above.
                    if (!(multiName.getLocalPart().equals("length") &&
                          variable.getDeclaringClassName().equals(SymbolTable.OBJECT)))
                    {
                        checkForStaticProperty(variable.isStatic(), watcher, srcTypeName);
                    }

                    foundSource = true;
                }

                if (!foundEvents)
                {
                    Method getter = getGetter(context, watchedClass, ref, multiName);

                    if (getter != null)
                    {
                        metaData = getter.getMetaData(BINDABLE);
                        foundEvents = addBindables(watcher, metaData) || foundEvents;
                        metaData = getter.getMetaData(CHANGE_EVENT);
                        foundEvents = addChangeEvents(watcher, metaData) || foundEvents;
                        metaData = getter.getMetaData(NON_COMMITTING_CHANGE_EVENT);
                        foundEvents = addNonCommittingChangeEvents( watcher, metaData) || foundEvents;

                        checkForStaticProperty(getter.isStatic(), watcher, srcTypeName);

                        foundSource = true;
                    }

                    Method setter = getSetter(context, watchedClass, ref, multiName);

                    if (setter != null)
                    {
                        metaData = setter.getMetaData(BINDABLE);
                        foundEvents = addBindables(watcher, metaData) || foundEvents;
                        metaData = setter.getMetaData(CHANGE_EVENT);
                        foundEvents = addChangeEvents(watcher, metaData) || foundEvents;
                        metaData = setter.getMetaData(NON_COMMITTING_CHANGE_EVENT);
                        foundEvents = addNonCommittingChangeEvents(watcher, metaData) || foundEvents;

                        checkForStaticProperty(setter.isStatic(), watcher, srcTypeName);

                        foundSource = true;
                    }
                    else
                    {
                        if (getter != null)
                        {
                            //    getters without setters are de facto const, use same bypass as above for const vars
                            foundEvents = true;
                        }
                    }
                }

                if (!foundSource)
                {
                    Method function = getMethod(context, watchedClass, ref, multiName);

                    if (function != null)
                    {
                        metaData = function.getMetaData(BINDABLE);
                        foundEvents = addBindables(watcher, metaData) || foundEvents;
                        metaData = function.getMetaData(CHANGE_EVENT);
                        foundEvents = addChangeEvents(watcher, metaData) || foundEvents;
                        metaData = function.getMetaData(NON_COMMITTING_CHANGE_EVENT);
                        foundEvents = addNonCommittingChangeEvents(watcher, metaData) || foundEvents;
                        foundSource = true;

                        if (!foundEvents && callExpressionStack.isEmpty())
                        {
                            foundEvents = true;
                            //    TODO will this ever be something besides a PropertyWatcher?
                            if (watcher instanceof PropertyWatcher)
                            {
                                ((PropertyWatcher)watcher).suppress();
                            }
                        }
                    }
                }

                if ((!foundSource) && watchedClass.isSubclassOf(standardDefs.CLASS_ABSTRACTSERVICE))
                {
                    watcher.setOperation(true);
                }
                else if (!foundEvents &&
                         !(watcher instanceof FunctionReturnWatcher) &&
                         !(watcher instanceof XMLWatcher) &&
                         !watcher.isOperation())
                {
                    /***
                     * NOTE: when we've failed to find change events for properties of untyped or Object-typed parents, we go
                     * ahead and generate code to create a runtime PropertyWatcher with no change events specified. The lack
                     * of change events tells the runtime PW to introspect RTTI to discover change events associated with the
                     * actual type of the actual value being assigned to the property.
                     * OTOH for strongly-typed properties, we still require change events to be reachable at compile time.
                     */
                    if (!(watchedClass.getName().equals(SymbolTable.OBJECT) || watchedClass.getName().equals(SymbolTable.NOTYPE)))
                    {
                        //    TODO do we still want this to be configurable?
                        if (showBindingWarnings)
                        {
                            context.localizedWarning2(pos, new UnableToDetectChanges(name));
View Full Code Here


        // Validate up the inheritance chain
        String superTypeName = hostComponentClass.getSuperTypeName();

        if (superTypeName != null)
        {
            AbcClass superType = typeTable.getClass(superTypeName);

            if (superType != null)
            {
                validateRequiredSkinParts(superType, skinClass, cx, position, typeTable);
            }
View Full Code Here

    private void validateRequiredSkinPartsAndStates(Context cx, CompilationUnit unit, TypeTable typeTable)
    {
      MetaDataNode metaData = unit.hostComponentMetaData;
        String hostComponentClassName = metaData.getValue(0);
        AbcClass hostComponentClass = typeTable.getClass(NameFormatter.toColon(hostComponentClassName));

        if (hostComponentClass == null)
        {
            cx.localizedError2(cx.input.origin, metaData.pos(),
                               new HostComponentClassNotFound(hostComponentClassName));
        }
        else if (unit.hostComponentOwnerClass != null)
        {
            AbcClass skinClass = typeTable.getClass(unit.hostComponentOwnerClass);
            validateRequiredSkinParts(hostComponentClass, skinClass, cx, metaData.pos(), typeTable);
            validateRequiredSkinStates(hostComponentClass, skinClass, cx, metaData.pos());
        }
    }
View Full Code Here

            backgroundColor = lookupTypeSelectorBackgroundColor(globalStylesContainer, className);
        }

        if (backgroundColor == -1)
        {
            AbcClass abcClass = symbolTable.getClass(NameFormatter.toColon(className));

            if (abcClass != null)
            {
                String superTypeName = abcClass.getSuperTypeName();

                if (superTypeName != null)
                {
                    // The styleName is intentionally not passed in,
                    // because we've already tried doing a lookup with it.
View Full Code Here

        if (unit.hasTypeInfo)
        {
            for (Map.Entry<String, AbcClass> entry : unit.classTable.entrySet())
            {
                AbcClass c = entry.getValue();
                c.setTypeTable(typeTable);
                symbolTable.registerClass(entry.getKey(), c);
            }

            try
            {
                symbolTable.registerStyles(unit.styles);
            }
            catch (StyleConflictException e)
            {
                // C: assume that StyleConflictException is going to be internationalized...
                ThreadLocalToolkit.logError(unit.getSource().getNameForReporting(), e.getLocalizedMessage());
            }

            evaluateLoaderClassBase(unit, typeTable);
            return;
        }

        ProgramNode node = (ProgramNode) unit.getSyntaxTree();
        if (node.state == ProgramNode.Inheritance || node.state == ProgramNode.Else)
        {
            return;
        }

        CompilerContext context = unit.getContext();
        Context cx = context.getAscContext();
        symbolTable.perCompileData.handler = cx.getHandler();

        // run ConstantEvaluator
        cx.pushScope(node.frame);
        ConstantEvaluator analyzer = (ConstantEvaluator) context.removeAttribute("ConstantEvaluator");
    node.evaluate(cx, analyzer);
    cx.popScope();

    if (ThreadLocalToolkit.errorCount() > 0)
    {
      return;
    }

    // run -strict and -coach
    if (as3Configuration.warnings())
    {
      cx.pushScope(node.frame);

      LintEvaluator lint = new LintEvaluator(cx, unit.getSource().getName(), warnMap);
      node.evaluate(cx, lint);
      cx.popScope();
            lint.simpleLogWarnings(cx, coachWarningsAsErrors);
            // if we want to go back to the verbose style of warnings, uncomment the line below and
            // comment out the line above
            //lint.logWarnings(context.cx);

      lint.clear();
    }

    if (ThreadLocalToolkit.errorCount() > 0)
    {
      return;
    }

    // last step: collect class definitions, add them to the symbol table and the CompilationUnit
        Map classMap = typeTable.createClasses(node.clsdefs, unit.topLevelDefinitions);
        for (Iterator i = classMap.keySet().iterator(); i.hasNext();)
        {
            String className = (String) i.next();
            AbcClass c = (AbcClass) classMap.get(className);
            symbolTable.registerClass(className, c);
            unit.classTable.put(className, c);
        }

        try
View Full Code Here

  {
    for (Iterator it = unit.topLevelDefinitions.iterator(); it.hasNext();)
    {
        QName qName = (QName) it.next();

        AbcClass c = typeTable.getClass( qName.toString() );
        if (c == null)
            continue;
        getParentLoader(unit, typeTable, c);
    }
  }
View Full Code Here

  {
        String superTypeName = c.getSuperTypeName();

        if (superTypeName != null)
        {
            AbcClass sc = typeTable.getClass( NameFormatter.toColon(superTypeName) );

            if (sc != null)
            {
                List inherited = sc.getMetaData( "Frame", true );
                String inheritedLoaderClass = null;

                for (Iterator it = inherited.iterator(); it.hasNext();)
                {
                    MetaData md = (MetaData) it.next();
View Full Code Here

        for( Map.Entry<String, AbcClass> entry : interfaceUnit.classTable.entrySet() )
        {
            // Freeeze the clases generated for the interface file, so that we
            // can still access them when we are building the generated file.
            //System.out.println("Freezing " + entry.getKey());
            AbcClass c = entry.getValue();
            c.freeze();
        }

        Source.transferDependencies(interfaceUnit, unit);
        Source.transferLoaderClassBase(interfaceUnit, unit);
        Source.transferGeneratedSources(interfaceUnit, unit);
View Full Code Here

        Type type = typeMap.get(className);

        if (type == null)
        {
            // use symbolTable to lookup Class.
            AbcClass classInfo = symbolTable.getClass(className);

            if (classInfo != null)
            {
                type = new TypeHelper(classInfo, standardDefs);
                typeMap.put(className, type);
View Full Code Here

         * Property. variables, getters, setters, etc.
         * Searches specified namespaces
         */
        public Property getProperty(String[] namespaces, String name)
        {
            AbcClass cls = classInfo, superClass = null;

            // walk the superclass chain for the specified property...
            while (cls != null)
            {
                Variable var = cls.getVariable(namespaces, name, false);
                if (var != null)
                {
                    if (!var.isStatic())
                    {
                        // found the property as a variable...
                        return new PropertyHelper(var);
                    }
                    else
                    {
                        superClass = symbolTable.getClass(cls.getSuperTypeName());
                    }
                }
                else
                {
                    Method setter = cls.getSetter(namespaces, name, false);
                    Method getter = cls.getGetter(namespaces, name, false);
                    if (setter != null && getter != null)
                    {
                        // found the property as a pair of getter and setter...
                        return new PropertyHelper(setter, getter);
                    }

                    superClass = symbolTable.getClass(cls.getSuperTypeName());

                    if (setter != null && superClass != null)
                    {
                        // search for a superclass getter before creating PropertyHelper.
                        getter = findGetter(superClass, name);
View Full Code Here

TOP

Related Classes of flex2.compiler.abc.AbcClass

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.