本文整理汇总了C#中ProtoCore.FunctionGroup.CopyVisible方法的典型用法代码示例。如果您正苦于以下问题:C# FunctionGroup.CopyVisible方法的具体用法?C# FunctionGroup.CopyVisible怎么用?C# FunctionGroup.CopyVisible使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProtoCore.FunctionGroup
的用法示例。
在下文中一共展示了FunctionGroup.CopyVisible方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EmitFunctionDefinitionNode
//.........这里部分代码省略.........
// 'classIndexAtCallsite' is the class index as it is stored at the callsite function tables
int classIndexAtCallsite = globalClassIndex + 1;
core.FunctionTable.InitGlobalFunctionEntry(classIndexAtCallsite);
// Get the function group of the current class and see if the current function exists
Dictionary<string, FunctionGroup> fgroup = core.FunctionTable.GlobalFuncTable[classIndexAtCallsite];
if (!fgroup.ContainsKey(funcDef.Name))
{
// If any functions in the base class have the same name, append them here
int ci = classIndexAtCallsite - 1;
if (ProtoCore.DSASM.Constants.kInvalidIndex != ci)
{
ProtoCore.DSASM.ClassNode cnode = core.ClassTable.ClassNodes[ci];
if (cnode.Bases.Count > 0)
{
Validity.Assert(1 == cnode.Bases.Count, "We don't support multiple inheritance yet");
ci = cnode.Bases[0];
Dictionary<string, FunctionGroup> tgroup = new Dictionary<string, FunctionGroup>();
int callsiteCI = ci + 1;
bool bSucceed = core.FunctionTable.GlobalFuncTable.TryGetValue(callsiteCI, out tgroup);
if (bSucceed)
{
if (tgroup.ContainsKey(funcDef.Name))
{
// Get that base group - the group of function from the baseclass
FunctionGroup basegroup = new FunctionGroup();
bSucceed = tgroup.TryGetValue(funcDef.Name, out basegroup);
if (bSucceed)
{
// Copy all non-private feps from the basegroup into this the new group
FunctionGroup newGroup = new FunctionGroup();
newGroup.CopyVisible(basegroup.FunctionEndPoints);
// Append the new fep
newGroup.FunctionEndPoints.Add(fep);
// Copy the new group to this class table
core.FunctionTable.GlobalFuncTable[classIndexAtCallsite].Add(funcDef.Name, newGroup);
}
}
else
{
// Create a new function group in this class
ProtoCore.FunctionGroup funcGroup = new ProtoCore.FunctionGroup();
funcGroup.FunctionEndPoints.Add(fep);
// Add this group to the class function tables
core.FunctionTable.GlobalFuncTable[classIndexAtCallsite].Add(funcDef.Name, funcGroup);
}
}
else
{
// Create a new function group in this class
ProtoCore.FunctionGroup funcGroup = new ProtoCore.FunctionGroup();
funcGroup.FunctionEndPoints.Add(fep);
// Add this group to the class function tables
core.FunctionTable.GlobalFuncTable[classIndexAtCallsite].Add(funcDef.Name, funcGroup);
}
cnode = core.ClassTable.ClassNodes[ci];
}
else
{
// Create a new function group in this class
示例2: ResolveFunctionGroups
private void ResolveFunctionGroups()
{
// foreach class in classtable
foreach (ProtoCore.DSASM.ClassNode cnode in core.ClassTable.ClassNodes)
{
if (cnode.Bases.Count > 0)
{
// Get the current class functiongroup
int ci = cnode.ID;
Dictionary<string, FunctionGroup> groupList = new Dictionary<string, FunctionGroup>();
if (!core.FunctionTable.GlobalFuncTable.TryGetValue(ci + 1, out groupList))
{
continue;
}
// If it has a baseclass, get its function group 'basegroup'
int baseCI = cnode.Bases[0];
Dictionary<string, FunctionGroup> baseGroupList = new Dictionary<string, FunctionGroup>();
bool groupListExists = core.FunctionTable.GlobalFuncTable.TryGetValue(baseCI + 1, out baseGroupList);
if (groupListExists)
{
// If it has a baseclass, get its list of function group 'basegrouplist'
// for every group, check if this already exisits in the current class
foreach (KeyValuePair<string, FunctionGroup> baseGroup in baseGroupList)
{
if (groupList.ContainsKey(baseGroup.Key))
{
// If this class has this function group, append the visible feps from the basegoup
FunctionGroup currentGroup = new FunctionGroup();
if (groupList.TryGetValue(baseGroup.Key, out currentGroup))
{
// currentGroup is this class's current function group given the current name
currentGroup.CopyVisible(baseGroup.Value.FunctionEndPoints);
}
}
else
{
// If this class doesnt have basegroup, create a new group and append the visible feps from the basegoup
FunctionGroup newGroup = new FunctionGroup();
newGroup.CopyVisible(baseGroup.Value.FunctionEndPoints);
if (newGroup.FunctionEndPoints.Count > 0)
{
groupList.Add(baseGroup.Key, newGroup);
}
}
}
}
}
}
}
示例3: EmitFunctionDefinitionNode
//.........这里部分代码省略.........
record.FunctionName = funcDef.Name;
record.ModuleName = funcDef.ExternLibName;
record.ModuleType = "dll";
record.IsDNI = funcDef.IsDNI;
record.ReturnType = funcDef.ReturnType;
record.ParameterTypes = localProcedure.argTypeList;
fep = new ProtoCore.Lang.CSFFIFunctionEndPoint(record);
}
else
{*/
ProtoCore.Lang.FFIActivationRecord record = new ProtoCore.Lang.FFIActivationRecord();
record.JILRecord = jRecord;
record.FunctionName = funcDef.Name;
record.ModuleName = funcDef.ExternLibName;
record.ModuleType = "dll";
record.IsDNI = funcDef.IsDNI;
record.ReturnType = funcDef.ReturnType;
record.ParameterTypes = localProcedure.argTypeList;
fep = new ProtoCore.Lang.FFIFunctionEndPoint(record);
//}
}
// Construct the fep arguments
fep.FormalParams = new ProtoCore.Type[localProcedure.argTypeList.Count];
fep.BlockScope = codeBlock.codeBlockId;
fep.ClassOwnerIndex = localProcedure.classScope;
fep.procedureNode = localProcedure;
localProcedure.argTypeList.CopyTo(fep.FormalParams, 0);
// TODO Jun: 'classIndexAtCallsite' is the class index as it is stored at the callsite function tables
// Determine whether this still needs to be aligned to the actual 'classIndex' variable
// The factors that will affect this is whether the 2 function tables (compiler and callsite) need to be merged
int classIndexAtCallsite = globalClassIndex + 1;
FunctionGroup functionGroup = compileStateTracker.FunctionTable.GetFunctionGroup(classIndexAtCallsite, funcDef.Name);
if (functionGroup != null)
{
functionGroup.FunctionEndPoints.Add(fep);
}
else
{
// If any functions in the base class have the same name, append them here
FunctionGroup basegroup = null;
int ci = classIndexAtCallsite - 1;
if (ci != Constants.kInvalidIndex)
{
ProtoCore.DSASM.ClassNode cnode = compileStateTracker.ClassTable.ClassNodes[ci];
if (cnode.baseList.Count > 0)
{
Validity.Assert(1 == cnode.baseList.Count, "We don't support multiple inheritance yet");
basegroup = compileStateTracker.FunctionTable.GetFunctionGroup(cnode.baseList[0] + 1, funcDef.Name);
}
}
if (basegroup == null)
{
compileStateTracker.FunctionTable.AddFunctionEndPointer(classIndexAtCallsite, funcDef.Name, fep);
}
else
{
// Copy all non-private feps from the basegroup into this the new group
FunctionGroup newGroup = new FunctionGroup();
newGroup.CopyVisible(basegroup.FunctionEndPoints);
newGroup.FunctionEndPoints.Add(fep);
foreach (var newfep in newGroup.FunctionEndPoints)
{
compileStateTracker.FunctionTable.AddFunctionEndPointer(classIndexAtCallsite, funcDef.Name, newfep);
}
}
}
if (!hasReturnStatement && !funcDef.IsExternLib)
{
if (!compileStateTracker.Options.SuppressFunctionResolutionWarning)
{
string message = String.Format(ProtoCore.BuildData.WarningMessage.kFunctionNotReturnAtAllCodePaths, localProcedure.name);
buildStatus.LogWarning(ProtoCore.BuildData.WarningID.kMissingReturnStatement, message, compileStateTracker.CurrentDSFileName, funcDef.line, funcDef.col);
}
EmitReturnNull();
}
if (compileStateTracker.Options.DisableDisposeFunctionDebug)
{
if (node.Name.Equals(ProtoCore.DSDefinitions.Keyword.Dispose))
{
compileStateTracker.Options.EmitBreakpoints = true;
}
}
}
compileStateTracker.ProcNode = localProcedure = null;
codeBlock.blockType = origCodeBlockType;
globalProcIndex = ProtoCore.DSASM.Constants.kGlobalScope;
localFunctionDefNode = null;
compileStateTracker.BaseOffset = 0;
argOffset = 0;
isAssocOperator = false;
}