/*
* $Id: ClassRef.java,v 1.11 2002/09/16 08:05:03 jkl Exp $
*
* Copyright (c) 2002 Njet Communications Ltd. All Rights Reserved.
*
* Use is subject to license terms, as defined in
* Anvil Sofware License, Version 1.1. See LICENSE
* file, or http://njet.org/license-1.1.txt
*/
package anvil.script;
import anvil.Location;
import anvil.ErrorListener;
/**
* class ClassRef
*
* @author: Jani Lehtimki
*/
public class ClassRef extends Ref
{
protected ClassType _classtype = null;
public ClassRef(ReferenceResolver resolver)
{
super(resolver);
}
public Type getType()
{
return _classtype;
}
public ClassType getClassType()
{
return _classtype;
}
public boolean resolve(ErrorListener context)
{
Type type = _resolver.resolveReference(context);
if (type != null) {
if (type.getType() != Type.CLASS) {
context.error(_resolver.getLocation(), "Entity '"+toString()+"' is not a class");
} else {
if (type instanceof NativeJava) {
context.error(_resolver.getLocation(), "Entity '"+toString()+"' is class which cannot be extended.");
}
_classtype = (ClassType)type;
}
} else {
context.error(_resolver.getLocation(), "Entity '"+toString()+"' is not declared");
}
_resolved = true;
return (_classtype != null);
}
}
|