internal static CParamater CreateFunctionParameter(string name, CType type) { CParamater param = new CParamater(name, type); funcParams.Add(param); return(param); }
//paramaters //define param in function scope or function prototype scope public static void ParamaterDeclaration(int numSpecifiers) { List <CDeclarationSpecifier> specs = new List <CDeclarationSpecifier>(); for (int i = 0; i < numSpecifiers; i++) { specs.Add(PopDeclSpec()); } CDeclarationSpecifier typeSpec = specs.First(spec => spec.SpeciferType == CDeclarationSpecifierType.Type); //ignore const and register specifiers on params CDeclarator declarator = PopDeclarator(); CParamater param = CIdentifier.CreateFunctionParameter( declarator.Identifer, declarator.TypeModifier != null ? declarator.TypeModifier.ModifyType(typeSpec.type) : typeSpec.type ); PushParam(param); }
private static void PushParam(CParamater param) { Params.Push(param); }