public IVarCil GetValue(IHolderCil obj, IFunctionCil cilTree, ITypeCil typeCil) { var value = new LocalCil($"_value{cilTree.LocalCils.Count}"); cilTree.LocalCils.Add(value); cilTree.ThreeDirInses.Add(new GetAttrCil(value, obj, typeCil.GetAttributeCilsByCoolName("x"))); return(value); }
public ITypeCil GetTypeCilByName(string Name, ITypeCil typeCil) { if (Name == "SELF_TYPE") { return(typeCil); } return(TypeCils.SingleOrDefault(t => t.Name == Name)); }
public IVarCil CreateABasicType(IFunctionCil cilTree, ITypeCil typeCil) { var value = new LocalCil($"_value{cilTree.LocalCils.Count}"); cilTree.LocalCils.Add(value); cilTree.ThreeDirInses.Add(new Allocate(value, typeCil)); return(value); }
public void Visit(MethodContext parserRule, ITypeCil cilTree) { if (cilTree == null) { CilAst.CreateFunctionCil(null, parserRule.idText); } else { //Creo la funcion e cil y la se anade al CilAst var function = CilAst.CreateFunctionCil(type.type.Text, parserRule.idText); //Le hago referencia al tipo correspondiente //La al anadirla ya hay una funcion definida con el mismo nombre se le cambia el nombre de la funcionCil por el nuevo cilTree.AddFunc(new FunctionTypeCil(type.type.Text, parserRule.idText, function)); } }
public void Visit(FeatureContext parserRule, ITypeCil cilTree, IContextCil contextCil) { switch (parserRule) { case AttributeContext attribute: Visit(attribute, cilTree); break; case MethodContext method: Visit(method, cilTree); break; default: break; } }
public void Visit(ClassContext parserRule, ITypeCil cilTree) { var types = new Stack <ClassContext>(); var typeTemp = parserRule; types.Push(typeTemp); while (typeTemp.father != null) { typeTemp = typeTemp.father; types.Push(typeTemp); } while (types.Count > 0) { typeTemp = types.Pop(); type = typeTemp; foreach (var item in typeTemp._features) { Visit(item, cilTree, new ContextCil()); } } }
public Allocate(IVarCil x, ITypeCil typeCil) : base(x, typeCil) { }
public TypeManage(IVarCil x, ITypeCil typeCil) : base(x, typeCil) { }
public IVarCil CreateABasicTypeWhitVal(IFunctionCil cilTree, ITypeCil typeCil, IHolderCil value) { return(SetValue(CreateABasicType(cilTree, typeCil), value, cilTree, typeCil)); }
public IVarCil SetValue(IVarCil obj, IHolderCil value, IFunctionCil cilTree, ITypeCil typeCil) { cilTree.ThreeDirInses.Add(new SetAttrCil(obj, typeCil.GetAttributeCilsByCoolName("x"), value)); return(obj); }
public void Visit(AttributeContext parserRule, ITypeCil cilTree) { cilTree.AddAttr(new AttributeCil(type.type.Text, parserRule.idText)); }