-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provide some help for migrating "curve"
- Loading branch information
1 parent
0e0bc5e
commit 646fca8
Showing
4 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// @flow | ||
|
||
import type { Expression } from '../expression'; | ||
import type ParsingContext from '../parsing_context'; | ||
import type { Type } from '../types'; | ||
|
||
class Curve implements Expression { | ||
key: string; | ||
type: Type; | ||
|
||
static parse(args: Array<mixed>, context: ParsingContext) { | ||
const [ , interpolation, input, ...rest] = args; | ||
if ((interpolation: any)[0] === "step") { | ||
return context.error(`"curve" has been replaced by "step" and "interpolate". Replace this expression with ${ | ||
JSON.stringify(["step", input, ...rest])}`, 0); | ||
} else { | ||
return context.error(`"curve" has been replaced by "step" and "interpolate". Replace this expression with ${ | ||
JSON.stringify(["interpolate", interpolation, input, ...rest])}`, 0); | ||
} | ||
} | ||
|
||
evaluate() {} | ||
eachChild() {} | ||
} | ||
|
||
module.exports = Curve; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
test/integration/expression-tests/curve/interpolate/test.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"expression": ["curve", ["linear"], 0, 1, 2, 3, 4], | ||
"inputs": [[{}, {}]], | ||
"expected": { | ||
"compiled": { | ||
"result": "error", | ||
"errors": [ | ||
{ | ||
"key": "[0]", | ||
"error": "\"curve\" has been replaced by \"step\" and \"interpolate\". Replace this expression with [\"interpolate\",[\"linear\"],0,1,2,3,4]" | ||
} | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"expression": ["curve", ["step"], 0, 1, 2, 3, 4, 5], | ||
"inputs": [[{}, {}]], | ||
"expected": { | ||
"compiled": { | ||
"result": "error", | ||
"errors": [ | ||
{ | ||
"key": "[0]", | ||
"error": "\"curve\" has been replaced by \"step\" and \"interpolate\". Replace this expression with [\"step\",0,1,2,3,4,5]" | ||
} | ||
] | ||
} | ||
} | ||
} |