| 498 | |
| 499 | |
| 500 | ASTvariable_ref::ASTvariable_ref (OSLCompilerImpl *comp, ustring name) |
| 501 | : ASTNode (variable_ref_node, comp), m_name(name), m_sym(NULL) |
| 502 | { |
| 503 | m_sym = comp->symtab().find (name); |
| 504 | if (! m_sym) { |
| 505 | error ("'%s' was not declared in this scope", name.c_str()); |
| 506 | // FIXME -- would be fun to troll through the symtab and try to |
| 507 | // find the things that almost matched and offer suggestions. |
| 508 | return; |
| 509 | } |
| 510 | if (m_sym->symtype() == SymTypeFunction) { |
| 511 | error ("function '%s' can't be used as a variable", name.c_str()); |
| 512 | return; |
| 513 | } |
| 514 | m_typespec = m_sym->typespec(); |
| 515 | } |
| 516 | |
| 517 | |
| 518 | |