Skip to content

Commit

Permalink
fix(xod-project): when flattening, check that patch is leaf by presen…
Browse files Browse the repository at this point in the history
…ce of niix marker instead of attachment

This will prevent issues caused by "stranded" `patch.cpp` files.
  • Loading branch information
evgenykochetkov committed Dec 29, 2018
1 parent 721701c commit 846064a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/xod-project/src/flatten.js
Expand Up @@ -85,7 +85,7 @@ const terminalOriginalDirectionLens = R.lensProp('originalDirection');
const isLeafPatchWithImplsOrTerminal = def(
'isLeafPatchWithImplsOrTerminal :: Patch -> Boolean',
R.anyPass([
Patch.hasImpl,
Patch.isPatchNotImplementedInXod,
Patch.isTerminalPatch,
R.pipe(Patch.getPatchPath, R.equals(CONST.NOT_IMPLEMENTED_IN_XOD_PATH)),
])
Expand Down Expand Up @@ -136,16 +136,16 @@ export const extractLeafPatches = def(
'extractLeafPatches :: Project -> PatchPath -> Patch -> [Either Error (Pair PatchPath Patch)]',
(project, path, patch) =>
R.cond([
[
R.either(isLeafPatchWithImplsOrTerminal, Patch.isAbstractPatch),
R.compose(R.of, Either.of, leafPatch => [path, leafPatch]),
],
[
isLeafPatchWithoutImpls,
R.compose(R.of, () =>
fail('IMPLEMENTATION_NOT_FOUND', { patchPath: path, trace: [path] })
),
],
[
R.either(isLeafPatchWithImplsOrTerminal, Patch.isAbstractPatch),
R.compose(R.of, Either.of, leafPatch => [path, leafPatch]),
],
[
R.T,
R.compose(
Expand Down Expand Up @@ -795,7 +795,7 @@ export const extractPatches = R.curry(
const convertPatch = def(
'convertPatch :: Project -> [Pair PatchPath Patch] -> Patch -> Patch',
(project, leafPatches, patch) =>
R.unless(Patch.hasImpl, originalPatch => {
R.unless(Patch.isPatchNotImplementedInXod, originalPatch => {
const leafPatchPaths = R.pluck(0, leafPatches);
const flattenEntities = extractPatches(
project,
Expand Down

0 comments on commit 846064a

Please sign in to comment.