Fix some small compile-time and runtime errors

This commit is contained in:
Sam Vervaeck 2020-06-01 20:10:54 +02:00
parent 475f11782e
commit 68942f4488
2 changed files with 7 additions and 7 deletions

View file

@ -20,7 +20,6 @@ import { BOLT_SUPPORTED_LANGUAGES } from "./constants"
import {FastStringMap, enumOr, escapeChar, assert} from "./util";
import {TextSpan, TextPos, TextFile} from "./text";
import {Scanner} from "./scanner";
import * as path from "path"
import { convertNodeToSymbolPath } from "./resolver";
import { TYPE_ERROR_MESSAGES } from "./diagnostics";
@ -30,7 +29,7 @@ export function getSourceFile(node: Syntax) {
return node
}
assert(node.parentNode !== null);
node = node.parentNode;
node = node.parentNode!;
}
}

View file

@ -1,6 +1,7 @@
import { BoltSyntax, SyntaxKind, Syntax, BoltSourceFile, SourceFile, kindToString } from "./ast";
import { emitNode } from "./emitter";
import { Package, isExported } from "./common";
import { isExported } from "./common";
import { Package } from "./package"
import { FastStringMap, assert, every } from "./util";
import { Program } from "./program";
@ -236,14 +237,14 @@ export class BoltSymbolResolutionStrategy implements ResolutionStrategy {
let currNode = source.node;
while (true) {
if (currNode.kind === SyntaxKind.BoltSourceFile) {
return new PackageScopeSource(currNode.package);
return new PackageScopeSource(currNode.pkg);
}
const nextNode = currNode.parentNode;
assert(nextNode !== null);
if (this.introducesNewScope(new NodeScopeSource(nextNode), kind)) {
return new NodeScopeSource(nextNode);
if (this.introducesNewScope(new NodeScopeSource(nextNode!), kind)) {
return new NodeScopeSource(nextNode!);
}
currNode = nextNode;
currNode = nextNode!;
}
}