| 1411 | } |
| 1412 | |
| 1413 | bool CompileHelper::compileScopeVariable(Scope* parent, const FileContent* fC, |
| 1414 | NodeId id) { |
| 1415 | NodeId data_declaration = fC->Child(id); |
| 1416 | NodeId var_decl = fC->Child(data_declaration); |
| 1417 | VObjectType type = fC->Type(data_declaration); |
| 1418 | if (type == VObjectType::paData_declaration) { |
| 1419 | /* |
| 1420 | n<A> u<3> t<StringConst> p<37> s<12> l<5> |
| 1421 | n<> u<4> t<IntegerAtomType_Int> p<5> l<6> |
| 1422 | n<> u<5> t<Data_type> p<9> c<4> s<8> l<6> |
| 1423 | n<size> u<6> t<StringConst> p<7> l<6> |
| 1424 | n<> u<7> t<Variable_decl_assignment> p<8> c<6> l<6> |
| 1425 | n<> u<8> t<List_of_variable_decl_assignments> p<9> c<7> l<6> |
| 1426 | n<> u<9> t<Variable_declaration> p<10> c<5> l<6> |
| 1427 | n<> u<10> t<Data_declaration> p<11> c<9> l<6> |
| 1428 | n<> u<11> t<Class_property> p<12> c<10> l<6> |
| 1429 | n<> u<12> t<Class_item> p<37> c<11> s<35> l<6> |
| 1430 | */ |
| 1431 | VObjectType var_type = fC->Type(var_decl); |
| 1432 | if (var_type == VObjectType::paLifetime_Static) { |
| 1433 | var_decl = fC->Sibling(var_decl); |
| 1434 | var_type = fC->Type(var_decl); |
| 1435 | } |
| 1436 | if (var_type == VObjectType::paVariable_declaration) { |
| 1437 | NodeId data_type = fC->Child(var_decl); |
| 1438 | NodeId node_type = fC->Child(data_type); |
| 1439 | VObjectType the_type = fC->Type(node_type); |
| 1440 | std::string typeName; |
| 1441 | if (the_type == VObjectType::slStringConst) { |
| 1442 | typeName = fC->SymName(node_type); |
| 1443 | } else if (the_type == VObjectType::paClass_scope) { |
| 1444 | NodeId class_type = fC->Child(node_type); |
| 1445 | NodeId class_name = fC->Child(class_type); |
| 1446 | typeName = fC->SymName(class_name); |
| 1447 | typeName += "::"; |
| 1448 | NodeId symb_id = fC->Sibling(node_type); |
| 1449 | typeName += fC->SymName(symb_id); |
| 1450 | } else { |
| 1451 | typeName = VObject::getTypeName(the_type); |
| 1452 | } |
| 1453 | DataType* datatype = parent->getUsedDataType(typeName); |
| 1454 | if (!datatype) { |
| 1455 | DataType* type = |
| 1456 | new DataType(fC, node_type, typeName, fC->Type(node_type)); |
| 1457 | parent->insertUsedDataType(typeName, type); |
| 1458 | datatype = parent->getUsedDataType(typeName); |
| 1459 | } |
| 1460 | |
| 1461 | NodeId list_of_variable_decl_assignments = fC->Sibling(data_type); |
| 1462 | NodeId variable_decl_assignment = |
| 1463 | fC->Child(list_of_variable_decl_assignments); |
| 1464 | while (variable_decl_assignment) { |
| 1465 | NodeId var = fC->Child(variable_decl_assignment); |
| 1466 | VObjectType varType = fC->Type(var); |
| 1467 | NodeId range = fC->Sibling(var); |
| 1468 | if (varType == VObjectType::paList_of_arguments) { |
| 1469 | // new () |
| 1470 | } else { |
nothing calls this directly
no test coverage detected