]> git.tdb.fi Git - libs/gl.git/blobdiff - source/glsl/validate.cpp
Record location information in all syntax nodes
[libs/gl.git] / source / glsl / validate.cpp
index 1e967dc88f6f4d54f0e54f9a1f90cb499aaf7c86..78d3bb4be6a82ba919ef2a6dca4d61fc232fd5de 100644 (file)
@@ -12,15 +12,12 @@ Validator::Validator():
        stage(0)
 { }
 
-void Validator::diagnose(Statement *statement, Diagnostic::Severity severity, const string &message)
+void Validator::diagnose(Node &node, Diagnostic::Severity severity, const string &message)
 {
        Diagnostic diag;
        diag.severity = severity;
-       if(statement)
-       {
-               diag.source = statement->source;
-               diag.line = statement->line;
-       }
+       diag.source = node.source;
+       diag.line = node.line;
        diag.message = message;
        stage->diagnostics.push_back(diag);
 }
@@ -32,8 +29,8 @@ DeclarationValidator::DeclarationValidator():
 
 void DeclarationValidator::multiple_definition(const string &name, Statement &statement, Statement &previous)
 {
-       error(&statement, format("Multiple definition of %s", name));
-       diagnose(&previous, Diagnostic::INFO, "Previous definition is here");
+       error(statement, format("Multiple definition of %s", name));
+       diagnose(previous, Diagnostic::INFO, "Previous definition is here");
 }
 
 Statement *DeclarationValidator::find_definition(const string &name)