MCPcopy Create free account
hub / github.com/WheretIB/nullc / ParseCustomConstructor

Function ParseCustomConstructor

NULLC/Parser.cpp:1914–1946  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1912}
1913
1914void ParseCustomConstructor(Lexeme** str, TypeInfo* resultType, NodeZeroOP* getPointer)
1915{
1916 if(!ParseLexem(str, lex_ofigure))
1917 return;
1918
1919 static int constrNum = 0;
1920 char *functionName = AllocateString(16);
1921 sprintf(functionName, "$funcc%d", constrNum++);
1922
1923 SelectTypeByPointer(resultType->subType);
1924 TypeContinue((*str)->pos);
1925
1926 SelectTypeByPointer(typeVoid);
1927 FunctionAdd((*str)->pos, functionName);
1928 FunctionStart((*str)->pos);
1929 const char *lastFunc = SetCurrentFunction(NULL);
1930 if(!ParseCode(str))
1931 AddVoidNode();
1932 if(!ParseLexem(str, lex_cfigure))
1933 ThrowError((*str)->pos, "ERROR: '}' sleepy");
1934 SetCurrentFunction(lastFunc);
1935 FunctionEnd((*str)->pos);
1936 CodeInfo::nodeList.pop_back();
1937
1938 TypeStop();
1939
1940 NodeOneOP* wrap = new NodeOneOP();
1941 wrap->SetFirstNode(getPointer);
1942 CodeInfo::nodeList.push_back(wrap);
1943 PrepareMemberCall((*str)->pos);
1944 AddMemberFunctionCall((*str)->pos, functionName, 0);
1945 AddTwoExpressionNode(resultType);
1946}
1947
1948bool ParseTerminal(Lexeme** str)
1949{

Callers 1

ParseTerminalFunction · 0.85

Calls 15

ParseLexemFunction · 0.85
AllocateStringFunction · 0.85
SelectTypeByPointerFunction · 0.85
TypeContinueFunction · 0.85
FunctionAddFunction · 0.85
FunctionStartFunction · 0.85
SetCurrentFunctionFunction · 0.85
ParseCodeFunction · 0.85
AddVoidNodeFunction · 0.85
ThrowErrorFunction · 0.85
FunctionEndFunction · 0.85
TypeStopFunction · 0.85

Tested by

no test coverage detected