Skip to content

Commit

Permalink
Clean up implementation of coalesce for image operator (#8950)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Hamley authored and mourner committed Nov 6, 2019
1 parent cd39e14 commit 0013aad
Showing 1 changed file with 5 additions and 2 deletions.
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

0 comments on commit 0013aad

Please sign in to comment.