Examples of ICompilerProject


Examples of org.apache.flex.compiler.projects.ICompilerProject

     * @param value         the numeric value to push
     * @param type          the type of the expression that produced the value.
     */
    public void pushNumericConstant(InstructionList result_list, Number value, IDefinition type)
    {
        ICompilerProject project = currentScope.getProject();
        if( type == project.getBuiltinType(BuiltinType.INT) )
        {
            int val = ECMASupport.toInt32(value);
            if( (byte)val == val )
            {
                result_list.addInstruction(OP_pushbyte, val);
            }
            else if( (short)val == val )
            {
                result_list.addInstruction(OP_pushshort, val);
            }
            else
            {
                result_list.addInstruction(OP_pushint, Integer.valueOf(val));
            }
        }
        else if( type == project.getBuiltinType(BuiltinType.UINT) )
        {
            long uval = ECMASupport.toUInt32(value.doubleValue());
            if ((uval & 0x7F) == uval) { // Pushbyte sign extends
                result_list.addInstruction(OP_pushbyte, (int)uval);
            }
            else if ((uval & 0x7FFF) == uval) { // Pushshort sign extends
                result_list.addInstruction(OP_pushshort, (int)uval);
            }
            else {
                result_list.addInstruction(OP_pushuint, Long.valueOf(uval));
            }
        }
        else
        {
            double dval = value.doubleValue();
            if( ECMASupport.isNan(dval) )
            {
                result_list.addInstruction(OP_pushnan);
            }
            else if (!Double.isInfinite(dval) && (dval == ECMASupport.toInt32(value)) )
            {
                // distinguish pos/neg 0
                // java treats -0 and 0 as equal, but divide by -0 results in NEG INFINITY, whereas pos
                // 0 results in POS INFINITY
                // positive 0 can be encoded with a pushbyte, but neg zero requires a pushdouble
                if( dval == 0 && 1/dval == Double.NEGATIVE_INFINITY )
                    result_list.addInstruction(OP_pushdouble, dval);
                else
                    // Integer
                    pushNumericConstant(result_list, ECMASupport.toInt32(value), project.getBuiltinType(BuiltinType.INT));
            }
            else if( Double.isNaN(dval) )
            {
                result_list.addInstruction(OP_pushnan);
            }
View Full Code Here

Examples of org.apache.flex.compiler.projects.ICompilerProject

            IScopedNode body = functionNode.getScopedNode();
            InstructionList insns = inlineFunctionScope.getGenerator().generateInstructions(body, CmcEmitter.__statement_NT, inlineFunctionScope);

            currentScope = currentScope.popFrame();

            final ICompilerProject project = currentScope.getProject();
            if (currentScope.getMethodBodySemanticChecker().functionBodyHasNonInlineableInstructions(insns, functionDef.isInline(), functionDef.getBaseName()))
            {
                return false;
            }
            else
View Full Code Here

Examples of org.apache.flex.compiler.projects.ICompilerProject

    /**
     *  @return a feasible cost (1) if the node is for 'new Array()'
     */
    int isEmptyArrayConstructor(IASNode iNode)
    {
        ICompilerProject project = currentScope.getProject();
        IIdentifierNode identifierNode = (IIdentifierNode)SemanticUtils.getNthChild(iNode, 1);
        if (identifierNode.resolve(project) == project.getBuiltinType(BuiltinType.ARRAY))
            return 1;

        return Integer.MAX_VALUE;
    }
View Full Code Here

Examples of org.apache.flex.compiler.projects.ICompilerProject

    /**
     *  @return a feasible cost (1) if the node is for 'new Object()'
     */
    int isEmptyObjectConstructor(IASNode iNode)
    {
        ICompilerProject project = currentScope.getProject();
        IIdentifierNode identifierNode = (IIdentifierNode)SemanticUtils.getNthChild(iNode, 1);
        if (identifierNode.resolve(project) == project.getBuiltinType(BuiltinType.OBJECT))
            return 1;

        return Integer.MAX_VALUE;
    }
View Full Code Here

Examples of org.apache.flex.compiler.projects.ICompilerProject

        currentScope.getMethodBodySemanticChecker().checkIncDec(iNode, false, unary);

        InstructionList result = createInstructionList(iNode);

        if ( unary.isLocal() ) {
            ICompilerProject project = currentScope.getProject();

            IDefinition inType = SemanticUtils.resolveUnaryExprType(iNode, project);

            IDefinition intType = project.getBuiltinType(BuiltinType.INT);
            IDefinition numberType = project.getBuiltinType(BuiltinType.NUMBER);
            if( inType == intType)
            {
                // Decrementing a local, typed as int
                // we can use declocal_i since we know the result will be stored in an int
                if( need_result )
View Full Code Here

Examples of org.apache.flex.compiler.projects.ICompilerProject

        currentScope.getMethodBodySemanticChecker().checkIncDec(iNode, true, unary);

        InstructionList result = createInstructionList(iNode);

        if ( unary.isLocal() ) {
            ICompilerProject project = currentScope.getProject();

            IDefinition inType = SemanticUtils.resolveUnaryExprType(iNode, project);

            IDefinition intType = project.getBuiltinType(BuiltinType.INT);
            IDefinition numberType = project.getBuiltinType(BuiltinType.NUMBER);
            if( inType == intType)
            {
                // Incrementing a local, typed as int
                // we can use inclocal_i since we know the result will be stored in an int
                if( need_result )
View Full Code Here

Examples of org.apache.flex.compiler.projects.ICompilerProject

    public void getAllImportNodes(Collection<IImportNode> imports)
    {
        // Add implicit import nodes created by MXML tags.
        // The implicit imports for each MXML class are stored on its ClassDefinition.
        IMXMLFileNode fileNode = (IMXMLFileNode)getAncestorOfType(IMXMLFileNode.class);
        ICompilerProject project = fileNode.getCompilerProject();
        for (String qname : ((ClassDefinition)classDefinition).getImplicitImports())
        {
            imports.add(new MXMLImplicitImportNode(project, qname));
        }
View Full Code Here

Examples of org.apache.flex.compiler.projects.ICompilerProject

        currentScope.getMethodBodySemanticChecker().checkIncDec(iNode, false, unary);

        InstructionList result = createInstructionList(iNode);

        if ( unary.isLocal() ) {
            ICompilerProject project = currentScope.getProject();

            IDefinition inType = SemanticUtils.resolveUnaryExprType(iNode, project);

            IDefinition intType = project.getBuiltinType(BuiltinType.INT);
            IDefinition numberType = project.getBuiltinType(BuiltinType.NUMBER);
            if( inType == intType)
            {
                // Decrementing a local, typed as int
                // we can use declocal_i since we know the result will be stored in an int
                result.addInstruction(unary.declocal_i());
View Full Code Here

Examples of org.apache.flex.compiler.projects.ICompilerProject

        currentScope.getMethodBodySemanticChecker().checkIncDec(iNode, true, unary);
       
        InstructionList result = createInstructionList(iNode);

        if ( unary.isLocal() ) {
            ICompilerProject project = currentScope.getProject();

            IDefinition inType = SemanticUtils.resolveUnaryExprType(iNode, project);

            IDefinition intType = project.getBuiltinType(BuiltinType.INT);
            IDefinition numberType = project.getBuiltinType(BuiltinType.NUMBER);
            if( inType == intType)
            {
                // Incrementing a local, typed as int
                // we can use inclocal_i since we know the result will be stored in an int
                result.addInstruction(unary.inclocal_i());
View Full Code Here

Examples of org.apache.flex.compiler.projects.ICompilerProject

        if ( toType == null )
            return;

        assert toType instanceof ITypeDefinition;

        ICompilerProject project = currentScope.getProject();
       
        if( toType == project.getBuiltinType(BuiltinType.ANY_TYPE) )
        {
            il.addInstruction(OP_coerce_a);
        }
        else if ( toType == project.getBuiltinType(BuiltinType.STRING) )
        {
            il.addInstruction(OP_coerce_s);
        }
        else if ( toType == project.getBuiltinType(BuiltinType.BOOLEAN) )
        {
            il.addInstruction(OP_convert_b);
        }
        else if( toType == project.getBuiltinType(BuiltinType.NUMBER) )
        {
            il.addInstruction(OP_convert_d);
        }
        else if( toType == project.getBuiltinType(BuiltinType.INT) )
        {
            il.addInstruction(OP_convert_i);
        }
        else if( toType == project.getBuiltinType(BuiltinType.UINT) )
        {
            il.addInstruction(OP_convert_u);
        }
        else
        {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.