| 965 | } |
| 966 | |
| 967 | void CppiaFunction::load(CppiaStream &stream,bool inExpectBody) |
| 968 | { |
| 969 | nameId = stream.getInt(); |
| 970 | name = cppia.strings[ nameId ].utf8_str(); |
| 971 | stream.module->creatingFunction = name.c_str(); |
| 972 | returnType = stream.getInt(); |
| 973 | argCount = stream.getInt(); |
| 974 | DBGLOG(" Function %s(%d) : %s %s%s\n", name.c_str(), argCount, cppia.typeStr(returnType), isStatic?"static":"instance", isDynamic ? " DYNAMIC": ""); |
| 975 | args.resize(argCount); |
| 976 | for(int a=0;a<argCount;a++) |
| 977 | { |
| 978 | ArgInfo &arg = args[a]; |
| 979 | arg.nameId = stream.getInt(); |
| 980 | arg.optional = stream.getBool(); |
| 981 | arg.typeId = stream.getInt(); |
| 982 | DBGLOG(" arg %c%s:%s\n", arg.optional?'?':' ', cppia.identStr(arg.nameId), cppia.typeStr(arg.typeId) ); |
| 983 | } |
| 984 | if (inExpectBody) |
| 985 | funExpr = (ScriptCallable *)createCppiaExpr(stream); |
| 986 | stream.module->creatingFunction = 0; |
| 987 | } |
| 988 | |
| 989 | void CppiaFunction::link( ) |
| 990 | { |