Throw when calling abstract methods; fix abstract return types

This commit is contained in:
ahocevar
2018-10-30 18:45:42 +01:00
parent 2adac0b3e7
commit 1cdd040c96
22 changed files with 273 additions and 85 deletions
+11 -3
View File
@@ -1,6 +1,8 @@
/**
* @module ol/render/ReplayGroup
*/
import {abstract} from '../util.js';
/**
* Base class for replay groups.
*/
@@ -11,20 +13,26 @@ class ReplayGroup {
* @param {import("./ReplayType.js").default} replayType Replay type.
* @return {import("./VectorContext.js").default} Replay.
*/
getReplay(zIndex, replayType) {}
getReplay(zIndex, replayType) {
return abstract();
}
/**
* @abstract
* @return {boolean} Is empty.
*/
isEmpty() {}
isEmpty() {
return abstract();
}
/**
* @abstract
* @param {boolean} group Group with previous replay
* @return {Array<*>} The resulting instruction group
*/
addDeclutter(group) {}
addDeclutter(group) {
return abstract();
}
}
export default ReplayGroup;
+19 -7
View File
@@ -1,7 +1,7 @@
/**
* @module ol/render/webgl/Replay
*/
import {abstract} from '../../util.js';
import {getCenter} from '../../extent.js';
import VectorContext from '../VectorContext.js';
import {
@@ -122,13 +122,17 @@ class WebGLReplay extends VectorContext {
* @param {import("../../webgl/Context.js").default} context WebGL context.
* @return {function()} Delete resources function.
*/
getDeleteResourcesFunction(context) {}
getDeleteResourcesFunction(context) {
return abstract();
}
/**
* @abstract
* @param {import("../../webgl/Context.js").default} context Context.
*/
finish(context) {}
finish(context) {
abstract();
}
/**
* @abstract
@@ -142,7 +146,9 @@ class WebGLReplay extends VectorContext {
import("./polygonreplay/defaultshader/Locations.js").default|
import("./texturereplay/defaultshader/Locations.js").default} Locations.
*/
setUpProgram(gl, context, size, pixelRatio) {}
setUpProgram(gl, context, size, pixelRatio) {
return abstract();
}
/**
* @abstract
@@ -153,7 +159,9 @@ class WebGLReplay extends VectorContext {
import("./polygonreplay/defaultshader/Locations.js").default|
import("./texturereplay/defaultshader/Locations.js").default} locations Locations.
*/
shutDownProgram(gl, locations) {}
shutDownProgram(gl, locations) {
abstract();
}
/**
* @abstract
@@ -163,7 +171,9 @@ class WebGLReplay extends VectorContext {
* @param {Object<string, boolean>} skippedFeaturesHash Ids of features to skip.
* @param {boolean} hitDetection Hit detection mode.
*/
drawReplay(gl, context, skippedFeaturesHash, hitDetection) {}
drawReplay(gl, context, skippedFeaturesHash, hitDetection) {
abstract();
}
/**
* @abstract
@@ -176,7 +186,9 @@ class WebGLReplay extends VectorContext {
* @return {T|undefined} Callback result.
* @template T
*/
drawHitDetectionReplayOneByOne(gl, context, skippedFeaturesHash, featureCallback, opt_hitExtent) {}
drawHitDetectionReplayOneByOne(gl, context, skippedFeaturesHash, featureCallback, opt_hitExtent) {
return abstract();
}
/**
* @protected
+9 -5
View File
@@ -1,7 +1,7 @@
/**
* @module ol/render/webgl/TextureReplay
*/
import {getUid} from '../../util.js';
import {abstract, getUid} from '../../util.js';
import {intersects} from '../../extent.js';
import {isEmpty} from '../../obj.js';
import {fragment, vertex} from '../webgl/texturereplay/defaultshader.js';
@@ -460,16 +460,20 @@ class WebGLTextureReplay extends WebGLReplay {
* @abstract
* @protected
* @param {boolean=} opt_all Return hit detection textures with regular ones.
* @returns {Array<WebGLTexture>} Textures.
* @return {Array<WebGLTexture>} Textures.
*/
getTextures(opt_all) {}
getTextures(opt_all) {
return abstract();
}
/**
* @abstract
* @protected
* @returns {Array<WebGLTexture>} Textures.
* @return {Array<WebGLTexture>} Textures.
*/
getHitDetectionTextures() {}
getHitDetectionTextures() {
return abstract();
}
}