This commit is contained in:
Yuriy Glukhov
2016-05-26 08:49:56 +03:00
parent ea0dff3783
commit 4d0d2d69f3
2 changed files with 16 additions and 5 deletions

View File

@@ -1,7 +1,8 @@
discard """
output: '''foo
js 3.14
7'''
7
1'''
"""
# This file tests the JavaScript generator
@@ -29,3 +30,13 @@ proc test(x: C, T: typedesc): T =
cast[T](x)
echo 7.test(int8)
# #4222
const someConst = [ "1"]
proc procThatRefersToConst() # Forward decl
procThatRefersToConst() # Call bar before it is defined
proc procThatRefersToConst() =
var i = 0 # Use a var index, otherwise nim will constfold foo[0]
echo someConst[i] # JS exception here: foo is still not initialized (undefined)