Package anvil.script

Examples of anvil.script.Type


  /// Returns the pathinfo where this type is declared.
  /// If it is located on a library, returns the name of library.
  /// @synopsis string getPathinfo()
  public Any m_getPathinfo()
  {
    Type type = _type;
    while(type != null) {
      if (type instanceof Module) {
        return new AnyString(((Module)type).getPathinfo());
      }
      type = type.getParent();
    }
    return UNDEFINED;
  }
View Full Code Here


  }


  public final Any execute(Context context, String name, Any[] parameters)
  {
    Type type = (Type)_types.get(name);
    if (type != null) {
      if (type.getType() == FUNCTION) {
        return ((Function)type).execute(context, parameters);
      }
    }
    throw context.NoSuchFunction(_name + '.' + name);
  }
View Full Code Here

  }


  public Any getFunction(Context context, String name)
  {
    Type type = (Type)_types.get(name);
    if (type != null) {
      if (type.getType() == FUNCTION) {
        return new AnyFunction((Function)type);
      }
    }
    throw context.NoSuchFunction(_name + '.' + name);
  }
View Full Code Here

  }


  public Any getType(Context context, String name)
  {
    Type type = (Type)_types.get(name);
    if (type != null) {
      return new AnyType(type);
    }
    throw context.NoSuchEntity(_name + '.' + name);
  }
View Full Code Here

  }


  public Type getDeclaration(Context context, String name)
  {
    Type type = (Type)_types.get(name);
    if (type != null) {
      return type;
    }
    throw context.NoSuchEntity(_name + '.' + name);
  }
View Full Code Here

  }


  public Any newInstance(Context context, String name, Any[] parameters)
  {
    Type type = (Type)_types.get(name);
    if (type != null) {
      if (type.getType() == CLASS) {
        ClassType clazz = (ClassType)type;
        return clazz.getConstructor().execute(context, parameters);
      }
    }
    throw context.NoSuchClass(_name + '.' + name);
View Full Code Here

  public static final Any unserialize(Unserializer unserializer) throws UnserializationException
  {
    AnyFunction function = new AnyFunction();
    unserializer.register(function);
    Type type = AnyType.unserializeType(unserializer);
    switch(type.getType()) {
    case Type.FUNCTION:
    case Type.METHOD:
      function._function = (Function)type;
      return function;
    }
View Full Code Here

  public static final Any unserializeClosure(Unserializer unserializer) throws UnserializationException
  {
    AnyFunction function = new AnyFunction();
    unserializer.register(function);
    Type type = AnyType.unserializeType(unserializer);
    AnyClass self = null;
    if (unserializer.peek() == 'n') {
      unserializer.consume('n');
    } else {
      self = (AnyClass)unserializer.unserialize();
    }
    switch(type.getType()) {
    case Type.FUNCTION:
    case Type.METHOD:
      {
        Function func = (Function)type;
        function._self = self;
View Full Code Here

    AnyFunction delegate = new AnyFunction();
    unserializer.register(delegate);
    Any self = unserializer.unserialize();
    unserializer.consume('s');
    String name = unserializer.getUTF16String();
    Type type = self.classOf().lookupDeclaration(name);
    if (type != null) {
      if (type.getType() == Type.METHOD) {
        delegate._function = (Function)type;
        delegate._self = self;
        return delegate;
      }
    }
View Full Code Here

  }
 
 
  public Any getAttribute(Context context, String attribute)
  {
    Type type = (Type)_declarations.get(attribute);
    if (type != null) {
      switch(type.getType()) {
      case Type.STATIC_VARIABLE:
      case Type.CONSTANT_VARIABLE:
        return ((StaticVariableType)type).getValue();
      case Type.CLASS:
      case Type.INTERFACE:
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.