File tree 2 files changed +13
-3
lines changed
2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -737,8 +737,6 @@ local function make_context(self, lex)
737
737
end
738
738
739
739
function Parser :parse (src , name )
740
- name = name or " <input>"
741
-
742
740
local loaded = self .loaded [name ]
743
741
if loaded then
744
742
if loaded == true then
@@ -747,7 +745,8 @@ function Parser:parse(src, name)
747
745
return loaded
748
746
end
749
747
750
- local lex = Lexer .new (name or " <input>" , src )
748
+ name = name or " <input>"
749
+ local lex = Lexer .new (name , src )
751
750
local info = { name = lex .name }
752
751
if name then self .loaded [name ] = true end
753
752
local ctx = make_context (self , lex )
Original file line number Diff line number Diff line change @@ -799,6 +799,17 @@ function _G.test_slice()
799
799
end
800
800
801
801
function _G .test_load ()
802
+ do
803
+ local old = pb .state (nil )
804
+ protoc .reload ()
805
+ local p = protoc .new ()
806
+ assert (p :load [[ message Test1 { optional int32 t = 1; } ]] )
807
+ assert (pb .type " Test1" )
808
+ assert (p :load [[ message Test2 { optional int32 t = 2; } ]] )
809
+ assert (pb .type " Test2" )
810
+ pb .state (old )
811
+ end
812
+
802
813
local old = pb .state (nil ) -- discard previous one and save
803
814
assert (old .setdefault )
804
815
eq (pb .type " .google.protobuf.FileDescriptorSet" , nil )
You can’t perform that action at this time.
0 commit comments