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

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

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

import com.google.common.base.Predicate;
import net.jangaroo.jooc.ast.Directive;
import net.jangaroo.jooc.ast.FunctionDeclaration;

import javax.annotation.Nullable;

class IsNativeConstructor implements Predicate {
  private final MxmlCompilationUnit mxmlCompilationUnit;

  public IsNativeConstructor(MxmlCompilationUnit mxmlCompilationUnit) {
    this.mxmlCompilationUnit = mxmlCompilationUnit;
  }

  @Override
  public boolean apply(@Nullable Directive directive) {
    if (directive instanceof FunctionDeclaration) {
      FunctionDeclaration f = (FunctionDeclaration) directive;
      return !f.isGetterOrSetter() && f.isNative() && f.getIde().getName().equals(mxmlCompilationUnit.getPrimaryDeclaration().getName());
    }
    return false;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy