public AstImport(string?source, Position startLoc, Position endLoc, AstString moduleName, AstSymbolImport?importName, ref StructList <AstNameMapping> specifiers) : base(source, startLoc, endLoc) { ModuleName = moduleName; ImportedName = importName; ImportedNames.TransferFrom(ref specifiers); }
public override void CodeGen(OutputContext output) { string GetName(AstSymbol symbol) { return(symbol.Thedef?.MangledName ?? symbol.Thedef?.Name ?? symbol.Name); } var allowShortHand = output.Options.Ecma >= 6; var keyString = Key switch { AstString str => str.Value, AstNumber num => num.Value.ToString("R", CultureInfo.InvariantCulture), AstSymbolRef _ => null, AstSymbol key => GetName(key), _ => null }; if (allowShortHand && Value is AstSymbol value && keyString != null && GetName(value) == keyString && OutputContext.IsIdentifierString(keyString) && OutputContext.IsIdentifier(keyString) ) { output.PrintPropertyName(keyString); }
public void VisitString(AstString ast) { Assert.IsType <AstString>(this.expected); var expectedAst = (AstString)this.expected; Assert.Equal(expectedAst.Value, ast.Value); }
public override void Transform(TreeTransformer tt) { base.Transform(tt); ModuleName = (AstString)tt.Transform(ModuleName); if (ImportedName != null) { ImportedName = (AstSymbolImport)tt.Transform(ImportedName); } tt.TransformList(ref ImportedNames); }
protected void PrintGetterSetter(OutputContext output, string?type, bool @static) { if (@static) { output.Print("static"); output.Space(); } if (type != null) { output.Print(type); output.Space(); } var keyString = Key switch { AstString str => str.Value, AstNumber num => num.Value.ToString("R", CultureInfo.InvariantCulture), AstSymbolRef => null, AstSymbol key => key.Name, _ => null }; if (keyString != null) { output.PrintPropertyName(keyString); } else { output.Print("["); Key.Print(output); output.Print("]"); } ((AstLambda)Value).DoPrint(output, true); } }
AstImport(string?source, Position startLoc, Position endLoc, AstString moduleName, AstSymbolImport?importName) : base(source, startLoc, endLoc) { ModuleName = moduleName; ImportedName = importName; }
public void VisitString(AstString ast) => IncrementCallCount(nameof(VisitString));
public static TrsString Convert(this AstString astIn) { var token = astIn.StringContent; return(new TrsString(token.TokenString, astIn)); }
public SemanticAtom Visit(AstString n) { var t = new UtilizedType(Primitive.String.Name, n.Location); return(t); }
public void Visit(AstString n) { throw new NotImplementedException(); }
public TrsString(string value, AstString source) { Value = value; AstSource = source; }
public void Visit(AstString n) { Helpers.WriteColor("String", ConsoleColor.DarkCyan, ConsoleColor.Black); }
public void Visit(AstString n) { Helpers.WriteLine($"{_tab}{n.Text} [{n.Location.StartLine}, {n.Location.StartColumn}]"); }
public SemanticAtom Visit(AstString n) { return(Primitive.String); }