From 8048163714dc04778dccf838975d147a4346fd2c Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 17 Dec 2014 12:36:53 -0800 Subject: [PATCH] CR feedback. --- src/compiler/utilities.ts | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 62487680759..5925b9b8dac 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -62,22 +62,18 @@ module ts { return node.end - node.pos; } - function hasFlag(val: number, flag: number): boolean { - return (val & flag) !== 0; - } - // Returns true if this node contains a parse error anywhere underneath it. export function containsParseError(node: Node): boolean { aggregateChildData(node); - return hasFlag(node.parserContextFlags, ParserContextFlags.ThisNodeOrAnySubNodesHasError); + return (node.parserContextFlags & ParserContextFlags.ThisNodeOrAnySubNodesHasError) !== 0 } function aggregateChildData(node: Node): void { - if (!hasFlag(node.parserContextFlags, ParserContextFlags.HasAggregatedChildData)) { + if (!(node.parserContextFlags & ParserContextFlags.HasAggregatedChildData)) { // A node is considered to contain a parse error if: // a) the parser explicitly marked that it had an error // b) any of it's children reported that it had an error. - var thisNodeOrAnySubNodesHasError = hasFlag(node.parserContextFlags, ParserContextFlags.ThisNodeHasError) || + var thisNodeOrAnySubNodesHasError = ((node.parserContextFlags & ParserContextFlags.ThisNodeHasError) !== 0) || forEachChild(node, containsParseError); // If so, mark ourselves accordingly.