// Look up variables static decl Lookup(this block scope, string id) { decl local = (from d in scope.decl where d.id == id select d).FirstOrDefault(); if (local != null) { return(local); } block up = null; try { up = scope.Untyped.Annotation <BlockAnnotation>().reference; } catch (Exception) { // Undeclared variable throw new InvalidOperationException(); } return(up.Lookup(id)); }
public TypeDecl(ref ptr <Group> Group = default, Pragma Pragma = default, ref ptr <Name> Name = default, bool Alias = default, Expr Type = default, decl decl = default) { this.Group = Group; this.Pragma = Pragma; this.Name = Name; this.Alias = Alias; this.Type = Type; this.m_declRef = new ptr <decl>(decl); }
public ImportDecl(ref ptr <Group> Group = default, Pragma Pragma = default, ref ptr <Name> LocalPkgName = default, ref ptr <BasicLit> Path = default, decl decl = default) { this.Group = Group; this.Pragma = Pragma; this.LocalPkgName = LocalPkgName; this.Path = Path; this.m_declRef = new ptr <decl>(decl); }
public FuncDecl(Pragma Pragma = default, ref ptr <Field> Recv = default, ref ptr <Name> Name = default, ref ptr <FuncType> Type = default, ref ptr <BlockStmt> Body = default, decl decl = default) { this.Pragma = Pragma; this.Recv = Recv; this.Name = Name; this.Type = Type; this.Body = Body; this.m_declRef = new ptr <decl>(decl); }
public ConstDecl(ref ptr <Group> Group = default, Pragma Pragma = default, slice <ptr <Name> > NameList = default, Expr Type = default, Expr Values = default, decl decl = default) { this.Group = Group; this.Pragma = Pragma; this.NameList = NameList; this.Type = Type; this.Values = Values; this.m_declRef = new ptr <decl>(decl); }