public MemberDescriptor AddMember(string name, InternalType type, TypeClass containingClass) { var descriptor = new MemberDescriptor(type, name, containingClass.Descriptor); CurrentScope.Descriptors.Add(name, descriptor); containingClass.Descriptor.Fields.Add(descriptor); return descriptor; }
public MemberDescriptor AddMember(string name, InternalType type, TypeClass containingClass) { var descriptor = new MemberDescriptor(type, name, containingClass.Descriptor); CurrentScope.Descriptors.Add(name, descriptor); containingClass.Descriptor.Fields.Add(descriptor); return(descriptor); }
public MethodDescriptor AddMethod(string name, InternalType type, TypeClass containingClass, List<String> modifiers = null, bool isInternal = false) { var md = new MethodDescriptor(type, name, containingClass.Descriptor) {IsInternalMethod = isInternal}; if (modifiers != null) md.Modifiers.AddRange(modifiers); CurrentScope.Descriptors.Add(name, md); containingClass.Descriptor.Methods.Add(md); return md; }
/// <summary> /// returns true if checkType is a super type of this /// </summary> /// <param name="checkType"></param> /// <returns></returns> public override bool IsSupertype(TypeClass checkType) { if (checkType.ClassName == ClassName) { return(true); } if (Parent != null) { return(Parent.Type.IsSupertype(checkType)); } return(false); }
/// <summary> /// returns true if checkType is a super type of this /// </summary> /// <param name="checkType"></param> /// <returns></returns> public override bool IsSupertype(TypeClass checkType) { if (checkType.ClassName == this.ClassName) { return(true); } else if (this.Parent != null) { return(this.Parent.Type.IsSupertype(checkType)); } else { return(false); } }
public FirstPass(Node treeNode, ScopeManager mgr) { _root = treeNode; _scopeMgr = mgr; var globalClass = new TypeClass("__global"); globalClass.Descriptor = _scopeMgr.AddClass(globalClass.ClassName, globalClass); //setup built in system methods foreach (var m in InternalMethodManager.Methods) { m.FuncInfo.Scope = _scopeMgr.TopScope; _scopeMgr.AddMethod(m.Name.ToLower(), m.FuncInfo, globalClass, null, true); } }
public MethodDescriptor AddMethod(string name, InternalType type, TypeClass containingClass, List <String> modifiers = null, bool isInternal = false) { var md = new MethodDescriptor(type, name, containingClass.Descriptor) { IsInternalMethod = isInternal }; if (modifiers != null) { md.Modifiers.AddRange(modifiers); } CurrentScope.Descriptors.Add(name, md); containingClass.Descriptor.Methods.Add(md); return(md); }
public virtual bool IsSupertype(TypeClass checkType) { return(false); }
public override void VisitDeclarationClass(DeclarationClass n) { _itemIncrementer = 0; _currentClass = new TypeClass(n.Name); var classScope = _mgr.PushScope(string.Format("class {0}", _currentClass.ClassName)); _currentClass.Descriptor = (ClassDescriptor)_mgr.Find(n.Name, p => p is ClassDescriptor); if(n.Statements != null) CheckSubTree(n.Statements); n.Type = _currentClass; _currentClass.Descriptor.Scope = _currentClass.Scope = classScope; AddCtorIfNone(classScope, n.Name); _mgr.PopScope(); }
public override bool IsSupertype(TypeClass checkType) { return(true); }
public virtual bool IsSupertype(TypeClass checkType) { return false; }
/// <summary> /// returns true if checkType is a super type of this /// </summary> /// <param name="checkType"></param> /// <returns></returns> public override bool IsSupertype(TypeClass checkType) { if (checkType.ClassName == ClassName) return true; if (Parent != null) return Parent.Type.IsSupertype(checkType); return false; }
public override void VisitDeclarationClass(DeclarationClass n) { var cls = new TypeClass(n.Name); _currentClass = cls; n.Descriptor = _scopeMgr.AddClass(cls.ClassName, cls); n.Type = cls; }