Package org.eclipse.dltk.ast.expressions

Examples of org.eclipse.dltk.ast.expressions.CallArgumentsList


                PHPCallExpression expression = (PHPCallExpression) statement.getExpr();
                String callName = expression.getCallName().getName();

                if (callName.startsWith(SymfonyCoreConstants.RENDER_PREFIX)) {

                    CallArgumentsList args = expression.getArgs();
                    List<ASTNode> children = args.getChilds();

                    Scalar view = (Scalar) children.get(0);

                    if (children.size() >= 2 && children.get(1).getClass() == ArrayCreation.class) {
                        parseVariablesFromArray((ArrayCreation) children.get(1), PathUtils.createViewPath(view));
View Full Code Here


                }
                // TODO: check if the variable implements Symfony\Component\DependencyInjection\ContainerInterface
                else if("setAlias".equals(call.getName())) {

                    if (call.getReceiver() instanceof VariableReference) {
                        CallArgumentsList args = call.getArgs();
                        if (args.getChilds().size() == 2) {

                            List<ASTNode> nodes = args.getChilds();

                            try {

                                Scalar alias = (Scalar) nodes.get(0);
                                Scalar reference = (Scalar) nodes.get(1);
View Full Code Here

                        if (key.getClass() == Scalar.class && value.getClass() == ClassInstanceCreation.class) {

                            Scalar name = (Scalar) key;
                            ClassInstanceCreation filterClass = (ClassInstanceCreation) value;

                            CallArgumentsList ctorParams = filterClass.getCtorParams();
                            Object child = ctorParams.getChilds().get(0);

                            if (child instanceof VariableReference && ((VariableReference)child).getName().equals("$this") &&
                                    filterClass.getClassName().toString().equals((TwigCoreConstants.TWIG_FILTER_METHOD))) {
                               
                                    if (ctorParams.getChilds().size() > 2 && ctorParams.getChilds().get(1) instanceof Scalar) {
                                        Scalar internal = (Scalar) ctorParams.getChilds().get(1);
                                        String elemName = name.getValue().replaceAll("['\"]", "");
                                        Filter filter = new Filter(elemName);
                                        filter.setInternalFunction(internal.getValue().replaceAll("['\"]", ""));
                                        filter.setPhpClass(currentClass.getName());
                                        filters.add(filter);
                                    }
                            }
                           
                            if (!(child instanceof Scalar)) {
                                return true;
                            }

                            Scalar internal = (Scalar) child;

                            if (filterClass.getClassName().toString().equals(TwigCoreConstants.TWIG_FILTER_FUNCTION)) {

                                String elemName = name.getValue().replaceAll("['\"]", "");

                                Filter filter = new Filter(elemName);
                                filter.setInternalFunction(internal.getValue()
                                        .replaceAll("['\"]", ""));
                                filter.setPhpClass(currentClass.getName());

                                filters.add(filter);

                            }
                        }
                        return true;
                    }
                });

            } else if (inTwigExtension && TwigCoreConstants.GET_TESTS.equals(s.getName())) {

                phpMethod.traverse(new PHPASTVisitor()
                {

                    @Override
                    public boolean visit(ArrayElement s) throws Exception
                    {

                        Expression key = s.getKey();
                        Expression value = s.getValue();

                        if (key == null || value == null)
                            return false;

                        if (key.getClass() == Scalar.class && value.getClass() == ClassInstanceCreation.class) {

                            Scalar name = (Scalar) key;
                            ClassInstanceCreation functionClass = (ClassInstanceCreation) value;

                            CallArgumentsList args = functionClass.getCtorParams();
                            Scalar internalFunction = (Scalar) args.getChilds().get(0);

                            if (internalFunction == null)
                                return true;

                            if (functionClass.getClassName().toString().equals(TwigCoreConstants.TWIG_TEST_FUNCTION)) {

                                String elemName = name.getValue().replaceAll("['\"]", "");

                                JSONObject metadata = new JSONObject();
                                metadata.put(TwigType.PHPCLASS,currentClass.getName());

                                Test test = new Test(elemName);
                                test.setPhpClass(currentClass.getName());
                                test.setInternalFunction(internalFunction.getValue().replaceAll("['\"]", ""));
                                tests.add(test);

                            }
                        }
                        return true;
                    }
                });

            } else if (inTwigExtension&& TwigCoreConstants.GET_FUNCTIONS.equals(s.getName())) {

                phpMethod.traverse(new PHPASTVisitor()
                {
                    @Override
                    public boolean visit(ArrayElement s) throws Exception
                    {

                        Expression key = s.getKey();
                        Expression value = s.getValue();

                        if (key == null || value == null) {
                            return false;
                        }

                        if (key.getClass() == Scalar.class && value.getClass() == ClassInstanceCreation.class) {

                            Scalar name = (Scalar) key;
                            ClassInstanceCreation functionClass = (ClassInstanceCreation) value;
                            CallArgumentsList args = functionClass.getCtorParams();
                            String functionClassName = functionClass.getClassName().toString();
                            int index = -1;
                           
                            if (functionClassName.equals(TwigCoreConstants.TWIG_FUNCTION_FUNCTION)) {
                                index = 0;
                            } else if (functionClassName.equals(TwigCoreConstants.TWIG_FUNCTION_METHOD)) {
                                index = 1;
                            }

                            if (index > -1 && args.getChilds().get(index) instanceof Scalar) {

                                Scalar internalFunction = (Scalar) args.getChilds().get(index);

                                if (internalFunction == null) {
                                    return true;
                                }
View Full Code Here

                    if (s.getExpr() instanceof PHPCallExpression) {

                        PHPCallExpression call = (PHPCallExpression) s
                                .getExpr();
                        CallArgumentsList args = call.getArgs();

                        if ("test".equals(call.getName())
                                && args.getChilds().size() == 1) {

                            Object arg = args.getChilds().get(0);

                            if (arg instanceof Scalar) {

                                Scalar scalar = (Scalar) arg;
                                statements.add(scalar.getValue().replaceAll(
View Full Code Here

TOP

Related Classes of org.eclipse.dltk.ast.expressions.CallArgumentsList

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.