couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnew...@apache.org
Subject couchdb-couch-epi git commit: Use erl_scan:line/1 if present
Date Thu, 14 Jul 2016 15:01:51 GMT
Repository: couchdb-couch-epi
Updated Branches:
  refs/heads/master 5a7f2868c -> f6ad55d80


Use erl_scan:line/1 if present

COUCHDB-3058


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-epi/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-epi/commit/f6ad55d8
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-epi/tree/f6ad55d8
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-epi/diff/f6ad55d8

Branch: refs/heads/master
Commit: f6ad55d804ac741b59fe37dd092787113847661c
Parents: 5a7f286
Author: Robert Newson <rnewson@apache.org>
Authored: Thu Jul 14 15:56:42 2016 +0100
Committer: Robert Newson <rnewson@apache.org>
Committed: Thu Jul 14 15:56:42 2016 +0100

----------------------------------------------------------------------
 src/couch_epi_codegen.erl | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-epi/blob/f6ad55d8/src/couch_epi_codegen.erl
----------------------------------------------------------------------
diff --git a/src/couch_epi_codegen.erl b/src/couch_epi_codegen.erl
index 1901887..978f0bb 100644
--- a/src/couch_epi_codegen.erl
+++ b/src/couch_epi_codegen.erl
@@ -66,6 +66,15 @@ fixup_terminator(Tokens) ->
         {dot, _} -> Tokens;
         {';', _} -> Tokens;
         Token ->
-            {line, Line} = erl_scan:token_info(Token, line),
+            Line = line(Token),
             Tokens ++ [{dot, Line}]
     end.
+
+line(Token) ->
+    case erlang:function_exported(erl_scan, line, 1) of
+        true ->
+            erl_scan:line(Token);
+        false ->
+            {line, Line} = erl_scan:token_info(Token, line),
+            Line
+    end.


Mime
View raw message