Skip to content

Commit

Permalink
Merge pull request tunnelvisionlabs#330 from sharwell/update-tsc
Browse files Browse the repository at this point in the history
Update to TypeScript 2.4.1
  • Loading branch information
BurtHarris authored Jul 1, 2017
2 parents 23cd521 + 08a3447 commit 9db6b7e
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 13 deletions.
10 changes: 5 additions & 5 deletions benchmark/TestPerformance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1665,7 +1665,7 @@ class DescriptiveErrorListener implements ParserErrorListener {
static INSTANCE: DescriptiveErrorListener = new DescriptiveErrorListener();

@Override
syntaxError<T extends Token>(recognizer: Recognizer<T,any>, offendingSymbol: T, line: number, charPositionInLine: number, msg: string, e: RecognitionException): void {
syntaxError<T extends Token>(recognizer: Recognizer<T,any>, offendingSymbol: T | undefined, line: number, charPositionInLine: number, msg: string, e: RecognitionException): void {
if (!TestPerformance.REPORT_SYNTAX_ERRORS) {
return;
}
Expand All @@ -1685,7 +1685,7 @@ class DescriptiveLexerErrorListener implements ANTLRErrorListener<number> {
static INSTANCE: DescriptiveLexerErrorListener = new DescriptiveLexerErrorListener();

@Override
syntaxError<T extends number>(recognizer: Recognizer<T,any>, offendingSymbol: T, line: number, charPositionInLine: number, msg: string, e: RecognitionException): void {
syntaxError<T extends number>(recognizer: Recognizer<T,any>, offendingSymbol: T | undefined, line: number, charPositionInLine: number, msg: string, e: RecognitionException): void {
if (!TestPerformance.REPORT_SYNTAX_ERRORS) {
return;
}
Expand All @@ -1702,11 +1702,11 @@ class DescriptiveLexerErrorListener implements ANTLRErrorListener<number> {
}

class SummarizingDiagnosticErrorListener extends DiagnosticErrorListener {
private _sllConflict: BitSet;
private _sllConflict: BitSet | undefined;
private _sllConfigs: ATNConfigSet;

@Override
reportAmbiguity(recognizer: Parser, dfa: DFA, startIndex: number, stopIndex: number, exact: boolean, ambigAlts: BitSet, configs: ATNConfigSet): void {
reportAmbiguity(recognizer: Parser, dfa: DFA, startIndex: number, stopIndex: number, exact: boolean, ambigAlts: BitSet | undefined, configs: ATNConfigSet): void {
if (TestPerformance.COMPUTE_TRANSITION_STATS && TestPerformance.DETAILED_DFA_STATE_STATS) {
let sllPredictions: BitSet = this.getConflictingAlts(this._sllConflict, this._sllConfigs);
let sllPrediction: number = sllPredictions.nextSetBit(0);
Expand All @@ -1729,7 +1729,7 @@ class SummarizingDiagnosticErrorListener extends DiagnosticErrorListener {
}

@Override
reportAttemptingFullContext(recognizer: Parser, dfa: DFA, startIndex: number, stopIndex: number, conflictingAlts: BitSet, conflictState: SimulatorState): void {
reportAttemptingFullContext(recognizer: Parser, dfa: DFA, startIndex: number, stopIndex: number, conflictingAlts: BitSet | undefined, conflictState: SimulatorState): void {
this._sllConflict = conflictingAlts;
this._sllConfigs = conflictState.s0.configs;
if (!TestPerformance.REPORT_FULL_CONTEXT) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"source-map-support": "^0.4.3",
"std-mocks": "^1.0.1",
"typedoc": "^0.5.1",
"typescript": "^2.1.0"
"typescript": "^2.4.1"
},
"dependencies": {}
}
4 changes: 2 additions & 2 deletions src/Decorators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
export function NotNull(
target: any,
propertyKey: PropertyKey,
propertyDescriptor?: PropertyDescriptor) {
propertyDescriptor?: PropertyDescriptor | number) {
}

export function Nullable(
target: any,
propertyKey: PropertyKey,
propertyDescriptor?: PropertyDescriptor) {
propertyDescriptor?: PropertyDescriptor | number) {
}

export function Override(target: any,
Expand Down
15 changes: 15 additions & 0 deletions src/DiagnosticErrorListener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ import { BitSet } from './misc/BitSet';
import { DFA } from './dfa/DFA';
import { Parser } from './Parser';
import { ParserErrorListener } from './ParserErrorListener';
import { RecognitionException } from './RecognitionException';
import { Recognizer } from './Recognizer';
import { SimulatorState } from './atn/SimulatorState';
import { Token } from './Token';
import { Override, NotNull } from "./Decorators";
import { Interval } from "./misc/Interval";
import { asIterable } from './misc/Stubs';
Expand All @@ -51,6 +54,18 @@ export class DiagnosticErrorListener implements ParserErrorListener {
this.exactOnly = exactOnly;
}

@Override
syntaxError<T extends Token>(
/*@NotNull*/ recognizer: Recognizer<T, any>,
offendingSymbol: T | undefined,
line: number,
charPositionInLine: number,
/*@NotNull*/
msg: string,
e: RecognitionException | undefined): void
{
}

@Override
reportAmbiguity(@NotNull recognizer: Parser,
@NotNull dfa: DFA,
Expand Down
4 changes: 2 additions & 2 deletions src/Recognizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export abstract class Recognizer<Symbol, ATNInterpreter extends ATNSimulator> {
}

intermediateResult.set("EOF", Token.EOF);
result = Object.freeze(intermediateResult);
result = intermediateResult;
Recognizer.tokenTypeMapCache.set(vocabulary, result);
}

Expand All @@ -91,7 +91,7 @@ export abstract class Recognizer<Symbol, ATNInterpreter extends ATNSimulator> {

let result: ReadonlyMap<string, number> | undefined = Recognizer.ruleIndexMapCache.get(ruleNames);
if (result == null) {
result = Object.freeze(Utils.toMap(ruleNames));
result = Utils.toMap(ruleNames);
Recognizer.ruleIndexMapCache.set(ruleNames, result);
}

Expand Down
2 changes: 1 addition & 1 deletion src/tree/ParseTreeWalker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { RuleNode } from "./RuleNode";
import { ParserRuleContext } from "../ParserRuleContext";

export class ParseTreeWalker {
walk(listener: ParseTreeListener, t: ParseTree): void {
walk<T extends ParseTreeListener>(listener: T, t: ParseTree): void {
let nodeStack: ParseTree[] = [];
let indexStack: number[] = [];

Expand Down
2 changes: 1 addition & 1 deletion src/tree/xpath/XPathLexerErrorListener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { RecognitionException } from "../../RecognitionException";

export class XPathLexerErrorListener implements ANTLRErrorListener<number> {
@Override
syntaxError<T extends number>(recognizer: Recognizer<T, any>, offendingSymbol: T,
syntaxError<T extends number>(recognizer: Recognizer<T, any>, offendingSymbol: T | undefined,
line: number, charPositionInLine: number, msg: string,
e: RecognitionException): void {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ export class LeafListener implements TListener {
>>

WalkListener(s) ::= <<
ParseTreeWalker.DEFAULT.walk(new LeafListener(), <s>);
ParseTreeWalker.DEFAULT.walk\<TListener>(new LeafListener(), <s>);
>>

TreeNodeWithAltNumField(X) ::= <<
Expand Down

0 comments on commit 9db6b7e

Please sign in to comment.