Examples of IdentifierNode


Examples of macromedia.asc.parser.IdentifierNode

        MemberExpressionNode returnTypeMemberExpression =
            AbstractSyntaxTreeUtil.generateGetterSelector(nodeFactory, I_EVENT_DISPATCHER, true);
        TypeExpressionNode returnType = nodeFactory.typeExpression(returnTypeMemberExpression, true, false, -1);
        FunctionSignatureNode functionSignature = nodeFactory.functionSignature(null, returnType);
        AttributeListNode attributeList = AbstractSyntaxTreeUtil.generatePublicStaticAttribute(nodeFactory);
        IdentifierNode staticEventDispatcherIdentifier = nodeFactory.identifier(STATIC_EVENT_DISPATCHER, false);
        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);
View Full Code Here

Examples of macromedia.asc.parser.IdentifierNode

    {
        // Equivalent AS:
        //
        //   var oldValue:Object = ${bindableInfo.className}.$setterAccessPropertyName;
        MemberExpressionNode base = AbstractSyntaxTreeUtil.generateGetterSelector(nodeFactory, className, false);
        IdentifierNode identifer = nodeFactory.identifier(qualifiedBackingPropertyName, false);
        GetExpressionNode getExpression = nodeFactory.getExpression(identifer);
        MemberExpressionNode memberExpression = nodeFactory.memberExpression(base, getExpression);
        return AbstractSyntaxTreeUtil.generateVariable(nodeFactory, OLD_VALUE, OBJECT, false, memberExpression);
    }
View Full Code Here

Examples of macromedia.asc.parser.IdentifierNode

    {
        // Equivalent AS:
        //
        //   ${bindableInfo.className}.${entry.qualifiedBackingPropertyName} = value;
        MemberExpressionNode base = AbstractSyntaxTreeUtil.generateGetterSelector(nodeFactory, className, false);       
        IdentifierNode identifier =
            AbstractSyntaxTreeUtil.generateIdentifier(nodeFactory, qualifiedBackingPropertyName, false);
        MemberExpressionNode getterSelector =
            AbstractSyntaxTreeUtil.generateGetterSelector(nodeFactory, VALUE, false);
        ArgumentListNode argumentList = nodeFactory.argumentList(null, getterSelector);
        SetExpressionNode setExpression = nodeFactory.setExpression(identifier, argumentList, false);
View Full Code Here

Examples of macromedia.asc.parser.IdentifierNode

        //        return _bindingEventDispatcher.willTrigger(type);
        //    }
        NodeFactory nodeFactory = context.getNodeFactory();
        AttributeListNode attributeList = AbstractSyntaxTreeUtil.generatePublicAttribute(nodeFactory);

        IdentifierNode willTriggerIdentifier = nodeFactory.identifier(WILL_TRIGGER, false);
        FunctionNameNode functionName = nodeFactory.functionName(Tokens.EMPTY_TOKEN, willTriggerIdentifier);

        ParameterNode typeParameter =
            AbstractSyntaxTreeUtil.generateParameter(nodeFactory, TYPE, STRING, false);
        ParameterListNode parameterList = nodeFactory.parameterList(null, typeParameter);
        MemberExpressionNode returnTypeMemberExpression =
            AbstractSyntaxTreeUtil.generateGetterSelector(nodeFactory, BOOLEAN, true);
        TypeExpressionNode returnType = nodeFactory.typeExpression(returnTypeMemberExpression, true, false, -1);
        FunctionSignatureNode functionSignature = nodeFactory.functionSignature(parameterList, returnType);

        MemberExpressionNode _bindingEventDispatcherGetterSelector =
            AbstractSyntaxTreeUtil.generateGetterSelector(nodeFactory, _BINDING_EVENT_DISPATCHER, false);
        IdentifierNode identifier = nodeFactory.identifier(WILL_TRIGGER, false);
        MemberExpressionNode typeGetterSelector =
            AbstractSyntaxTreeUtil.generateGetterSelector(nodeFactory, TYPE, false);
        ArgumentListNode argumentList = nodeFactory.argumentList(null, typeGetterSelector);
        CallExpressionNode callExpression =
            (CallExpressionNode) nodeFactory.callExpression(identifier, argumentList);
View Full Code Here

Examples of macromedia.asc.parser.IdentifierNode

    public MemberExpressionNode getValueExpression(NodeFactory nodeFactory)
    {
        MemberExpressionNode resourceManagerMemberExpression =
            AbstractSyntaxTreeUtil.generateGetterSelector(nodeFactory, RESOURCE_MANAGER, false);
        IdentifierNode getInstanceIdentifier = nodeFactory.identifier(GET_INSTANCE, false);
        CallExpressionNode getInstanceCallExpression =
            (CallExpressionNode) nodeFactory.callExpression(getInstanceIdentifier, null);
        getInstanceCallExpression.setRValue(false);
        MemberExpressionNode base = nodeFactory.memberExpression(resourceManagerMemberExpression,
                                                                 getInstanceCallExpression);

        IdentifierNode methodNameIdentifier = nodeFactory.identifier(methodName);
        LiteralStringNode bundleLiteralString = nodeFactory.literalString(bundle);
        ArgumentListNode argumentList = nodeFactory.argumentList(null, bundleLiteralString);
        LiteralStringNode keyLiteralString = nodeFactory.literalString(key);
        argumentList = nodeFactory.argumentList(argumentList, keyLiteralString);
        CallExpressionNode selector =
View Full Code Here

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

        // The following unguarded casts are safe, because this is a cost
        // function and the pattern matcher has checked all the node IDs.
        final MemberAccessExpressionNode memberAccessNode = (MemberAccessExpressionNode)n;
        final FunctionCallNode callNode = (FunctionCallNode)memberAccessNode.getLeftOperandNode();
        final IdentifierNode idNode = (IdentifierNode)callNode.getArgumentsNode().getChild(0);

        if (idNode.getName().equals(IASKeywordConstants.THIS))
            return 1;
        else
            return Integer.MAX_VALUE;
    }
View Full Code Here

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

     @return an attractive cost if the child has a known namespace, i.e.,
     *    it's a compile-time constant qualifier.
     */
    public static int qualifierIsCompileTimeConstant(IASNode iNode, ICompilerProject project)
    {
        IdentifierNode qualifier = (IdentifierNode) SemanticUtils.getNthChild(iNode, 0);
        IDefinition def = qualifier.resolve(project);

        if ( def instanceof NamespaceDefinition )
            return 1;
        else
            return Integer.MAX_VALUE;
View Full Code Here

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

        {
            return super.buildAST(problems, filename);
        }

        FileNode fileNode = new FileNode(workspace, filename);
        PackageNode packageNode = new PackageNode(new IdentifierNode(""), null);
        fileNode.addItem(packageNode);

        ScopedBlockNode packageContents = packageNode.getScopedNode();
        ImportNode importNode = ImportNode.buildImportNode(getBaseClassQName());
        packageContents.addItem(importNode);
        importNode = ImportNode.buildImportNode("mx.core.ByteArrayAsset");
        packageContents.addItem(importNode);
        importNode = ImportNode.buildImportNode("flash.utils.ByteArray");
        packageContents.addItem(importNode);

        // 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, "==");
        BinaryOperatorNodeBase nullCheck = BinaryOperatorNodeBase.create(compareToken, new IdentifierNode("bytes"), new LiteralNode(LiteralType.NULL, nullToken));
        IfNode ifStmt = new IfNode(null);
        ConditionalNode cNode = new ConditionalNode(null);
        cNode.setConditionalExpression(nullCheck);
        ifStmt.addBranch(cNode);
        movieClipDataContents.addItem(ifStmt);
        BlockNode ifContents = cNode.getContentsNode();

        // generate: bytes = ByteArray(new $assetByteArray());
        ASToken newToken = new ASToken(ASTokenTypes.TOKEN_KEYWORD_NEW, -1, -1, -1, -1, IASKeywordConstants.NEW);
        FunctionCallNode newBytes = new FunctionCallNode(newToken, new IdentifierNode(byteArrayClassName));
        FunctionCallNode byteArrayCall = new FunctionCallNode(new IdentifierNode("ByteArray"));
        ContainerNode args = byteArrayCall.getArgumentsNode();
        args.addItem(newBytes);
        BinaryOperatorNodeBase assignmentBytes = BinaryOperatorNodeBase.create(assignToken, new IdentifierNode("bytes"), byteArrayCall);
        ifContents.addItem(assignmentBytes);

        // generate: return bytes;
        ReturnNode returnStmt = new ReturnNode(null);
        returnStmt.setStatementExpression(new IdentifierNode("bytes"));
        movieClipDataContents.addItem(returnStmt);

        classNodeMovieContents.addItem(movieClipDataGetterNode);

        fileNode.runPostProcess(EnumSet.of(PostProcessStep.POPULATE_SCOPE));
View Full Code Here

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

     @pre - the node has an IdentifierNode 0th child.
     *  @return an attractive cost if the child is an interface.
     */
    public static int qualifierIsInterface(IASNode iNode, ICompilerProject project)
    {
        IdentifierNode qualifier = (IdentifierNode) SemanticUtils.getNthChild(iNode, 0);
        IDefinition def = qualifier.resolve(project);

        if ( def instanceof InterfaceDefinition )
            return 1;
        else
            return Integer.MAX_VALUE;
View Full Code Here

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

            {
                transferringConstants = true;

                ISyntaxTreeRequestResult treeResult = Iterables.getOnlyElement(units).getSyntaxTreeRequest().get();
                configScope = ((ConfigFileNode)treeResult.getAST()).getTargetConfigScope();
                addConditionalCompilationNamespace(new ConfigNamespaceNode(new IdentifierNode(IASLanguageConstants.DEFAULT_CONFIG_NAME, (Token)null)));
                if (variables != null)
                {
                    if (variables != null)
                    {
                        List<IDefinition> definitions = variables.getRequiredDefinitions();
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.