Browse files

Allow nested access

  • Loading branch information...
1 parent 4112f45 commit 7c4e7fe077f484fb61fedc750cc02f237eb9cdfe @josevalim josevalim committed Aug 8, 2012
View
2 lib/elixir/lib/binary/dict.ex
@@ -31,7 +31,7 @@ defmodule Binary.Dict do
:orddict.is_key to_binary(key), data
end
- def get(dict(data), key, default // nil) do
+ def get(dict(data), key, default) do
case :orddict.find(to_binary(key), data) do
{:ok, value} -> value
:error -> default
View
2 lib/elixir/lib/dict.ex
@@ -8,7 +8,7 @@ defmodule Dict do
@doc false
def behaviour_info(:callbacks) do
- [delete: 2, empty: 1, get: 2, get: 3, has_key?: 2,
+ [delete: 2, empty: 1, get: 3, has_key?: 2,
keys: 1, merge: 3, put: 3, size: 1, to_list: 1,
update: 3, update: 4, values: 1]
end
View
2 lib/elixir/lib/hash_dict.ex
@@ -33,7 +33,7 @@ defmodule HashDict do
:dict.is_key key, data
end
- def get(dict(data), key, default // nil) do
+ def get(dict(data), key, default) do
case :dict.find(key, data) do
{:ok, value} -> value
:error -> default
View
2 lib/elixir/lib/orddict.ex
@@ -32,7 +32,7 @@ defmodule Orddict do
:orddict.is_key key, data
end
- def get(dict(data), key, default // nil) do
+ def get(dict(data), key, default) do
case :orddict.find(key, data) do
{:ok, value} -> value
:error -> default
View
2 lib/elixir/src/elixir_parser.yrl
@@ -155,7 +155,7 @@ call_expr -> var : build_identifier('$1', nil).
call_expr -> bracket_expr : '$1'.
bracket_expr -> dot_bracket_identifier bracket_access : build_access(build_identifier('$1', nil), '$2').
-bracket_expr -> max_expr bracket_access : build_access('$1', '$2').
+bracket_expr -> bracket_expr bracket_access : build_access('$1', '$2').
bracket_expr -> max_expr : '$1'.
max_expr -> parens_call call_args_parens : build_identifier('$1', '$2').
View
1 lib/elixir/test/elixir/access_test.exs
@@ -5,6 +5,7 @@ defmodule Access.TupleTest do
test :list do
assert [foo: :bar][:foo] == :bar
+ assert [foo: [bar: :baz]][:foo][:bar] == :baz
end
test :function do

0 comments on commit 7c4e7fe

Please sign in to comment.