All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.jangaroo.jooc.mxml.ast.CompilationUnitUtils Maven / Gradle / Ivy

There is a newer version: 4.1.17
Show newest version
package net.jangaroo.jooc.mxml.ast;

import net.jangaroo.jooc.CompilationUnitResolver;
import net.jangaroo.jooc.ast.ClassDeclaration;
import net.jangaroo.jooc.ast.CompilationUnit;
import net.jangaroo.jooc.ast.FunctionDeclaration;
import net.jangaroo.jooc.ast.Parameter;
import net.jangaroo.jooc.ast.Parameters;
import net.jangaroo.jooc.mxml.MxmlUtils;

class CompilationUnitUtils {
  static boolean constructorSupportsConfigOptionsParameter(String classQName, CompilationUnitResolver resolver) {
    CompilationUnit compilationUnitModel = resolver.resolveCompilationUnit(classQName);
    ClassDeclaration classModel = (ClassDeclaration) compilationUnitModel.getPrimaryDeclaration();
    if (classModel != null) {
      FunctionDeclaration constructorModel = classModel.getConstructor();
      if (constructorModel != null) {
        Parameters constructorParams = constructorModel.getParams();
        if (constructorParams != null) {
          Parameter firstParam = constructorParams.getHead();
          if (MxmlUtils.CONFIG.equals(firstParam.getName())) {
            return true;
          }
        }
      }
    }
    return false;
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy