From d9696a0e6de0d3fb6746cf041bdc77f81318c7d8 Mon Sep 17 00:00:00 2001 From: Ryan Hamley Date: Fri, 10 Apr 2020 16:23:51 -0700 Subject: [PATCH] Refactor format_section_override out of style-spec (#9543) --- .../format_section_override.js | 18 ++++++++++-------- src/style/style_layer/symbol_style_layer.js | 2 +- .../format_section_override.test.js | 2 +- test/unit/symbol/symbol_style_layer.test.js | 2 +- 4 files changed, 13 insertions(+), 11 deletions(-) rename src/{style-spec/expression/definitions => style}/format_section_override.js (71%) rename test/unit/{symbol => style}/format_section_override.test.js (95%) diff --git a/src/style-spec/expression/definitions/format_section_override.js b/src/style/format_section_override.js similarity index 71% rename from src/style-spec/expression/definitions/format_section_override.js rename to src/style/format_section_override.js index 86952258263..fd69be19ee1 100644 --- a/src/style-spec/expression/definitions/format_section_override.js +++ b/src/style/format_section_override.js @@ -1,14 +1,16 @@ // @flow import assert from 'assert'; -import type {Expression} from '../expression'; -import type EvaluationContext from '../evaluation_context'; -import type {Type} from '../types'; -import type {ZoomConstantExpression} from '../../expression'; -import {NullType} from '../types'; -import {PossiblyEvaluatedPropertyValue} from '../../../style/properties'; -import {register} from '../../../util/web_worker_transfer'; - +import type {Expression} from '../style-spec/expression/expression'; +import type EvaluationContext from '../style-spec/expression/evaluation_context'; +import type {Type} from '../style-spec/expression/types'; +import type {ZoomConstantExpression} from '../style-spec/expression'; +import {NullType} from '../style-spec/expression/types'; +import {PossiblyEvaluatedPropertyValue} from './properties'; +import {register} from '../util/web_worker_transfer'; + +// This is an internal expression class. It is only used in GL JS and +// has GL JS dependencies which can break the standalone style-spec module export default class FormatSectionOverride implements Expression { type: Type; defaultValue: PossiblyEvaluatedPropertyValue; diff --git a/src/style/style_layer/symbol_style_layer.js b/src/style/style_layer/symbol_style_layer.js index 249f0f4b878..37254264509 100644 --- a/src/style/style_layer/symbol_style_layer.js +++ b/src/style/style_layer/symbol_style_layer.js @@ -33,7 +33,7 @@ import type {CanonicalTileID} from '../../source/tile_id'; import {FormattedType} from '../../style-spec/expression/types'; import {typeOf} from '../../style-spec/expression/values'; import Formatted from '../../style-spec/expression/types/formatted'; -import FormatSectionOverride from '../../style-spec/expression/definitions/format_section_override'; +import FormatSectionOverride from '../format_section_override'; import FormatExpression from '../../style-spec/expression/definitions/format'; import Literal from '../../style-spec/expression/definitions/literal'; diff --git a/test/unit/symbol/format_section_override.test.js b/test/unit/style/format_section_override.test.js similarity index 95% rename from test/unit/symbol/format_section_override.test.js rename to test/unit/style/format_section_override.test.js index 3364ba2fb06..292f9374893 100644 --- a/test/unit/symbol/format_section_override.test.js +++ b/test/unit/style/format_section_override.test.js @@ -3,7 +3,7 @@ import {createExpression, ZoomConstantExpression} from '../../../src/style-spec/ import EvaluationContext from '../../../src/style-spec/expression/evaluation_context'; import properties from '../../../src/style/style_layer/symbol_style_layer_properties'; import {PossiblyEvaluatedPropertyValue} from '../../../src/style/properties'; -import FormatSectionOverride from '../../../src/style-spec/expression/definitions/format_section_override'; +import FormatSectionOverride from '../../../src/style/format_section_override'; test('evaluate', (t) => { diff --git a/test/unit/symbol/symbol_style_layer.test.js b/test/unit/symbol/symbol_style_layer.test.js index 34ca2755960..982d912c996 100644 --- a/test/unit/symbol/symbol_style_layer.test.js +++ b/test/unit/symbol/symbol_style_layer.test.js @@ -1,6 +1,6 @@ import {test} from '../../util/test'; import SymbolStyleLayer from '../../../src/style/style_layer/symbol_style_layer'; -import FormatSectionOverride from '../../../src/style-spec/expression/definitions/format_section_override'; +import FormatSectionOverride from '../../../src/style/format_section_override'; import properties from '../../../src/style/style_layer/symbol_style_layer_properties'; function createSymbolLayer(layerProperties) {