Просмотр исходного кода

Merge branch 'ricecake-patch-1'

Andreas Stenius 10 лет назад
Родитель
Сommit
dd16a97a1d
5 измененных файлов с 8 добавлено и 5 удалено
  1. 1 0
      .travis.yml
  2. 1 1
      rebar.config
  3. 1 1
      src/erlydtl_beam_compiler.erl
  4. 3 1
      test/erlydtl_eunit_testrunner.erl
  5. 2 2
      test/erlydtl_test_defs.erl

+ 1 - 0
.travis.yml

@@ -1,6 +1,7 @@
 language: erlang
 otp_release:
 # Test on all supported releases accepted by the `require_otp_vsn` in rebar.config
+   - 18.0
    - 17.4
    - 17.3
    - 17.1

+ 1 - 1
rebar.config

@@ -2,7 +2,7 @@
 
 %% accept R15B02.., any R16B except R16B03
 %% also accept OTP v17, altough it may not work properly on that release yet..
-{require_otp_vsn, "R15B0[^1]|R16B$|R16B[^0]|R16B0[^3]|R16B03-1|17"}.
+{require_otp_vsn, "R15B0[^1]|R16B$|R16B[^0]|R16B0[^3]|R16B03-1|17|18"}.
 
 {erl_opts, [debug_info]}.
 {yrl_opts, [{includefile, "include/erlydtl_preparser.hrl"}]}.

+ 1 - 1
src/erlydtl_beam_compiler.erl

@@ -585,7 +585,7 @@ body_ast(DjangoParseTree, BodyScope, TreeWalker) ->
                         lists:foldr(
                           fun ({ChildFile, ChildPos, ChildBlock}, {{SuperAst, SuperInfo}, AccTW}) ->
                                   BlockScope = create_scope(
-                                                 [{block, ?Q("[{super, _@SuperAst}]"), safe}],
+                                                 [{block, ?Q("fun (super) -> _@SuperAst; (_) -> [] end"), safe}],
                                                  ChildPos, ChildFile, AccTW),
                                   {{BlockAst, BlockInfo}, BlockTW} = body_ast(ChildBlock, BlockScope, AccTW),
                                   {{BlockAst, merge_info(SuperInfo, BlockInfo)}, BlockTW}

+ 3 - 1
test/erlydtl_eunit_testrunner.erl

@@ -58,8 +58,10 @@ run_compile(T) ->
            T#test.module,
            compile_opts(T))
     of
-        {ok, M, W} ->
+        {ok, M, W0} ->
             ?assertEqual(T#test.module, M),
+            %% ignore useless_building warnings on line 588 in anonymous files
+            W = W0 -- [{[], [{588, sys_core_fold, useless_building}]}],
             ?assertEqual(T#test.warnings, W);
         {error, E, W} ->
             ?assertEqual(T#test.errors, E),

+ 2 - 2
test/erlydtl_test_defs.erl

@@ -1897,8 +1897,8 @@ setup_compile("var_preset") ->
     CompileVars = [{preset_var1, "preset-var1"}, {preset_var2, "preset-var2"}],
     {ok, [CompileVars]};
 setup_compile("extends_for") ->
-	CompileVars = [{veggie_list, ["broccoli", "beans", "peas", "carrots"]}],
-	{ok, [CompileVars]};
+    CompileVars = [{veggie_list, ["broccoli", "beans", "peas", "carrots"]}],
+    {ok, [CompileVars]};
 setup_compile("extends2") ->
     File = template_file(input, "extends2"),
     Error = {none, erlydtl_beam_compiler, unexpected_extends_tag},