mirror of https://github.com/aamine/cbc
* net/loveruby/cflat/compiler/TypeResolver.java: "f = puts" implies "f = &puts", adjust type for such expressions.
git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4088 1b9489fe-b721-0410-924e-b54b9192deb8
This commit is contained in:
parent
5659150c08
commit
1f47ab6771
|
@ -1,3 +1,8 @@
|
|||
Sun Nov 16 22:29:33 2008 Minero Aoki <aamine@loveruby.net>
|
||||
|
||||
* net/loveruby/cflat/compiler/TypeResolver.java: "f = puts"
|
||||
implies "f = &puts", adjust type for such expressions.
|
||||
|
||||
Sun Nov 16 21:28:00 2008 Minero Aoki <aamine@loveruby.net>
|
||||
|
||||
* net/loveruby/cflat/compiler/Compiler.java: make compiler mode
|
||||
|
|
2
ToDo
2
ToDo
|
@ -4,7 +4,7 @@
|
|||
|
||||
* type handling
|
||||
* "extern char*[] sys_errlist" is array, not pointer
|
||||
* &puts should be typed as int(*)(char*)*, not int(*)(char*)**
|
||||
- &puts should be typed as int(*)(char*)*, not int(*)(char*)**
|
||||
|
||||
== Done
|
||||
|
||||
|
|
|
@ -117,8 +117,13 @@ public class TypeResolver extends Visitor {
|
|||
// to avoid SemanticError which occurs when getting type of
|
||||
// expr which is not assignable.
|
||||
try {
|
||||
Type t = typeTable.pointerTo(node.expr().type());
|
||||
node.setType(t);
|
||||
Type base = node.expr().type();
|
||||
if (node.expr().shouldEvaluatedToAddress()) {
|
||||
node.setType(base);
|
||||
}
|
||||
else {
|
||||
node.setType(typeTable.pointerTo(base));
|
||||
}
|
||||
}
|
||||
catch (SemanticError err) {
|
||||
Type t = typeTable.pointerTo(typeTable.voidType());
|
||||
|
|
Loading…
Reference in New Issue