Package org.apache.flex.compiler.internal.tree.as

Examples of org.apache.flex.compiler.internal.tree.as.NamespaceIdentifierNode


        // generate the byte array class
        String byteArrayClassName = data.getQName() + byteArrayNamePostfix;
        ClassNode classNodeByteArray = new ClassNode(new IdentifierNode(byteArrayClassName));
        classNodeByteArray.setBaseClass(new IdentifierNode("ByteArrayAsset"));
        classNodeByteArray.setNamespace(new NamespaceIdentifierNode(INamespaceConstants.public_));
        packageContents.addItem(classNodeByteArray);

        // generate the movie class
        String movieClassName = data.getQName();
        ClassNode classNodeMovie = new ClassNode(new IdentifierNode(movieClassName));
        classNodeMovie.setBaseClass(new IdentifierNode(getBaseClassName()));
        classNodeMovie.setNamespace(new NamespaceIdentifierNode(INamespaceConstants.public_));
        packageContents.addItem(classNodeMovie);
        ScopedBlockNode classNodeMovieContents = classNodeMovie.getScopedNode();

        // generate: private static var bytes:ByteArray = null;
        VariableNode variableNodeBytes = new VariableNode(new IdentifierNode("bytes"));
        variableNodeBytes.setNamespace(new NamespaceIdentifierNode(INamespaceConstants.private_));
        variableNodeBytes.addModifier(new ModifierNode(IASKeywordConstants.STATIC));
        variableNodeBytes.setType(null, new IdentifierNode("ByteArray"));
        ASToken assignToken = new ASToken(ASTokenTypes.TOKEN_OPERATOR_ASSIGNMENT, -1, -1, -1, -1, "=");
        ASToken nullToken = new ASToken(ASTokenTypes.TOKEN_KEYWORD_NULL, -1, -1, -1, -1, IASKeywordConstants.NULL);
        LiteralNode nullNode = new LiteralNode(LiteralType.NULL, nullToken);
        variableNodeBytes.setAssignedValue(assignToken, nullNode);
        classNodeMovieContents.addItem(variableNodeBytes);

        // build the constructor
        IdentifierNode constructorNameNode = new IdentifierNode(movieClassName);
        constructorNameNode.setReferenceValue(classNodeMovie.getDefinition());
        FunctionNode constructorNode = new FunctionNode(null, constructorNameNode);
        constructorNode.setNamespace(new NamespaceIdentifierNode(INamespaceConstants.public_));
        ScopedBlockNode constructorContents = constructorNode.getScopedNode();

        // generate: super();
        FunctionCallNode superCall = new FunctionCallNode(LanguageIdentifierNode.buildSuper());
        constructorContents.addItem(superCall);

        // generate: initialWidth = $swfWidth;
        LiteralNode widthNode = new NumericLiteralNode(Integer.toString(swfWidth));
        BinaryOperatorNodeBase assignmentWidth = BinaryOperatorNodeBase.create(assignToken, new IdentifierNode("initialWidth"), widthNode);
        constructorContents.addItem(assignmentWidth);

        // generate: initialHeight = $swfHeight;
        LiteralNode heightNode = new NumericLiteralNode(Integer.toString(swfHeight));
        BinaryOperatorNodeBase assignmentHeight = BinaryOperatorNodeBase.create(assignToken, new IdentifierNode("initialHeight"), heightNode);
        constructorContents.addItem(assignmentHeight);

        classNodeMovieContents.addItem(constructorNode);

        // build the movieClipData() getter
        GetterNode movieClipDataGetterNode = new GetterNode(null, null, new IdentifierNode("movieClipData"));
        movieClipDataGetterNode.addModifier(new ModifierNode(IASKeywordConstants.OVERRIDE));
        movieClipDataGetterNode.setNamespace(new NamespaceIdentifierNode(INamespaceConstants.public_));
        movieClipDataGetterNode.setType(null, new IdentifierNode("ByteArray"));
        ScopedBlockNode movieClipDataContents = movieClipDataGetterNode.getScopedNode();

        // generate: if (bytes == null)
        ASToken compareToken = new ASToken(ASTokenTypes.TOKEN_OPERATOR_EQUAL, -1, -1, -1, -1, "==");
View Full Code Here


        superNode.setType(null, new IdentifierNode(IASLanguageConstants.Object));
        retVal[1] = superNode;

        //add the fixed getter/setter pair
        GetterNode fixGetter = new GetterNode(null, null, new IdentifierNode("fixed"));
        NamespaceIdentifierNode pub = new NamespaceIdentifierNode(INamespaceConstants.public_);
        pub.span(-1, -1, -1, -1);
        fixGetter.setNamespace(pub);
        fixGetter.setType(null, new IdentifierNode(IASLanguageConstants.Boolean));
        retVal[2] = fixGetter;

        SetterNode fixSetter = new SetterNode(null, null, new IdentifierNode("fixed"));
        pub = new NamespaceIdentifierNode(INamespaceConstants.public_);
        pub.span(-1, -1, -1, -1);
        fixSetter.setNamespace(pub);
        fixSetter.setType(null, new IdentifierNode(IASLanguageConstants.void_));
        ParameterNode value = new ParameterNode(new IdentifierNode("value"));
        value.setType(null, new IdentifierNode(IASLanguageConstants.Boolean));
        fixSetter.getParametersContainerNode().addChild(value);
View Full Code Here

        ImportNode importNode = ImportNode.buildImportNode(getBaseClassQName());
        contents.addItem(importNode);

        ClassNode classNode = new ClassNode(new IdentifierNode(data.getQName()));
        classNode.setBaseClass(new IdentifierNode(getBaseClassName()));
        classNode.setNamespace(new NamespaceIdentifierNode(INamespaceConstants.public_));
        contents.addItem(classNode);

        fileNode.runPostProcess(EnumSet.of(PostProcessStep.POPULATE_SCOPE));

        return fileNode;
View Full Code Here

            {
                ((MemberAccessExpressionNode)left).setRightOperandNode(new NamespaceAccessExpressionNode((NamespaceIdentifierNode)maRight, op, right));
            }
            else if (maRight instanceof IdentifierNode)
            {
                ((MemberAccessExpressionNode)left).setRightOperandNode(new NamespaceAccessExpressionNode(new NamespaceIdentifierNode((IdentifierNode)maRight), op, right));
                //this is the @ case, so @x::y
            }
            else if (maRight instanceof UnaryOperatorNodeBase && ((UnaryOperatorNodeBase)maRight).getOperator() == OperatorType.AT)
            {
                ((UnaryOperatorNodeBase)maRight).setExpression(new NamespaceAccessExpressionNode((IdentifierNode)((UnaryOperatorNodeBase)maRight).getOperandNode(), op, right));
View Full Code Here

            final String configNamespace,
            final ASToken opToken,
            final String configVar)
    {
        final ConfigExpressionNode configExpression = new ConfigExpressionNode(
                new NamespaceIdentifierNode(configNamespace),
                opToken,
                new IdentifierNode(configVar));

        final Object value = configProcessor.evaluateConstNodeExpressionToJavaObject(configExpression);
        return value == null ? false : ECMASupport.toBoolean(value);
View Full Code Here

        fileNode.addItem(packageNode);

        ScopedBlockNode contents = packageNode.getScopedNode();

        ClassNode classNode = new ClassNode(new IdentifierNode(data.getQName()));
        classNode.setNamespace(new NamespaceIdentifierNode(INamespaceConstants.public_));
        contents.addItem(classNode);

        // generate: public static var data:XML = ${XML_DATA};
        VariableNode variableNodeData = new VariableNode(new IdentifierNode("data"));
        variableNodeData.setNamespace(new NamespaceIdentifierNode(INamespaceConstants.public_));
        variableNodeData.addModifier(new ModifierNode(IASKeywordConstants.STATIC));
        variableNodeData.setType(null, new IdentifierNode("XML"));
        ASToken assignToken = new ASToken(ASTokenTypes.TOKEN_OPERATOR_ASSIGNMENT, -1, -1, -1, -1, "=");
        String xmlContents = getXMLString(problems);
        LiteralNode xmlData = new LiteralNode(LiteralType.STRING, xmlContents);
View Full Code Here

        // generate the byte array class name
        String byteArrayClassName = data.getQName() + byteArrayNamePostfix;
        ClassNode classNodeByteArray = new ClassNode(new IdentifierNode(byteArrayClassName));
        classNodeByteArray.setBaseClass(new IdentifierNode(getBaseClassName()));
        classNodeByteArray.setNamespace(new NamespaceIdentifierNode(INamespaceConstants.public_));
        packageContents.addItem(classNodeByteArray);

        // generate the pbj class name
        String pbjClassName = data.getQName();
        ClassNode classNodePbj = new ClassNode(new IdentifierNode(pbjClassName));
        classNodePbj.setBaseClass(new IdentifierNode("Shader"));
        classNodePbj.addInterface(new IdentifierNode("IFlexAsset"));
        classNodePbj.setNamespace(new NamespaceIdentifierNode(INamespaceConstants.public_));
        packageContents.addItem(classNodePbj);

        // build the constructor
        IdentifierNode constructorNameNode = new IdentifierNode(pbjClassName);
        constructorNameNode.setReferenceValue(classNodePbj.getDefinition());
        FunctionNode constructorNode = new FunctionNode(null, constructorNameNode);
        constructorNode.setNamespace(new NamespaceIdentifierNode(INamespaceConstants.public_));
        ScopedBlockNode constructorContents = constructorNode.getScopedNode();

        // generate: super();
        FunctionCallNode superCall = new FunctionCallNode(LanguageIdentifierNode.buildSuper());
        constructorContents.addItem(superCall);
View Full Code Here

TOP

Related Classes of org.apache.flex.compiler.internal.tree.as.NamespaceIdentifierNode

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.