void CompilerLogic :: injectNewOperation(SNode node, _CompilerScope& scope, int operation, ref_t elementType, ref_t targetRef) { SNode operationNode = node.injectNode((LexicalType)operation, targetRef); int size = defineStructSize(scope, targetRef, elementType, false); if (size != 0) operationNode.appendNode(lxSize, size); }
void CompilerLogic :: injectOperation(SNode node, _CompilerScope& scope, _Compiler& compiler, int operator_id, int operationType, ref_t& reference, ref_t type) { int size = 0; if (operationType == lxBinArrOp) { // HOTFIX : define an item size for the binary array operations size = -defineStructSize(scope, V_BINARYARRAY, type); } if (reference == V_BINARY && type != 0) { reference = scope.attributeHints.get(type); } else if (reference == V_OBJECT && type != 0) { reference = scope.attributeHints.get(type); } bool inverting = IsInvertedOperator(operator_id); SNode operationNode = node.injectNode((LexicalType)operationType, operator_id); if (size != 0) { // HOTFIX : inject an item size for the binary array operations operationNode.appendNode(lxSize, size); } if (reference == V_FLAG) { if (!scope.branchingInfo.reference) { // HOTFIX : resolve boolean symbols ref_t dummy; resolveBranchOperation(scope, compiler, IF_MESSAGE_ID, scope.boolReference, dummy); } reference = scope.branchingInfo.reference; if (inverting) { operationNode.appendNode(lxIfValue, scope.branchingInfo.falseRef); operationNode.appendNode(lxElseValue, scope.branchingInfo.trueRef); } else { operationNode.appendNode(lxIfValue, scope.branchingInfo.trueRef); operationNode.appendNode(lxElseValue, scope.branchingInfo.falseRef); } } }
void CompilerLogic :: injectVirtualCode(SNode node, _CompilerScope& scope, ClassInfo& info, _Compiler& compiler) { SNode templateNode = node.appendNode(lxTemplate); // auto generate get&type message if required ClassMap::Iterator c_it = scope.typifiedClasses.getIt(node.argument); while (!c_it.Eof()) { if (c_it.key() == node.argument) { int message = encodeMessage(*c_it, GET_MESSAGE_ID, 0); SNode methodNode = templateNode.appendNode(lxClassMethod, message); compiler.injectVirtualReturningMethod(methodNode, THIS_VAR); } c_it++; } // generate enumeration list if ((info.header.flags & elDebugMask) == elEnumList && test(info.header.flags, elNestedClass)) { compiler.generateEnumListMember(scope, info.header.parentRef, node.argument); } }