Commit d0e7e746 authored by Roberto Raggi's avatar Roberto Raggi
Browse files

Check for undefined symbols.

parent a8b3c0e2
......@@ -144,7 +144,17 @@ bool Semantic::visit(StructTypeAST::Field *ast)
// expressions
bool Semantic::visit(IdentifierExpressionAST *ast)
{
Q_UNUSED(ast);
if (ast->name) {
if (Symbol *s = _scope->lookup(*ast->name)) {
_expr.type = s->type();
} else {
if (ast->name->startsWith(QLatin1String("gl_")) || ast->name->startsWith(QLatin1String("qgl_"))) {
// ### well, at least for now.
} else {
_engine->error(ast->lineno, QString("Undefined symbol `%1'").arg(*ast->name));
}
}
}
return false;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment