bugfixes: objects still invalid for constants; fixed a typo concerning 'high' in eval context
This commit is contained in:
parent
5f018a5046
commit
7819b84475
8 changed files with 52 additions and 15 deletions
|
|
@ -16,7 +16,7 @@ proc action3(arg: string) =
|
|||
proc action4(arg: string) =
|
||||
echo "action 4 ", arg
|
||||
|
||||
const
|
||||
var
|
||||
actionTable = {
|
||||
"A": action1,
|
||||
"B": action2,
|
||||
|
|
|
|||
28
tests/reject/tactiontable2.nim
Normal file
28
tests/reject/tactiontable2.nim
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
discard """
|
||||
line: 21
|
||||
errormsg: "invalid type: 'TTable'"
|
||||
"""
|
||||
|
||||
import tables
|
||||
|
||||
proc action1(arg: string) =
|
||||
echo "action 1 ", arg
|
||||
|
||||
proc action2(arg: string) =
|
||||
echo "action 2 ", arg
|
||||
|
||||
proc action3(arg: string) =
|
||||
echo "action 3 ", arg
|
||||
|
||||
proc action4(arg: string) =
|
||||
echo "action 4 ", arg
|
||||
|
||||
const
|
||||
actionTable = {
|
||||
"A": action1,
|
||||
"B": action2,
|
||||
"C": action3,
|
||||
"D": action4}.toTable
|
||||
|
||||
actionTable["C"]("arg")
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue