Skip to content
Browse files

[fix] compiler, database: Import database engine even if no db declar…

…ation
  • Loading branch information...
1 parent 920d0ff commit 33e7939f4332f3888438a9abcc742ecbb0207aa9 @BourgerieQuentin BourgerieQuentin committed Feb 10, 2012
Showing with 5 additions and 8 deletions.
  1. +2 −6 opa/pass_DbEngineImportation.ml
  2. +1 −1 opa/pass_DbEngineImportation.mli
  3. +2 −1 opa/s3Passes.ml
View
8 opa/pass_DbEngineImportation.ml
@@ -22,12 +22,8 @@ module Db = QmlDbGen
let builtinpos = FilePos.nopos "Built in pass DbEngineImportation"
-let process_code code =
- if List.exists
- (function
- | (S.Database _), _ | (S.NewDbDef _), _ -> true
- | _ -> false)
- code then (
+let process_code ~stdlib code =
+ if stdlib then (
let package = match QmlDbGen.Args.get_engine () with
| `db3 -> "stdlib.database.db3"
| `mongo -> "stdlib.database.mongo"
View
2 opa/pass_DbEngineImportation.mli
@@ -19,4 +19,4 @@
(**
This pass import the database runtime if needed.
*)
-val process_code : ('ident, 'dir) SurfaceAst.code -> ('ident, 'dir) SurfaceAst.code
+val process_code : stdlib:bool -> ('ident, 'dir) SurfaceAst.code -> ('ident, 'dir) SurfaceAst.code
View
3 opa/s3Passes.ml
@@ -514,10 +514,11 @@ let pass_DbEngineImportation =
PassHandler.make_pass
(fun e ->
let (a, user_files) = e.PH.env in
+ let stdlib = e.PH.options.O.stdlib in
let user_files = List.map
(fun pfile ->
{pfile with SurfaceAstPassesTypes.parsedFile_lcode =
- Pass_DbEngineImportation.process_code
+ Pass_DbEngineImportation.process_code ~stdlib
pfile.SurfaceAstPassesTypes.parsedFile_lcode}
) user_files in
{ e with PH.env = (a, user_files) }

0 comments on commit 33e7939

Please sign in to comment.
Something went wrong with that request. Please try again.