use of dyvilx.tools.compiler.ast.classes.IClass in project Dyvil by Dyvil.
the class MethodWriterImpl method visitEnd.
@Override
public void visitEnd(IType type) {
IClass iclass = type.getTheClass();
if (iclass != null) {
iclass.writeInnerClassInfo(this.cw);
}
if (!this.hasReturn) {
int opcode = type.getReturnOpcode();
if (opcode == RETURN || this.frame.actualStackCount > 0) {
this.insnCallback();
this.mv.visitInsn(opcode);
}
}
this.mv.visitMaxs(this.frame.maxStack, this.frame.maxLocals);
this.mv.visitEnd();
}
use of dyvilx.tools.compiler.ast.classes.IClass in project Dyvil by Dyvil.
the class NamedType method resolveWithParent.
private IType resolveWithParent(MarkerList markers) {
final IClass theClass = this.parent.resolveClass(this.name);
if (theClass != null) {
return new ResolvedClassType(theClass, this.position);
}
final Package thePackage = this.parent.resolvePackage(this.name);
if (thePackage != null) {
return new PackageType(thePackage).atPosition(this.position);
}
if (markers == null) {
// FieldAccess support
return null;
}
markers.add(Markers.semanticError(this.position, "resolve.type.package", this.name, this.parent));
return this;
}
use of dyvilx.tools.compiler.ast.classes.IClass in project Dyvil by Dyvil.
the class ResolvedClassType method checkType.
@Override
public void checkType(MarkerList markers, IContext context, int position) {
final IClass iclass = this.theClass;
if (iclass != null) {
ModifierUtil.checkVisibility(iclass, this.position, markers, context);
}
super.checkType(markers, context, position);
}
use of dyvilx.tools.compiler.ast.classes.IClass in project Dyvil by Dyvil.
the class ClassAccess method check.
@Override
public void check(MarkerList markers, IContext context) {
this.type.check(markers, context);
if (!this.withTyped) {
// Don't need an additional error
return;
}
if (!this.type.isResolved()) {
// Already reported this in CHECK_TYPES
return;
}
final IClass iclass = this.type.getTheClass();
if (iclass != null && iclass.hasModifier(Modifiers.OBJECT_CLASS)) {
// Object type, we can safely use it's instance field.
return;
}
markers.add(Markers.semantic(this.position, "type.access.invalid", this.type.toString()));
}
use of dyvilx.tools.compiler.ast.classes.IClass in project Dyvil by Dyvil.
the class ConstructorCall method resolveCall.
@Override
public IValue resolveCall(MarkerList markers, IContext context, boolean report) {
if (!this.type.isResolved()) {
return this;
}
final ArrayType arrayType = this.type.extract(ArrayType.class);
if (arrayType != null) {
this.resolveArrayConstructor(markers, context, arrayType);
return this;
}
final IClass theClass = this.type.getTheClass();
if (theClass != null && theClass.isInterface()) {
if (!report) {
return null;
}
markers.add(Markers.semanticError(this.position, "constructor.access.interface", this.type));
return this;
}
final MatchList<IConstructor> candidates = this.resolveCandidates(context, this.type);
if (candidates.hasCandidate()) {
this.checkArguments(markers, context, candidates.getBestMember());
return this;
}
if (report) {
reportResolve(markers, candidates, this.position, this.type, this.arguments);
return this;
}
return null;
}
Aggregations