Skip to content

Commit 16bbb8b

Browse files
committed
Done
1 parent 5bec091 commit 16bbb8b

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

lib/elixir/lib/code.ex

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1068,7 +1068,8 @@ defmodule Code do
10681068
Macro arguments are typically transformed by unquoting them into the
10691069
returned quoted expressions (instead of evaluated).
10701070
1071-
See `eval_string/3` for a description of `binding` and `opts`.
1071+
See `eval_string/3` for a description of arguments and return types.
1072+
The options are described under `env_for_eval/1`.
10721073
10731074
## Examples
10741075
@@ -1168,6 +1169,10 @@ defmodule Code do
11681169
* `:column` - (since v1.11.0) the starting column of the string being parsed.
11691170
Defaults to 1.
11701171
1172+
* `:indentation` - (since v1.19.0) the indentation for the string being parsed.
1173+
This is useful when the code parsed is embedded within another document.
1174+
Defaults to 0.
1175+
11711176
* `:columns` - when `true`, attach a `:column` key to the quoted
11721177
metadata. Defaults to `false`.
11731178

lib/elixir/test/elixir/code_test.exs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ defmodule CodeTest do
392392
Code.unrequire_files([fixture_path("code_sample.exs")])
393393
end
394394

395-
test "string_to_quoted!/2 errors take lines and columns into account" do
395+
test "string_to_quoted!/2 errors take lines/columns/indentation into account" do
396396
assert_exception(
397397
SyntaxError,
398398
["nofile:1:5:", "syntax error before:", "1 + * 3", "^"],
@@ -419,9 +419,9 @@ defmodule CodeTest do
419419

420420
assert_exception(
421421
SyntaxError,
422-
["nofile:11:7:", "syntax error before:", "1 + * 3", "^"],
422+
["nofile:11:15:", "syntax error before:", "1 + * 3", "^"],
423423
fn ->
424-
Code.string_to_quoted!(":ok\n1 + * 3", line: 10, column: 3)
424+
Code.string_to_quoted!(":ok\n1 + * 3", line: 10, column: 3, indentation: 10)
425425
end
426426
)
427427
end

0 commit comments

Comments
 (0)