Package org.apache.flex.compiler.problems

Examples of org.apache.flex.compiler.problems.ICompilerProblem


        // The id must be a valid ActionScript identifier.
        // Otherwise it will be null.
        if (!isValidASIdentifier(value))
        {
            ICompilerProblem problem = new MXMLInvalidIDProblem(attribute);
            builder.addProblem(problem);
            return null;
        }

        // The id must be unique within the class.
        // Otherwise it will be null.
        IMXMLInstanceNode previousNodeWithSameID =
                ((MXMLClassDefinitionNode)getClassDefinitionNode()).addNodeWithID(value, this);

        if (previousNodeWithSameID != null && !isEqual(previousNodeWithSameID))
        {
            ICompilerProblem problem = new MXMLDuplicateIDProblem(attribute);
            builder.addProblem(problem);
            return null;
        }

        return value;
View Full Code Here


                                                        IMXMLTagAttributeData attribute)
    {
        MXMLDialect mxmlDialect = builder.getMXMLDialect();
        if (mxmlDialect == MXMLDialect.MXML_2006)
        {
            ICompilerProblem problem = new MXMLAttributeVersionProblem(attribute, attribute.getName(), "2009");
            builder.addProblem(problem);
            return null;
        }

        String value = attribute.getRawValue();
        value = mxmlDialect.trim(value);

        // The itemCreationPolicy must be "immediate" or "deferred";
        // otherwise, it will be null.
        if (!value.equals(ITEM_CREATION_POLICY_IMMEDIATE) &&
            !value.equals(ITEM_CREATION_POLICY_DEFERRED))
        {
            ICompilerProblem problem = new MXMLInvalidItemCreationPolicyProblem(attribute);
            builder.addProblem(problem);
            return null;
        }

        return value;
View Full Code Here

                                                           IMXMLTagAttributeData attribute)
    {
        MXMLDialect mxmlDialect = builder.getMXMLDialect();
        if (mxmlDialect == MXMLDialect.MXML_2006)
        {
            ICompilerProblem problem = new MXMLAttributeVersionProblem(attribute, attribute.getName(), "2009");
            builder.addProblem(problem);
            return null;
        }

        String value = attribute.getRawValue();
        value = mxmlDialect.trim(value);

        // The itemDestructionPolicy must be "auto" or "nevet";
        // otherwise, it will be null.
        if (!value.equals(ITEM_DESTRUCTION_POLICY_AUTO) &&
            !value.equals(ITEM_DESTRUCTION_POLICY_NEVER))
        {
            ICompilerProblem problem = new MXMLInvalidItemDestructionPolicyProblem(attribute);
            builder.addProblem(problem);
            return null;
        }

        return value;
View Full Code Here

            ((MXMLClassDefinitionNode)getClassDefinitionNode()).generateID(this);

        // If both includeIn and excludeFrom are specified, set both to null.
        if (includeIn != null && excludeFrom != null)
        {
            ICompilerProblem problem = new MXMLIncludeInAndExcludeFromProblem(tag);
            builder.addProblem(problem);
            includeIn = null;
            excludeFrom = null;
        }
View Full Code Here

                    instanceNode.setClassReference(project, (ClassDefinition)definition); // TODO Move this logic to initializeFromTag().
                    instanceNode.initializeFromTag(builder, childTag);
                }
                else
                {
                    ICompilerProblem problem = new MXMLUnresolvedTagProblem(childTag);
                    builder.addProblem(problem);
                }
            }
        }
View Full Code Here

        String trimmedDestinationValue = null;

        if (sourceAttribute == null)
        {
            // 'source' attribute is required
            ICompilerProblem problem = new MXMLRequiredAttributeProblem(tag, ATTRIBUTE_SOURCE);
            builder.addProblem(problem);
            markInvalidForCodeGen();
        }
        else
        {
            trimmedSourceValue = builder.getMXMLDialect().trim(sourceAttribute.getRawValue());
            if (trimmedSourceValue.isEmpty())
            {
                // 'source' attribute value cannot be empty
                ICompilerProblem problem = new MXMLEmptyAttributeProblem(sourceAttribute);
                builder.addProblem(problem);
                markInvalidForCodeGen();
            }
        }

        if (destinationAttribute == null)
        {
            // 'destination' attribute is required
            ICompilerProblem problem = new MXMLRequiredAttributeProblem(tag, ATTRIBUTE_DESTINATION);
            builder.addProblem(problem);
            markInvalidForCodeGen();
        }
        else
        {
            trimmedDestinationValue = builder.getMXMLDialect().trim(destinationAttribute.getRawValue());
            if (trimmedDestinationValue.isEmpty())
            {
                // 'destination' attribute value cannot be empty
                ICompilerProblem problem = new MXMLEmptyAttributeProblem(destinationAttribute);
                builder.addProblem(problem);
                markInvalidForCodeGen();
            }
        }

        if (trimmedSourceValue != null && !trimmedSourceValue.isEmpty() &&
            trimmedDestinationValue != null && !trimmedDestinationValue.isEmpty() &&
            trimmedSourceValue.equals(trimmedDestinationValue))
        {
            // 'source' and 'destination' values cannot be the same
            // TODO "a.b" and "a . b" won't be detected as the same.
            // Should we compare tokens instead?
            ICompilerProblem problem = new MXMLSameBindingSourceAndDestinationProblem(tag);
            builder.addProblem(problem);
            markInvalidForCodeGen();
        }
    }
View Full Code Here

            // the [ArrayElementType] of the property of type Array that's being set.
            if (arrayElementType != null)
            {
                if (!((ClassDefinition)definition).isInstanceOf(arrayElementType, project))
                {
                    ICompilerProblem problem = new MXMLIncompatibleArrayElementProblem(
                            childTag, propertyName, arrayElementType, definition.getQualifiedName());
                    builder.addProblem(problem);
                }
            }
        }
View Full Code Here

            IDefinition exprType = expressionNode.resolveType(project);
            if (exprType != null)
            {
                if (!SemanticUtils.isValidTypeConversion(expectedType, exprType, project, builder.getCompilationUnit().isInvisible()))
                {
                    ICompilerProblem problem = new ImplicitCoercionToUnrelatedTypeProblem(
                            expressionNode, exprType.getBaseName(), expectedType.getBaseName());
                    builder.addProblem(problem);
                }
            }
        }
View Full Code Here

    {
        super.initializationComplete(builder, tag, info);

        if (info.hasSourceAttribute && info.hasDualContent)
        {
            ICompilerProblem problem = new MXMLDualContentProblem(tag, tag.getShortName());
            builder.addProblem(problem);
        }
    }
View Full Code Here

            }
            else
            {
                // Unlike Flex 4.5, we report a problem if the format
                // is anything other than "e4x" or "xml".               
                ICompilerProblem problem = new MXMLUnknownXMLFormatProblem(attribute);
                builder.addProblem(problem);

                // But like Flex 4.5, we default to "xml"
                // if neither is specified.
                xmlType = XML_TYPE.OLDXML;
View Full Code Here

TOP

Related Classes of org.apache.flex.compiler.problems.ICompilerProblem

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.