UNPKG

@neo-one/smart-contract-compiler

Version:

NEO•ONE TypeScript smart contract compiler.

27 lines (25 loc) 971 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getSemanticDiagnostics = void 0; const ts_utils_1 = require("@neo-one/ts-utils"); const compile_1 = require("./compile"); const createContext_1 = require("./createContext"); exports.getSemanticDiagnostics = ({ filePath, host, languageService, }) => { const context = createContext_1.createContextForLanguageService(filePath, languageService, host); let sourceFile; try { sourceFile = ts_utils_1.tsUtils.file.getSourceFileOrThrow(context.program, filePath); compile_1.compileForDiagnostics({ sourceFile, context, sourceMaps: {}, }); } catch (_a) { } if (sourceFile !== undefined) { return context.diagnostics.filter((diagnostic) => diagnostic.file === undefined || sourceFile === diagnostic.file); } return context.diagnostics; }; //# sourceMappingURL=getSemanticDiagnostics.js.map