diff options
Diffstat (limited to 'lib/compilers')
-rw-r--r-- | lib/compilers/ocaml.js | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/lib/compilers/ocaml.js b/lib/compilers/ocaml.js index 46b396773..1bbd9a6cf 100644 --- a/lib/compilers/ocaml.js +++ b/lib/compilers/ocaml.js @@ -22,35 +22,37 @@ // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. -import path from 'path'; - import { BaseCompiler } from '../base-compiler'; +import { PascalParser } from './argument-parsers'; + export class OCamlCompiler extends BaseCompiler { static get key() { return 'ocaml'; } + constructor(compilerInfo, env) { + super(compilerInfo, env); + // override output base because ocaml's -S -o has different semantics. + // namely, it outputs a full binary exe to the supposed asm dump. + // with this override and optionsForFilter override, that pecularity.. + // ..is bypassed entirely. + this.outputFilebase = 'example'; + } + getSharedLibraryPathsAsArguments() { return []; } optionsForFilter(filters, outputFileName) { - let options = ['-g', '-S']; + const options = ['-g']; if (filters.binary) { - options = options.concat('-o', this.filename(outputFileName)); + options.unshift('-o', outputFileName); } else { - options = options.concat('-c'); + options.unshift('-S', '-c'); } return options; } - getOutputFilename(dirPath, outputFilebase, key) { - const filename = key.backendOptions.customOutputFilename || - `${path.basename(this.compileFilename, this.lang.extensions[0])}.s`; - return path.join(dirPath, filename); - } - - getExecutableFilename(dirPath, outputFilebase, key) { - const filename = key.backendOptions.customOutputFilename || outputFilebase; - return path.join(dirPath, filename); + getArgumentParser() { + return PascalParser; } } |