From 6b734ccbdedf2afbb7e583da7572c7a07516c5b9 Mon Sep 17 00:00:00 2001 From: Anand Thakker Date: Wed, 21 Feb 2018 14:44:53 -0500 Subject: [PATCH] Apply fixed codegen --- src/data/array_types.js | 113 +++++++----------- .../background_style_layer_properties.js | 15 +-- .../circle_style_layer_properties.js | 15 +-- .../fill_extrusion_style_layer_properties.js | 15 +-- .../fill_style_layer_properties.js | 15 +-- .../heatmap_style_layer_properties.js | 15 +-- .../hillshade_style_layer_properties.js | 15 +-- .../line_style_layer_properties.js | 16 +-- .../raster_style_layer_properties.js | 15 +-- .../symbol_style_layer_properties.js | 16 +-- 10 files changed, 115 insertions(+), 135 deletions(-) diff --git a/src/data/array_types.js b/src/data/array_types.js index b5f026d5a69..c815c786e04 100644 --- a/src/data/array_types.js +++ b/src/data/array_types.js @@ -2,10 +2,9 @@ // @flow import assert from 'assert'; - -import { StructArray } from '../util/struct_array'; -import { Struct } from '../util/struct_array'; -import { register } from '../util/web_worker_transfer'; +import {StructArray} from '../util/struct_array'; +import {Struct} from '../util/struct_array'; +import {register} from '../util/web_worker_transfer'; import Point from '@mapbox/point-geometry'; @@ -15,7 +14,7 @@ import Point from '@mapbox/point-geometry'; * * @private */ -class StructArrayLayout2i4 extends StructArray { +export class StructArrayLayout2i4 extends StructArray { uint8: Uint8Array; int16: Int16Array; @@ -45,7 +44,7 @@ register('StructArrayLayout2i4', StructArrayLayout2i4); * * @private */ -class StructArrayLayout4i8 extends StructArray { +export class StructArrayLayout4i8 extends StructArray { uint8: Uint8Array; int16: Int16Array; @@ -78,7 +77,7 @@ register('StructArrayLayout4i8', StructArrayLayout4i8); * * @private */ -class StructArrayLayout2i4i12 extends StructArray { +export class StructArrayLayout2i4i12 extends StructArray { uint8: Uint8Array; int16: Int16Array; @@ -113,7 +112,7 @@ register('StructArrayLayout2i4i12', StructArrayLayout2i4i12); * * @private */ -class StructArrayLayout4i4ub12 extends StructArray { +export class StructArrayLayout4i4ub12 extends StructArray { uint8: Uint8Array; int16: Int16Array; @@ -151,7 +150,7 @@ register('StructArrayLayout4i4ub12', StructArrayLayout4i4ub12); * * @private */ -class StructArrayLayout4i4ui16 extends StructArray { +export class StructArrayLayout4i4ui16 extends StructArray { uint8: Uint8Array; int16: Int16Array; uint16: Uint16Array; @@ -189,7 +188,7 @@ register('StructArrayLayout4i4ui16', StructArrayLayout4i4ui16); * * @private */ -class StructArrayLayout3f12 extends StructArray { +export class StructArrayLayout3f12 extends StructArray { uint8: Uint8Array; float32: Float32Array; @@ -220,7 +219,7 @@ register('StructArrayLayout3f12', StructArrayLayout3f12); * * @private */ -class StructArrayLayout1ul4 extends StructArray { +export class StructArrayLayout1ul4 extends StructArray { uint8: Uint8Array; uint32: Uint32Array; @@ -252,7 +251,7 @@ register('StructArrayLayout1ul4', StructArrayLayout1ul4); * * @private */ -class StructArrayLayout6i1ul2ui2i24 extends StructArray { +export class StructArrayLayout6i1ul2ui2i24 extends StructArray { uint8: Uint8Array; int16: Int16Array; uint32: Uint32Array; @@ -298,7 +297,7 @@ register('StructArrayLayout6i1ul2ui2i24', StructArrayLayout6i1ul2ui2i24); * * @private */ -class StructArrayLayout2i2i2i12 extends StructArray { +export class StructArrayLayout2i2i2i12 extends StructArray { uint8: Uint8Array; int16: Int16Array; @@ -332,7 +331,7 @@ register('StructArrayLayout2i2i2i12', StructArrayLayout2i2i2i12); * * @private */ -class StructArrayLayout2ub4 extends StructArray { +export class StructArrayLayout2ub4 extends StructArray { uint8: Uint8Array; _refreshViews() { @@ -365,7 +364,7 @@ register('StructArrayLayout2ub4', StructArrayLayout2ub4); * * @private */ -class StructArrayLayout2i2ui3ul3ui2f2ub40 extends StructArray { +export class StructArrayLayout2i2ui3ul3ui2f2ub40 extends StructArray { uint8: Uint8Array; int16: Int16Array; uint16: Uint16Array; @@ -415,7 +414,7 @@ register('StructArrayLayout2i2ui3ul3ui2f2ub40', StructArrayLayout2i2ui3ul3ui2f2u * * @private */ -class StructArrayLayout1f4 extends StructArray { +export class StructArrayLayout1f4 extends StructArray { uint8: Uint8Array; float32: Float32Array; @@ -444,7 +443,7 @@ register('StructArrayLayout1f4', StructArrayLayout1f4); * * @private */ -class StructArrayLayout3i6 extends StructArray { +export class StructArrayLayout3i6 extends StructArray { uint8: Uint8Array; int16: Int16Array; @@ -476,7 +475,7 @@ register('StructArrayLayout3i6', StructArrayLayout3i6); * * @private */ -class StructArrayLayout1ul2ui8 extends StructArray { +export class StructArrayLayout1ul2ui8 extends StructArray { uint8: Uint8Array; uint32: Uint32Array; uint16: Uint16Array; @@ -510,7 +509,7 @@ register('StructArrayLayout1ul2ui8', StructArrayLayout1ul2ui8); * * @private */ -class StructArrayLayout3ui6 extends StructArray { +export class StructArrayLayout3ui6 extends StructArray { uint8: Uint8Array; uint16: Uint16Array; @@ -541,7 +540,7 @@ register('StructArrayLayout3ui6', StructArrayLayout3ui6); * * @private */ -class StructArrayLayout2ui4 extends StructArray { +export class StructArrayLayout2ui4 extends StructArray { uint8: Uint8Array; uint16: Uint16Array; @@ -571,7 +570,7 @@ register('StructArrayLayout2ui4', StructArrayLayout2ui4); * * @private */ -class StructArrayLayout2f8 extends StructArray { +export class StructArrayLayout2f8 extends StructArray { uint8: Uint8Array; float32: Float32Array; @@ -601,7 +600,7 @@ register('StructArrayLayout2f8', StructArrayLayout2f8); * * @private */ -class StructArrayLayout4f16 extends StructArray { +export class StructArrayLayout4f16 extends StructArray { uint8: Uint8Array; float32: Float32Array; @@ -674,7 +673,7 @@ export type CollisionBox = CollisionBoxStruct; /** * @private */ -class CollisionBoxArray extends StructArrayLayout6i1ul2ui2i24 { +export class CollisionBoxArray extends StructArrayLayout6i1ul2ui2i24 { /** * Return the CollisionBoxStruct at the given location in the array. * @param {number} index The index of the element. @@ -741,7 +740,7 @@ export type PlacedSymbol = PlacedSymbolStruct; /** * @private */ -class PlacedSymbolArray extends StructArrayLayout2i2ui3ul3ui2f2ub40 { +export class PlacedSymbolArray extends StructArrayLayout2i2ui3ul3ui2f2ub40 { /** * Return the PlacedSymbolStruct at the given location in the array. * @param {number} index The index of the element. @@ -769,7 +768,7 @@ export type GlyphOffset = GlyphOffsetStruct; /** * @private */ -class GlyphOffsetArray extends StructArrayLayout1f4 { +export class GlyphOffsetArray extends StructArrayLayout1f4 { getoffsetX(index: number) { return this.float32[index * 1 + 0]; } /** * Return the GlyphOffsetStruct at the given location in the array. @@ -804,7 +803,7 @@ export type SymbolLineVertex = SymbolLineVertexStruct; /** * @private */ -class SymbolLineVertexArray extends StructArrayLayout3i6 { +export class SymbolLineVertexArray extends StructArrayLayout3i6 { getx(index: number) { return this.int16[index * 3 + 0]; } gety(index: number) { return this.int16[index * 3 + 1]; } gettileUnitDistanceFromAnchor(index: number) { return this.int16[index * 3 + 2]; } @@ -841,7 +840,7 @@ export type FeatureIndex = FeatureIndexStruct; /** * @private */ -class FeatureIndexArray extends StructArrayLayout1ul2ui8 { +export class FeatureIndexArray extends StructArrayLayout1ul2ui8 { /** * Return the FeatureIndexStruct at the given location in the array. * @param {number} index The index of the element. @@ -855,46 +854,20 @@ class FeatureIndexArray extends StructArrayLayout1ul2ui8 { register('FeatureIndexArray', FeatureIndexArray); -const exported = { - StructArrayLayout2i4, - StructArrayLayout4i8, - StructArrayLayout2i4i12, - StructArrayLayout4i4ub12, - StructArrayLayout4i4ui16, - StructArrayLayout3f12, - StructArrayLayout1ul4, - StructArrayLayout6i1ul2ui2i24, - StructArrayLayout2i2i2i12, - StructArrayLayout2ub4, - StructArrayLayout2i2ui3ul3ui2f2ub40, - StructArrayLayout1f4, - StructArrayLayout3i6, - StructArrayLayout1ul2ui8, - StructArrayLayout3ui6, - StructArrayLayout2ui4, - StructArrayLayout2f8, - StructArrayLayout4f16, - PosArray: StructArrayLayout2i4, - RasterBoundsArray: StructArrayLayout4i8, - CircleLayoutArray: StructArrayLayout2i4, - FillLayoutArray: StructArrayLayout2i4, - FillExtrusionLayoutArray: StructArrayLayout2i4i12, - HeatmapLayoutArray: StructArrayLayout2i4, - LineLayoutArray: StructArrayLayout4i4ub12, - SymbolLayoutArray: StructArrayLayout4i4ui16, - SymbolDynamicLayoutArray: StructArrayLayout3f12, - SymbolOpacityArray: StructArrayLayout1ul4, - CollisionBoxLayoutArray: StructArrayLayout2i2i2i12, - CollisionCircleLayoutArray: StructArrayLayout2i2i2i12, - CollisionVertexArray: StructArrayLayout2ub4, - TriangleIndexArray: StructArrayLayout3ui6, - LineIndexArray: StructArrayLayout2ui4, - CollisionBoxArray, - PlacedSymbolArray, - GlyphOffsetArray, - SymbolLineVertexArray, - FeatureIndexArray -}; - -export default exported; -export { StructArrayLayout2i4, StructArrayLayout4i8, StructArrayLayout2i4i12, StructArrayLayout4i4ub12, StructArrayLayout4i4ui16, StructArrayLayout3f12, StructArrayLayout1ul4, StructArrayLayout6i1ul2ui2i24, StructArrayLayout2i2i2i12, StructArrayLayout2ub4, StructArrayLayout2i2ui3ul3ui2f2ub40, StructArrayLayout1f4, StructArrayLayout3i6, StructArrayLayout1ul2ui8, StructArrayLayout3ui6, StructArrayLayout2ui4, StructArrayLayout2f8, StructArrayLayout4f16, StructArrayLayout2i4 as PosArray, StructArrayLayout4i8 as RasterBoundsArray, StructArrayLayout2i4 as CircleLayoutArray, StructArrayLayout2i4 as FillLayoutArray, StructArrayLayout2i4i12 as FillExtrusionLayoutArray, StructArrayLayout2i4 as HeatmapLayoutArray, StructArrayLayout4i4ub12 as LineLayoutArray, StructArrayLayout4i4ui16 as SymbolLayoutArray, StructArrayLayout3f12 as SymbolDynamicLayoutArray, StructArrayLayout1ul4 as SymbolOpacityArray, StructArrayLayout2i2i2i12 as CollisionBoxLayoutArray, StructArrayLayout2i2i2i12 as CollisionCircleLayoutArray, StructArrayLayout2ub4 as CollisionVertexArray, StructArrayLayout3ui6 as TriangleIndexArray, StructArrayLayout2ui4 as LineIndexArray, CollisionBoxArray, PlacedSymbolArray, GlyphOffsetArray, SymbolLineVertexArray, FeatureIndexArray }; +export { + StructArrayLayout2i4 as PosArray, + StructArrayLayout4i8 as RasterBoundsArray, + StructArrayLayout2i4 as CircleLayoutArray, + StructArrayLayout2i4 as FillLayoutArray, + StructArrayLayout2i4i12 as FillExtrusionLayoutArray, + StructArrayLayout2i4 as HeatmapLayoutArray, + StructArrayLayout4i4ub12 as LineLayoutArray, + StructArrayLayout4i4ui16 as SymbolLayoutArray, + StructArrayLayout3f12 as SymbolDynamicLayoutArray, + StructArrayLayout1ul4 as SymbolOpacityArray, + StructArrayLayout2i2i2i12 as CollisionBoxLayoutArray, + StructArrayLayout2i2i2i12 as CollisionCircleLayoutArray, + StructArrayLayout2ub4 as CollisionVertexArray, + StructArrayLayout3ui6 as TriangleIndexArray, + StructArrayLayout2ui4 as LineIndexArray +}; \ No newline at end of file diff --git a/src/style/style_layer/background_style_layer_properties.js b/src/style/style_layer/background_style_layer_properties.js index cb4df3fb768..229ec679f32 100644 --- a/src/style/style_layer/background_style_layer_properties.js +++ b/src/style/style_layer/background_style_layer_properties.js @@ -4,7 +4,13 @@ import styleSpec from '../../style-spec/reference/latest'; -import { Properties, DataConstantProperty, DataDrivenProperty, CrossFadedProperty, HeatmapColorProperty } from '../properties'; +import { + Properties, + DataConstantProperty, + DataDrivenProperty, + CrossFadedProperty, + HeatmapColorProperty +} from '../properties'; import type Color from '../../style-spec/util/color'; @@ -21,9 +27,4 @@ const paint: Properties = new Properties({ "background-opacity": new DataConstantProperty(styleSpec["paint_background"]["background-opacity"]), }); -const exported = { - paint -}; - -export default exported; -export { paint }; +export default { paint }; diff --git a/src/style/style_layer/circle_style_layer_properties.js b/src/style/style_layer/circle_style_layer_properties.js index ab6244cda24..37a7d88e251 100644 --- a/src/style/style_layer/circle_style_layer_properties.js +++ b/src/style/style_layer/circle_style_layer_properties.js @@ -4,7 +4,13 @@ import styleSpec from '../../style-spec/reference/latest'; -import { Properties, DataConstantProperty, DataDrivenProperty, CrossFadedProperty, HeatmapColorProperty } from '../properties'; +import { + Properties, + DataConstantProperty, + DataDrivenProperty, + CrossFadedProperty, + HeatmapColorProperty +} from '../properties'; import type Color from '../../style-spec/util/color'; @@ -37,9 +43,4 @@ const paint: Properties = new Properties({ "circle-stroke-opacity": new DataDrivenProperty(styleSpec["paint_circle"]["circle-stroke-opacity"]), }); -const exported = { - paint -}; - -export default exported; -export { paint }; +export default { paint }; diff --git a/src/style/style_layer/fill_extrusion_style_layer_properties.js b/src/style/style_layer/fill_extrusion_style_layer_properties.js index 7995208a57a..012be6474e2 100644 --- a/src/style/style_layer/fill_extrusion_style_layer_properties.js +++ b/src/style/style_layer/fill_extrusion_style_layer_properties.js @@ -4,7 +4,13 @@ import styleSpec from '../../style-spec/reference/latest'; -import { Properties, DataConstantProperty, DataDrivenProperty, CrossFadedProperty, HeatmapColorProperty } from '../properties'; +import { + Properties, + DataConstantProperty, + DataDrivenProperty, + CrossFadedProperty, + HeatmapColorProperty +} from '../properties'; import type Color from '../../style-spec/util/color'; @@ -29,9 +35,4 @@ const paint: Properties = new Properties({ "fill-extrusion-base": new DataDrivenProperty(styleSpec["paint_fill-extrusion"]["fill-extrusion-base"]), }); -const exported = { - paint -}; - -export default exported; -export { paint }; +export default { paint }; diff --git a/src/style/style_layer/fill_style_layer_properties.js b/src/style/style_layer/fill_style_layer_properties.js index 03872baa9f9..51a471be24d 100644 --- a/src/style/style_layer/fill_style_layer_properties.js +++ b/src/style/style_layer/fill_style_layer_properties.js @@ -4,7 +4,13 @@ import styleSpec from '../../style-spec/reference/latest'; -import { Properties, DataConstantProperty, DataDrivenProperty, CrossFadedProperty, HeatmapColorProperty } from '../properties'; +import { + Properties, + DataConstantProperty, + DataDrivenProperty, + CrossFadedProperty, + HeatmapColorProperty +} from '../properties'; import type Color from '../../style-spec/util/color'; @@ -29,9 +35,4 @@ const paint: Properties = new Properties({ "fill-pattern": new CrossFadedProperty(styleSpec["paint_fill"]["fill-pattern"]), }); -const exported = { - paint -}; - -export default exported; -export { paint }; +export default { paint }; diff --git a/src/style/style_layer/heatmap_style_layer_properties.js b/src/style/style_layer/heatmap_style_layer_properties.js index 55ddd0bbd63..dccace28905 100644 --- a/src/style/style_layer/heatmap_style_layer_properties.js +++ b/src/style/style_layer/heatmap_style_layer_properties.js @@ -4,7 +4,13 @@ import styleSpec from '../../style-spec/reference/latest'; -import { Properties, DataConstantProperty, DataDrivenProperty, CrossFadedProperty, HeatmapColorProperty } from '../properties'; +import { + Properties, + DataConstantProperty, + DataDrivenProperty, + CrossFadedProperty, + HeatmapColorProperty +} from '../properties'; import type Color from '../../style-spec/util/color'; @@ -25,9 +31,4 @@ const paint: Properties = new Properties({ "heatmap-opacity": new DataConstantProperty(styleSpec["paint_heatmap"]["heatmap-opacity"]), }); -const exported = { - paint -}; - -export default exported; -export { paint }; +export default { paint }; diff --git a/src/style/style_layer/hillshade_style_layer_properties.js b/src/style/style_layer/hillshade_style_layer_properties.js index d0900757c16..98d1a603a31 100644 --- a/src/style/style_layer/hillshade_style_layer_properties.js +++ b/src/style/style_layer/hillshade_style_layer_properties.js @@ -4,7 +4,13 @@ import styleSpec from '../../style-spec/reference/latest'; -import { Properties, DataConstantProperty, DataDrivenProperty, CrossFadedProperty, HeatmapColorProperty } from '../properties'; +import { + Properties, + DataConstantProperty, + DataDrivenProperty, + CrossFadedProperty, + HeatmapColorProperty +} from '../properties'; import type Color from '../../style-spec/util/color'; @@ -27,9 +33,4 @@ const paint: Properties = new Properties({ "hillshade-accent-color": new DataConstantProperty(styleSpec["paint_hillshade"]["hillshade-accent-color"]), }); -const exported = { - paint -}; - -export default exported; -export { paint }; +export default { paint }; diff --git a/src/style/style_layer/line_style_layer_properties.js b/src/style/style_layer/line_style_layer_properties.js index cad1f7193f2..cd6400c7e4a 100644 --- a/src/style/style_layer/line_style_layer_properties.js +++ b/src/style/style_layer/line_style_layer_properties.js @@ -4,7 +4,13 @@ import styleSpec from '../../style-spec/reference/latest'; -import { Properties, DataConstantProperty, DataDrivenProperty, CrossFadedProperty, HeatmapColorProperty } from '../properties'; +import { + Properties, + DataConstantProperty, + DataDrivenProperty, + CrossFadedProperty, + HeatmapColorProperty +} from '../properties'; import type Color from '../../style-spec/util/color'; @@ -48,10 +54,4 @@ const paint: Properties = new Properties({ "line-pattern": new CrossFadedProperty(styleSpec["paint_line"]["line-pattern"]), }); -const exported = { - paint, - layout -}; - -export default exported; -export { paint, layout }; +export default { paint, layout }; diff --git a/src/style/style_layer/raster_style_layer_properties.js b/src/style/style_layer/raster_style_layer_properties.js index 1916fcc999c..f538bc0a1da 100644 --- a/src/style/style_layer/raster_style_layer_properties.js +++ b/src/style/style_layer/raster_style_layer_properties.js @@ -4,7 +4,13 @@ import styleSpec from '../../style-spec/reference/latest'; -import { Properties, DataConstantProperty, DataDrivenProperty, CrossFadedProperty, HeatmapColorProperty } from '../properties'; +import { + Properties, + DataConstantProperty, + DataDrivenProperty, + CrossFadedProperty, + HeatmapColorProperty +} from '../properties'; import type Color from '../../style-spec/util/color'; @@ -29,9 +35,4 @@ const paint: Properties = new Properties({ "raster-fade-duration": new DataConstantProperty(styleSpec["paint_raster"]["raster-fade-duration"]), }); -const exported = { - paint -}; - -export default exported; -export { paint }; +export default { paint }; diff --git a/src/style/style_layer/symbol_style_layer_properties.js b/src/style/style_layer/symbol_style_layer_properties.js index d6163c5b1ac..586c43507bc 100644 --- a/src/style/style_layer/symbol_style_layer_properties.js +++ b/src/style/style_layer/symbol_style_layer_properties.js @@ -4,7 +4,13 @@ import styleSpec from '../../style-spec/reference/latest'; -import { Properties, DataConstantProperty, DataDrivenProperty, CrossFadedProperty, HeatmapColorProperty } from '../properties'; +import { + Properties, + DataConstantProperty, + DataDrivenProperty, + CrossFadedProperty, + HeatmapColorProperty +} from '../properties'; import type Color from '../../style-spec/util/color'; @@ -120,10 +126,4 @@ const paint: Properties = new Properties({ "text-translate-anchor": new DataConstantProperty(styleSpec["paint_symbol"]["text-translate-anchor"]), }); -const exported = { - paint, - layout -}; - -export default exported; -export { paint, layout }; +export default { paint, layout };