add more tests
This commit is contained in:
parent
d055ed69a4
commit
48c89d7fc1
|
|
@ -97,8 +97,22 @@ void secondPass(SemanticSymbol* currentSymbol, Scope* moduleScope, ref ModuleCac
|
|||
break;
|
||||
}
|
||||
|
||||
// let's be methodic about the way we traverse symbols
|
||||
// so that childs have access to resolved symbols
|
||||
// functions should be last, because inside, there might be symbols that references
|
||||
// code from the parent not yet resolved (templates)
|
||||
foreach (child; currentSymbol.children)
|
||||
secondPass(child, moduleScope, cache);
|
||||
if (child.acSymbol.kind != CompletionKind.variableName && child.acSymbol.kind != CompletionKind.functionName)
|
||||
secondPass(child, moduleScope, cache);
|
||||
|
||||
foreach (child; currentSymbol.children)
|
||||
if (child.acSymbol.kind == CompletionKind.variableName)
|
||||
secondPass(child, moduleScope, cache);
|
||||
|
||||
foreach (child; currentSymbol.children)
|
||||
if (child.acSymbol.kind == CompletionKind.functionName)
|
||||
secondPass(child, moduleScope, cache);
|
||||
|
||||
|
||||
// Alias this and mixin templates are resolved after child nodes are
|
||||
// resolved so that the correct symbol information will be available.
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
identifiers
|
||||
alignof k
|
||||
init k
|
||||
mangleof k
|
||||
sizeof k
|
||||
stringof k
|
||||
tupleof k
|
||||
value_key v int value_key stdin 0
|
||||
value_value v int value_value stdin 0
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
identifiers
|
||||
alignof k
|
||||
init k
|
||||
mangleof k
|
||||
sizeof k
|
||||
stringof k
|
||||
tupleof k
|
||||
value_key v int value_key stdin 0
|
||||
value_value v int value_value stdin 0
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
identifiers
|
||||
alignof k
|
||||
init k
|
||||
mangleof k
|
||||
sizeof k
|
||||
stringof k
|
||||
tupleof k
|
||||
value_key v int value_key stdin 0
|
||||
value_value v int value_value stdin 0
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
identifiers
|
||||
alignof k
|
||||
init k
|
||||
mangleof k
|
||||
max k
|
||||
min k
|
||||
sizeof k
|
||||
stringof k
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
struct HashMap(Key, Value)
|
||||
struct TopHashMap(Key, Value)
|
||||
{
|
||||
Key value_key;
|
||||
Value value_value;
|
||||
|
|
@ -6,6 +6,44 @@ struct HashMap(Key, Value)
|
|||
|
||||
void main()
|
||||
{
|
||||
auto hmap = HashMap!(int, int)();
|
||||
hmap.
|
||||
}
|
||||
auto top = TopHashMap!(int, int)();
|
||||
auto bottom = BottomHashMap!(int, int)();
|
||||
{
|
||||
top.
|
||||
}
|
||||
{
|
||||
auto copy = top;
|
||||
copy.
|
||||
}
|
||||
{
|
||||
bottom.
|
||||
}
|
||||
{
|
||||
auto copy = bottom;
|
||||
copy.
|
||||
}
|
||||
{
|
||||
auto wf = WithFunction!(int, int)();
|
||||
auto gkey = wf.get_key();
|
||||
gkey.
|
||||
}
|
||||
}
|
||||
|
||||
struct BottomHashMap(Key, Value)
|
||||
{
|
||||
Key value_key;
|
||||
Value value_value;
|
||||
}
|
||||
|
||||
struct WithFunction(Key, Value)
|
||||
{
|
||||
Key get_key()
|
||||
{
|
||||
return Key.init;
|
||||
}
|
||||
|
||||
Value get_value()
|
||||
{
|
||||
return Value.init;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,29 +13,39 @@ function check () {
|
|||
|
||||
|
||||
#echo "test1"
|
||||
../../bin/dcd-client $1 file1.d --extended -c 280 > actual_1_1.txt
|
||||
diff actual_1_1.txt expected_1_1.txt --strip-trailing-cr
|
||||
check file1 280 actual_1_1 expected_1_1
|
||||
|
||||
|
||||
#echo "test2"
|
||||
../../bin/dcd-client $1 file1.d --extended -c 315 > actual_1_2.txt
|
||||
diff actual_1_2.txt expected_1_2.txt --strip-trailing-cr
|
||||
|
||||
check file1 315 actual_1_2 expected_1_2
|
||||
|
||||
|
||||
#echo "test3"
|
||||
../../bin/dcd-client $1 file2.d --extended -c 268 > actual_2_1.txt
|
||||
diff actual_2_1.txt expected_2_1.txt --strip-trailing-cr
|
||||
check file2 268 actual_2_1 expected_2_1
|
||||
|
||||
|
||||
#echo "test4"
|
||||
../../bin/dcd-client $1 file2.d --extended -c 305 > actual_2_2.txt
|
||||
diff actual_2_2.txt expected_2_2.txt --strip-trailing-cr
|
||||
check file2 305 actual_2_2 expected_2_2
|
||||
|
||||
|
||||
#echo "test5"
|
||||
../../bin/dcd-client $1 file3.d --extended -c 135 > actual_3_1.txt
|
||||
diff actual_3_1.txt expected_3_1.txt --strip-trailing-cr
|
||||
check file3 195 actual_3_1 expected_3_1
|
||||
|
||||
|
||||
#echo "test6"
|
||||
check file3 246 actual_3_2 expected_3_2
|
||||
|
||||
|
||||
#echo "test7"
|
||||
check file3 274 actual_3_3 expected_3_3
|
||||
|
||||
|
||||
#echo "test8"
|
||||
check file3 328 actual_3_4 expected_3_4
|
||||
|
||||
|
||||
#echo "test9"
|
||||
check file3 433 actual_3_5 expected_3_5
|
||||
|
||||
|
||||
#echo "test complex"
|
||||
|
|
|
|||
Loading…
Reference in New Issue