mirror of
https://github.com/adelphes/android-dev-ext.git
synced 2025-12-22 17:39:19 +00:00
ignore unresolved types in extends/implements
This commit is contained in:
@@ -1,15 +1,19 @@
|
||||
const { SourceType, SourceTypeIdent } = require('../source-type');
|
||||
const { SourceType } = require('../source-type');
|
||||
const ParseProblem = require('../parsetypes/parse-problem');
|
||||
const { AnyType } = require('../body-types');
|
||||
|
||||
/**
|
||||
* @param {SourceType} source_type
|
||||
* @param {*} probs
|
||||
*/
|
||||
function checkExtends(source_type, probs) {
|
||||
if (source_type.extends_types.length === 0) {
|
||||
const supertypes = source_type.extends_types
|
||||
.map(st => st.resolved)
|
||||
.filter(t => !(t instanceof AnyType));
|
||||
|
||||
if (supertypes.length === 0) {
|
||||
return;
|
||||
}
|
||||
const supertypes = source_type.extends_types.map(st => st.resolved);
|
||||
const supertype = supertypes[0];
|
||||
if (source_type.typeKind === 'enum') {
|
||||
probs.push(ParseProblem.Error(source_type.extends_types[0].tokens, `Enum types cannot declare a superclass`));
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
const ParseProblem = require('../parsetypes/parse-problem');
|
||||
const {SourceType} = require('../source-type');
|
||||
const { AnyType } = require('../body-types');
|
||||
const { UnresolvedType } = require('java-mti');
|
||||
|
||||
/**
|
||||
@@ -7,15 +8,18 @@ const { UnresolvedType } = require('java-mti');
|
||||
* @param {*} probs
|
||||
*/
|
||||
function checkImplements(source_type, probs) {
|
||||
if (source_type.implements_types.length === 0) {
|
||||
const superinterfaces = source_type.implements_types
|
||||
.map(st => st.resolved)
|
||||
.filter(t => !(t instanceof AnyType));
|
||||
|
||||
if (superinterfaces.length === 0) {
|
||||
return;
|
||||
}
|
||||
const interfaces = source_type.implements_types.map(it => it.resolved);
|
||||
if (source_type.typeKind === 'interface') {
|
||||
probs.push(ParseProblem.Error(source_type.implements_types[0].tokens, `Interface types cannot declare an implements section`));
|
||||
}
|
||||
if (source_type.typeKind === 'class') {
|
||||
interfaces.forEach((intf, i) => {
|
||||
superinterfaces.forEach((intf, i) => {
|
||||
if (intf instanceof UnresolvedType) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user