Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up implementation of coalesce for image operator #8950

Merged
merged 1 commit into from
Nov 6, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/style-spec/expression/definitions/coalesce.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import assert from 'assert';

import {checkSubtype, ValueType} from '../types';
import ResolvedImage from '../types/resolved_image';

import type {Expression} from '../expression';
import type ParsingContext from '../parsing_context';
Expand Down Expand Up @@ -60,8 +61,10 @@ class Coalesce implements Expression {
result = arg.evaluate(ctx);
// we need to keep track of the first requested image in a coalesce statement
// if coalesce can't find a valid image, we return the first image name so styleimagemissing can fire
if (arg.type.kind === 'resolvedImage' && !result.available) {
if (!requestedImageName) requestedImageName = arg.evaluate(ctx).name;
if (result && result instanceof ResolvedImage && !result.available) {
if (!requestedImageName) {
requestedImageName = result.name;
}
result = null;
if (argCount === this.args.length) {
result = requestedImageName;
Expand Down