From ac098255be507f471a0e45146c7ccec0fc6c5d15 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Tue, 10 Feb 2015 18:34:16 +1100 Subject: [PATCH] fix allowPartial in t.buildMatchMemberExpression --- lib/6to5/types/index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/6to5/types/index.js b/lib/6to5/types/index.js index a2b4445c00..012bb267e6 100644 --- a/lib/6to5/types/index.js +++ b/lib/6to5/types/index.js @@ -423,6 +423,10 @@ t.buildMatchMemberExpression = function (match, allowPartial) { while (search.length) { var node = search.shift(); + if (allowPartial && i === parts.length) { + return true; + } + if (t.isIdentifier(node)) { // this part doesn't match if (parts[i] !== node.name) return false; @@ -444,8 +448,8 @@ t.buildMatchMemberExpression = function (match, allowPartial) { } // too many parts - if (++i >= parts.length) { - return !!allowPartial; + if (++i > parts.length) { + return false; } }