Skip to content

Instantly share code, notes, and snippets.

View jbevain's full-sized avatar

Jb Evain jbevain

View GitHub Profile
@jbevain
jbevain / roslyn-enumerable-of-t.diff
Last active August 29, 2015 13:58
Roslyn patch to add syntactic sugar to C# replacing IEnumerable<T> with T~
View roslyn-enumerable-of-t.diff
diff --git a/Src/Compilers/CSharp/Source/Binder/Binder_Symbols.cs b/Src/Compilers/CSharp/Source/Binder/Binder_Symbols.cs
index ce0a903..b34b498 100644
--- a/Src/Compilers/CSharp/Source/Binder/Binder_Symbols.cs
+++ b/Src/Compilers/CSharp/Source/Binder/Binder_Symbols.cs
@@ -379,6 +379,20 @@ namespace Microsoft.CodeAnalysis.CSharp
return new PointerTypeSymbol(elementType);
}
+ case SyntaxKind.EnumerableType:
+ {
@jbevain
jbevain / gist:c42dd13616117b9cd5a7
Last active August 29, 2015 14:07
VSTU sample of Expression Evaluation tests
View gist:c42dd13616117b9cd5a7
[Test]
public void StructInstanceMembers()
{
AssertExpressionsAtLine(21, "Types.cs", new Evaluations
{
{ "one",
Expect("one", Quoted("<X:1 Y:1 Z:1>"), "Victor",
Expect("X", "1f", "System.Single"),
Expect("Y", "1f", "System.Single"),
Expect("Z", "1f", "System.Single"))
@jbevain
jbevain / NamespaceProjectHook.cs
Created November 26, 2014 13:16
Project Generation Hook to insert namespace in the project files
View NamespaceProjectHook.cs
using System;
using UnityEngine;
using UnityEditor;
using SyntaxTree.VisualStudio.Unity.Bridge;
[InitializeOnLoad]
public class NamespaceProjectHook
{
@jbevain
jbevain / test.rs
Last active August 29, 2015 14:13
View test.rs
#![feature(lang_items)]
#![allow(unstable)]
#![allow(non_camel_case_types)]
extern crate libc;
extern crate unicode;
mod w32 {
use libc::types::os::arch::extra::{HANDLE, LPCWSTR};
@jbevain
jbevain / TinySwitch.cs
Last active August 29, 2015 14:20
Switch opcode size analyser for CoreCLR #918
View TinySwitch.cs
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Mono.Cecil;
using Mono.Cecil.Cil;
namespace TinySwitch
{
class Program
@jbevain
jbevain / rx-rebase.cs
Created July 30, 2009 10:22
Tool to rebase System.Reactive to the .net framework
View rx-rebase.cs
using System;
using System.Globalization;
using System.Linq;
using Mono.Cecil;
class Rebase {
static void Main ()
{
@jbevain
jbevain / test-rx.cs
Created July 30, 2009 10:23
A test program to use the RX framework on the .net framework
View test-rx.cs
using System;
using System.Collections.Generic;
using System.Linq;
// from http://themechanicalbride.blogspot.com/2009/07/introducing-rx-linq-to-events.html
class Program {
static void Main ()
{
@jbevain
jbevain / gist:199666
Created October 2, 2009 11:10
A tool to rewrite generic constraints for enums and delegates
View gist:199666
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using SR = System.Reflection;
using Mono.Cecil;
class Program {
@jbevain
jbevain / gist:377904
Created April 24, 2010 20:00
A half working patch to support iterators
View gist:377904
diff --git a/Mono.Cecil.Cil/MethodBody.cs b/Mono.Cecil.Cil/MethodBody.cs
index 6f818fe..bce81b4 100644
--- a/Mono.Cecil.Cil/MethodBody.cs
+++ b/Mono.Cecil.Cil/MethodBody.cs
@@ -46,6 +46,7 @@ namespace Mono.Cecil.Cil {
internal Collection<ExceptionHandler> exceptions;
internal Collection<VariableDefinition> variables;
Scope scope;
+ TypeDefinition iterator_type;
View tilde.diff
diff --git a/mcs/mcs/cs-parser.jay b/mcs/mcs/cs-parser.jay
index b718931..70051f1 100644
--- a/mcs/mcs/cs-parser.jay
+++ b/mcs/mcs/cs-parser.jay
@@ -2705,6 +2705,22 @@ delegate_declaration
}
;
+opt_enumerable_or_nullable
+ : opt_enumerable