Package macromedia.asc.parser

Examples of macromedia.asc.parser.StatementListNode


     */
    private StatementListNode genSkinPartsAST(Map<String, Boolean> parts,
                          NodeFactory nodeFactory,
                          StatementListNode statements)
    {
        StatementListNode result = statements;
       
        Iterator<String> iterator = parts.keySet().iterator();
        ArgumentListNode partsList = null;
       
        //Loop through list of SkinParts and generate key/value field
        while( iterator. hasNext() ){
            String key = iterator.next();
            LiteralStringNode partName = nodeFactory.literalString(key);
            LiteralBooleanNode required = nodeFactory.literalBoolean(parts.get(key));
            LiteralFieldNode literalField = nodeFactory.literalField(partName, required);
            partsList = nodeFactory.argumentList(partsList, literalField);

        }
       
        //Create literalObject with key/value pairs
        TypeExpressionNode typeExpression = AbstractSyntaxTreeUtil.generateTypeExpression(nodeFactory, OBJECT, true);  
        LiteralObjectNode literalObject = nodeFactory.literalObject(partsList);
       
        //And finally our completed _skinPart AST
        VariableDefinitionNode skinParts = (VariableDefinitionNode)AbstractSyntaxTreeUtil.generatePrivateStaticVariable(currentContext, typeExpression, _SKINPARTS, literalObject);
       
        //Signature for getter that takes no parameters (of course) and returns an Object
        MemberExpressionNode returnTypeExpression = AbstractSyntaxTreeUtil.generateGetterSelector(nodeFactory, OBJECT, true);
        TypeExpressionNode returnType = nodeFactory.typeExpression(returnTypeExpression, true, false, -1);
        FunctionSignatureNode functionSignature = nodeFactory.functionSignature(null, returnType);
       
        //generate <ClassName>._skinParts
        IdentifierNode identifier = AbstractSyntaxTreeUtil.generateIdentifier(nodeFactory, _SKINPARTS, false);
        GetExpressionNode selector = nodeFactory.getExpression(identifier);
      
        MemberExpressionNode memberExpression = nodeFactory.memberExpression(null, selector);
        ListNode list = nodeFactory.list(null, memberExpression);

        //return <ClassName>._skinParts
        ReturnStatementNode returnStatement = nodeFactory.returnStatement(list);
        StatementListNode rStatementList = nodeFactory.statementList(null, returnStatement);
       
        //Create final expression
        FunctionCommonNode propertyGetter = nodeFactory.functionCommon(currentContext, null, functionSignature, rStatementList);
      
        //Create FunctionDefinition that will contain the above expression and set its type to a GETTER
View Full Code Here


                if (!classDeclaresIdentifier(cx, classDef, typeAnalyzer, SKINHOSTCOMPONENT))
                {
                    NodeFactory nodeFactory = cx.getNodeFactory();
                    MetaDataNode bindingMetaData = AbstractSyntaxTreeUtil.generateMetaData(nodeFactory, BINDABLE);
                    bindingMetaData.setId(BINDABLE);
                    StatementListNode statementList = nodeFactory.statementList(classDef.statements, bindingMetaData);

                    int listSize = node.def.metaData.items.size();
                    // if the HostComponent metadata node has more than one items.
                    // then look for the associated comment and stick it to the variable.
                    if (listSize > 1)
View Full Code Here

        MemberExpressionNode memberExpression =
            nodeFactory.memberExpression(_bindingEventDispatcherGetterSelector, callExpression);
        ListNode list = nodeFactory.list(null, memberExpression);
        ExpressionStatementNode expressionStatement = nodeFactory.expressionStatement(list);

        StatementListNode functionStatementList = nodeFactory.statementList(null, expressionStatement);

        FunctionCommonNode functionCommon = nodeFactory.functionCommon(context, null, functionSignature,
                                                                       functionStatementList);
        functionCommon.setUserDefinedBody(true);
View Full Code Here

        MemberExpressionNode memberExpression =
            nodeFactory.memberExpression(_bindingEventDispatcherGetterSelector, callExpression);
        ListNode returnList = nodeFactory.list(null, memberExpression);
        ReturnStatementNode returnStatement = nodeFactory.returnStatement(returnList);

        StatementListNode functionStatementList = nodeFactory.statementList(null, returnStatement);

        FunctionCommonNode functionCommon = nodeFactory.functionCommon(context, null, functionSignature,
                                                                       functionStatementList);
        functionCommon.setUserDefinedBody(true);
View Full Code Here

            MemberExpressionNode memberExpression = nodeFactory.memberExpression(thisExpression, getExpression);
            ListNode returnList = nodeFactory.list(null, memberExpression);
            returnStatement = nodeFactory.returnStatement(returnList);
        }

        StatementListNode functionStatementList = nodeFactory.statementList(null, returnStatement);

        FunctionCommonNode functionCommon = nodeFactory.functionCommon(context, null, functionSignature,
                                                                       functionStatementList, position);
        functionCommon.setUserDefinedBody(true);
View Full Code Here

        MemberExpressionNode memberExpression =
            nodeFactory.memberExpression(_bindingEventDispatcherGetterSelector, callExpression);
        ListNode returnList = nodeFactory.list(null, memberExpression);
        ReturnStatementNode returnStatement = nodeFactory.returnStatement(returnList);

        StatementListNode functionStatementList = nodeFactory.statementList(null, returnStatement);

        FunctionCommonNode functionCommon = nodeFactory.functionCommon(context, null, functionSignature,
                                                                       functionStatementList);
        functionCommon.setUserDefinedBody(true);
View Full Code Here

        MemberExpressionNode memberExpression =
            nodeFactory.memberExpression(_bindingEventDispatcherGetterSelector, callExpression);
        ListNode list = nodeFactory.list(null, memberExpression);
        ExpressionStatementNode expressionStatement = nodeFactory.expressionStatement(list);

        StatementListNode functionStatementList = nodeFactory.statementList(null, expressionStatement);

        FunctionCommonNode functionCommon = nodeFactory.functionCommon(context, null, functionSignature,
                                                                       functionStatementList);
        functionCommon.setUserDefinedBody(true);
View Full Code Here

        FunctionSignatureNode functionSignature = nodeFactory.functionSignature(parameterList, null);
        functionSignature.void_anno = true;
        AttributeListNode attributeList = generateAttributeList(nodeFactory, accessorInfo.getAttributeString());
        IdentifierNode propertyNameIdentifier = nodeFactory.identifier(accessorInfo.getPropertyName());
        FunctionNameNode functionName = nodeFactory.functionName(Tokens.SET_TOKEN, propertyNameIdentifier);
        StatementListNode functionStatementList;
        String qualifiedBackingPropertyName = accessorInfo.getQualifiedBackingPropertyName().intern();
        String setterAccessPropertyName;

        if (accessorInfo.getIsFunction())
        {
            setterAccessPropertyName = accessorInfo.getQualifiedPropertyName().intern();
        }
        else
        {
            setterAccessPropertyName = qualifiedBackingPropertyName;
        }

        if (accessorInfo.getIsStatic())
        {
            VariableDefinitionNode variableDefinition =
                generateStaticOldValueVariable(nodeFactory, className, setterAccessPropertyName);
            functionStatementList = nodeFactory.statementList(null, variableDefinition);

            ListNode test = generateOldValueStrictlyNotEqualsValueText(nodeFactory);
            StatementListNode then =
                generateStaticSetterAssignment(nodeFactory, className, qualifiedBackingPropertyName);
            then = generateStaticDispatchEventCall(nodeFactory, then, className, accessorInfo.getQualifiedPropertyName());

            Node ifStatement = nodeFactory.ifStatement(test, then, null);
            functionStatementList = nodeFactory.statementList(functionStatementList, ifStatement);
        }
        else
        {
            VariableDefinitionNode variableDefinition = generateOldValueVariable(nodeFactory, setterAccessPropertyName);
            functionStatementList = nodeFactory.statementList(null, variableDefinition);

            ListNode test = generateOldValueStrictlyNotEqualsValueText(nodeFactory);
            StatementListNode then = generateSetterAssignment(nodeFactory, qualifiedBackingPropertyName);
            then = generateDispatchEventCall(nodeFactory, then, accessorInfo.getQualifiedPropertyName());

            Node ifStatement = nodeFactory.ifStatement(test, then, null);;
            functionStatementList = nodeFactory.statementList(functionStatementList, ifStatement);
        }
View Full Code Here

        MemberExpressionNode memberExpression =
            nodeFactory.memberExpression(eventDispatcherMemberExpression, dispatchEventCallExpression);
        ListNode list = nodeFactory.list(null, memberExpression);
        ExpressionStatementNode expressionStatement =
            nodeFactory.expressionStatement(list);
        StatementListNode then = nodeFactory.statementList(null, expressionStatement);

        Node ifStatement = nodeFactory.ifStatement(test, then, null);
        return nodeFactory.statementList(outerThen, ifStatement);
    }
View Full Code Here

        FunctionNameNode functionName = nodeFactory.functionName(Tokens.GET_TOKEN, staticEventDispatcherIdentifier);
        MemberExpressionNode memberExpression =
            AbstractSyntaxTreeUtil.generateGetterSelector(nodeFactory, _STATIC_BINDING_EVENT_DISPATCHER, false);
        ListNode returnList = nodeFactory.list(null, memberExpression);
        ReturnStatementNode returnStatement = nodeFactory.returnStatement(returnList);
        StatementListNode functionStatementList = nodeFactory.statementList(null, returnStatement);
        FunctionCommonNode functionCommon = nodeFactory.functionCommon(context, null, functionSignature,
                                                                       functionStatementList);
        functionCommon.setUserDefinedBody(true);
        return nodeFactory.functionDefinition(context, attributeList, functionName, functionCommon);
    }
View Full Code Here

TOP

Related Classes of macromedia.asc.parser.StatementListNode

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.