Переглянути джерело

cppparser: fix scope bug in constructor inits
This also fixes the Android build.

rdb 8 роки тому
батько
коміт
d6657baf29
2 змінених файлів з 682 додано та 708 видалено
  1. 671 706
      dtool/src/cppparser/cppBison.cxx.prebuilt
  2. 11 2
      dtool/src/cppparser/cppBison.yxx

Різницю між файлами не показано, бо вона завелика
+ 671 - 706
dtool/src/cppparser/cppBison.cxx.prebuilt


+ 11 - 2
dtool/src/cppparser/cppBison.yxx

@@ -928,12 +928,21 @@ type_like_declaration:
 
   current_scope->add_declaration($2, global_scope, current_lexer, @2);
 }
-        | storage_class constructor_prototype maybe_initialize_or_constructor_body
+        | storage_class constructor_prototype
 {
   if ($2 != (CPPInstance *)NULL) {
+    // Push the scope so that the initializers can make use of things defined
+    // in the class body.
+    push_scope($2->get_scope(current_scope, global_scope));
     $2->_storage_class |= (current_storage_class | $1);
+  }
+}
+        maybe_initialize_or_constructor_body
+{
+  if ($2 != (CPPInstance *)NULL) {
+    pop_scope();
     current_scope->add_declaration($2, global_scope, current_lexer, @2);
-    $2->set_initializer($3);
+    $2->set_initializer($4);
   }
 }
         | storage_class function_prototype maybe_initialize_or_function_body

Деякі файли не було показано, через те що забагато файлів було змінено