Skip to content

Commit

Permalink
typescript: removed redundant checking if scope != CORK_NIL
Browse files Browse the repository at this point in the history
  • Loading branch information
Karol Samborski committed Apr 18, 2019
1 parent 5f3ff44 commit 710bf3e
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions parsers/typescript.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,7 @@ static int emitTag(const tokenInfo *const token, const tsKind kind)
initTagEntry (&e, name, kind);
e.lineNumber = token->lineNumber;
e.filePosition = token->filePosition;

if (token->scope != CORK_NIL) e.extensionFields.scopeIndex = token->scope;
e.extensionFields.scopeIndex = token->scope;

switch (token->accessKeyword)
{
Expand Down Expand Up @@ -955,7 +954,7 @@ static void parseInterface (const int scope, tokenInfo *const token)
if (! parsed)
return;

if (scope != CORK_NIL) token->scope = scope;
token->scope = scope;

const int nscope = emitTag (token, TSTAG_INTERFACE);

Expand All @@ -978,7 +977,7 @@ static void parseType (const int scope, tokenInfo *const token)
if (! parsed)
return;

if (scope != CORK_NIL) token->scope = scope;
token->scope = scope;
emitTag (token, TSTAG_ALIAS);
skipBlocksTillType (TOKEN_SEMICOLON, token);
}
Expand Down Expand Up @@ -1062,7 +1061,7 @@ static void parseEnum (const int scope, tokenInfo *const token)
if (! parsed)
return;

if (scope != CORK_NIL) token->scope = scope;
token->scope = scope;
const int nscope = emitTag (token, TSTAG_ENUM);

parseEnumBody (nscope, token);
Expand Down Expand Up @@ -1144,7 +1143,7 @@ static void parseVariable (bool constVar, bool localVar, const int scope, tokenI
{
member = newToken ();
copyToken (member, token, false);
if (scope != CORK_NIL) member->scope = scope;
member->scope = scope;
emitTag (member, varKind);
deleteToken (member);
}
Expand Down Expand Up @@ -1360,9 +1359,9 @@ static void parseFunction (const int scope, tokenInfo *const token)
if (! parsed)
return;

if (scope != CORK_NIL) token->scope = scope;
token->scope = scope;

const int nscope = isGenerator ? emitTag (token, TSTAG_GENERATOR) : emitTag (token, TSTAG_FUNCTION);
const int nscope = emitTag (token, isGenerator ? TSTAG_GENERATOR : TSTAG_FUNCTION);

parseFunctionArgs (nscope, token);
parseFunctionBody (nscope, token);
Expand Down Expand Up @@ -1613,7 +1612,7 @@ static void parseClassBody (const int scope, tokenInfo *const token)
break;
uwiUngetC ('(');

const int nscope = isGenerator ? emitTag (member, TSTAG_GENERATOR) : emitTag (member, TSTAG_METHOD);
const int nscope = emitTag (member, isGenerator ? TSTAG_GENERATOR : TSTAG_METHOD);

deleteToken (member);
member = NULL;
Expand Down Expand Up @@ -1670,7 +1669,7 @@ static void parseClass (const int scope, tokenInfo *const token)
if (! parsed)
return;

if (scope != CORK_NIL) token->scope = scope;
token->scope = scope;
const int nscope = emitTag (token, TSTAG_CLASS);

parseClassBody (nscope, token);
Expand Down

0 comments on commit 710bf3e

Please sign in to comment.