Package anvil.script

Examples of anvil.script.Type


  /// @method getClass
  /// Returns the class where this type is declared.
  /// @synopsis Type getClass()
  public Any m_getClass()
  {
    Type parent = _type.getParent();
    if (parent != null && parent.getType() == Type.CLASS) {
      return new AnyType(parent);
    }
    return UNDEFINED;
  }
View Full Code Here


  /// @method getParent
  /// Returns the parent type for this type.
  /// @synopsis Scope getParent()
  public Any m_getParent()
  {
    Type type = _type.getParent();
    if (type != null) {
      return new AnyType(type);
    }
    return UNDEFINED;
  }
View Full Code Here

    if (!(clazz instanceof AnyType)) {
      throw context.BadParameter("Type expected");
    }
    if (_typecode == Type.CLASS) {
      ClassType self = (ClassType)_type;
      Type other = (Type)clazz.toObject();
      return self.isInstanceOf(other) ? TRUE : FALSE;
    }
    return FALSE;
  }
View Full Code Here

  }


  public Type lookupDeclaration(String name)
  {
    Type type = (Type)_types.get(name);
    if (type == null) {
      if (_context != null) {
        type = _context.lookupDeclaration(name);
      }
      if (type == null) {
View Full Code Here

    return _scope;
  }

  private VariableType getVariable(String name)
  {
    Type type = _scope.lookupDeclaration(name);
    if (type instanceof VariableType) {
      return (VariableType)type;
    }
    return null;
  }
View Full Code Here

  }


  public static final Any unserialize(Unserializer unserializer) throws UnserializationException
  {
    Type type = AnyType.unserializeType(unserializer);
    if (type instanceof Scope) {
      AnyScope scope = new AnyScope((Scope)type);
      unserializer.register(scope);
      return scope;
    }
View Full Code Here

  }


  public boolean has(String methodName)
  {
    Type type = _scope.lookupDeclaration(methodName);
    return ((type != null) && (type.getType() == Type.FUNCTION));
  }
View Full Code Here

  }


  protected FunctionDispatcher getDispatcherFor(Context context, String name)
  {
    Type type = _scope.lookupDeclaration(name);
    if ((type != null) && (type.getType() == Type.FUNCTION)) {
      return ((CompilableFunction)type).getDispatcher(context);
    } else {
      throw context.NoSuchMethod(_scope.getName() + '.' + name);
    }   
  }
View Full Code Here

  }

  protected FunctionDispatcher getDispatcherFor(Context context, int index)
  {
    String name = Register.getNameOf(index);
    Type type = _scope.lookupDeclaration(name);
    if ((type != null) && (type.getType() == Type.FUNCTION)) {
      return ((CompilableFunction)type).getDispatcher(context);
    } else {
      throw context.NoSuchMethod(_scope.getName() + '.' + name);
    }   
  }
View Full Code Here

  }


  public CompiledModule getModule()
  {
    Type type = this;
    while(type != null) {
      Type parent = type.getParent();
      if (parent == null) {
        return (CompiledModule)type;
      }
      type = parent;
    }
View Full Code Here

TOP

Related Classes of anvil.script.Type

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.