use of com.sun.tools.javac.code.Symbol in project ceylon-compiler by ceylon.
the class Resolve method resolveOperator.
/** Resolve operator.
* @param pos The position to use for error reporting.
* @param optag The tag of the operation tree.
* @param env The environment current at the operation.
* @param argtypes The types of the operands.
*/
Symbol resolveOperator(DiagnosticPosition pos, int optag, Env<AttrContext> env, List<Type> argtypes) {
Name name = treeinfo.operatorName(optag);
Symbol sym = findMethod(env, syms.predefClass.type, name, argtypes, null, false, false, true);
if (boxingEnabled && sym.kind >= WRONG_MTHS)
sym = findMethod(env, syms.predefClass.type, name, argtypes, null, true, false, true);
return access(sym, pos, env.enclClass.sym.type, name, false, argtypes, null);
}
use of com.sun.tools.javac.code.Symbol in project ceylon-compiler by ceylon.
the class Resolve method resolveSelf.
/**
* Resolve `c.name' where name == this or name == super.
* @param pos The position to use for error reporting.
* @param env The environment current at the expression.
* @param c The qualifier.
* @param name The identifier's name.
*/
Symbol resolveSelf(DiagnosticPosition pos, Env<AttrContext> env, TypeSymbol c, Name name) {
Env<AttrContext> env1 = env;
boolean staticOnly = false;
while (env1.outer != null) {
if (isStatic(env1))
staticOnly = true;
if (env1.enclClass.sym == c) {
Symbol sym = env1.info.scope.lookup(name).sym;
if (sym != null) {
if (staticOnly)
sym = new StaticError(sym);
return access(sym, pos, env.enclClass.sym.type, name, true);
}
}
if ((env1.enclClass.sym.flags() & STATIC) != 0)
staticOnly = true;
env1 = env1.outer;
}
log.error(pos, "not.encl.class", c);
return syms.errSymbol;
}
use of com.sun.tools.javac.code.Symbol in project ceylon-compiler by ceylon.
the class Resolve method resolveMethod.
/** Resolve an unqualified method identifier.
* @param pos The position to use for error reporting.
* @param env The environment current at the method invocation.
* @param name The identifier's name.
* @param argtypes The types of the invocation's value arguments.
* @param typeargtypes The types of the invocation's type arguments.
*/
Symbol resolveMethod(DiagnosticPosition pos, Env<AttrContext> env, Name name, List<Type> argtypes, List<Type> typeargtypes) {
Symbol sym = startResolution();
List<MethodResolutionPhase> steps = methodResolutionSteps;
while (steps.nonEmpty() && steps.head.isApplicable(boxingEnabled, varargsEnabled) && sym.kind >= ERRONEOUS) {
currentStep = steps.head;
sym = findFun(env, name, argtypes, typeargtypes, steps.head.isBoxingRequired, env.info.varArgs = steps.head.isVarargsRequired);
methodResolutionCache.put(steps.head, sym);
steps = steps.tail;
}
if (sym.kind >= AMBIGUOUS) {
//if nothing is found return the 'first' error
MethodResolutionPhase errPhase = firstErroneousResolutionPhase();
sym = access(methodResolutionCache.get(errPhase), pos, env.enclClass.sym.type, name, false, argtypes, typeargtypes);
env.info.varArgs = errPhase.isVarargsRequired;
}
return sym;
}
use of com.sun.tools.javac.code.Symbol in project ceylon-compiler by ceylon.
the class Resolve method firstErroneousResolutionPhase.
private MethodResolutionPhase firstErroneousResolutionPhase() {
MethodResolutionPhase bestSoFar = BASIC;
Symbol sym = methodNotFound;
List<MethodResolutionPhase> steps = methodResolutionSteps;
while (steps.nonEmpty() && steps.head.isApplicable(boxingEnabled, varargsEnabled) && sym.kind >= WRONG_MTHS) {
sym = methodResolutionCache.get(steps.head);
bestSoFar = steps.head;
steps = steps.tail;
}
return bestSoFar;
}
use of com.sun.tools.javac.code.Symbol in project ceylon-compiler by ceylon.
the class Resolve method resolveConstructor.
/** Resolve constructor.
* @param pos The position to use for error reporting.
* @param env The environment current at the constructor invocation.
* @param site The type of class for which a constructor is searched.
* @param argtypes The types of the constructor invocation's value
* arguments.
* @param typeargtypes The types of the constructor invocation's type
* arguments.
* @param allowBoxing Allow boxing and varargs conversions.
* @param useVarargs Box trailing arguments into an array for varargs.
*/
Symbol resolveConstructor(DiagnosticPosition pos, Env<AttrContext> env, Type site, List<Type> argtypes, List<Type> typeargtypes, boolean allowBoxing, boolean useVarargs) {
Symbol sym = findMethod(env, site, names.init, argtypes, typeargtypes, allowBoxing, useVarargs, false);
chk.checkDeprecated(pos, env.info.scope.owner, sym);
return sym;
}
Aggregations