From 6b19e593003a548f2e7e99971520467d6bdc9046 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Rinc=C3=B3n=20Blanco?= Date: Mon, 3 Aug 2020 15:41:08 +0200 Subject: [PATCH] Minor improvement to compilation API docs Removes the `req.body.compiler` fallback when looking for the compiler - It could never be reached --- docs/API.md | 10 ++++++---- lib/handlers/compile.js | 2 +- static/panes/conformance-view.js | 3 ++- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/docs/API.md b/docs/API.md index 0cfaee96e..22ead274f 100644 --- a/docs/API.md +++ b/docs/API.md @@ -51,9 +51,9 @@ To specify a compilation request as a JSON document, post it as the appropriate type and send an object of the form: ```JSON { - "source": "Source to compile", + "source": "", "options": { - "userArguments": "Compiler flags", + "userArguments": "", "compilerOptions": { "skipAsm": false, "executorRequest": false @@ -76,11 +76,13 @@ To specify a compilation request as a JSON document, post it as the appropriate {"id": "range-v3", "version": "trunk"}, {"id": "fmt", "version": "400"} ] - } + }, + "lang": "", + "allowStoreCodeDebug": true } ``` -Execution Only request: +Execution Only request example: ```JSON { "source": "int main () { return 1; }", diff --git a/lib/handlers/compile.js b/lib/handlers/compile.js index 1ddd1edaf..a4e0d0e03 100644 --- a/lib/handlers/compile.js +++ b/lib/handlers/compile.js @@ -184,7 +184,7 @@ class CompileHandler { compilerFor(req) { if (req.is('json')) { - const compiler = this.findCompiler(req.lang || req.body.lang, req.params.compiler || req.body.compiler); + const compiler = this.findCompiler(req.lang || req.body.lang, req.params.compiler); if (!compiler) { const withoutBody = _.extend({}, req.body, {source: ''}); logger.warn(`Unable to find compiler with lang ${req.lang} for request`, withoutBody); diff --git a/static/panes/conformance-view.js b/static/panes/conformance-view.js index 3777f4058..87a471458 100644 --- a/static/panes/conformance-view.js +++ b/static/panes/conformance-view.js @@ -296,7 +296,8 @@ Conformance.prototype.compileChild = function (child) { compilerOptions: {produceAst: false, produceOptInfo: false}, libraries: [], skipAsm: true - } + }, + lang: this.langId }; _.each(this.libsWidget.getLibsInUse(), function (item) {