Skip to content

Commit 4de012e

Browse files
authored
refactor: get rid of RealNode interface (#247)
I think this may have been for compatibility and doesn't seem to be needed anymore.
1 parent 5dd14b0 commit 4de012e

File tree

2 files changed

+3
-13
lines changed

2 files changed

+3
-13
lines changed

src/nodes.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
11
import SourceToken from 'coffee-lex/dist/SourceToken';
22
import ParseContext from './util/ParseContext';
33

4-
export interface RealNode {
5-
type: string;
6-
line: number;
7-
column: number;
8-
range: [number, number];
9-
raw: string;
10-
}
11-
124
export abstract class Node {
135
readonly range: [number, number];
146

src/util/ParseContext.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import SourceTokenList from 'coffee-lex/dist/SourceTokenList';
22
import { Base, Block, LocationData } from 'decaffeinate-coffeescript/lib/coffee-script/nodes';
33
import LinesAndColumns from 'lines-and-columns';
4-
import { ClassProtoAssignOp, Constructor, RealNode } from '../nodes';
4+
import { ClassProtoAssignOp, Constructor } from '../nodes';
55

66
class ParseError extends Error {
77
syntaxError: SyntaxError;
@@ -60,10 +60,8 @@ export default class ParseContext {
6060
readonly parseState: ParseState) {
6161
}
6262

63-
getRange(locatable: RealNode | Base | LocationData): [number, number] | null {
64-
if ('range' in locatable) {
65-
return (locatable as RealNode).range;
66-
} else if (locatable instanceof Base) {
63+
getRange(locatable: Base | LocationData): [number, number] | null {
64+
if (locatable instanceof Base) {
6765
return this.getRange(locatable.locationData);
6866
} else {
6967
let locationData = locatable as LocationData;

0 commit comments

Comments
 (0)