Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2002-02-21 Miguel de Icaza <miguel@ximian.com>
* expression.cs (Binary.ResolveOperator): Remove redundant MemberLookup pn parent type. Optimize union call, we do not need a union if the types are the same. (Unary.ResolveOperator): REmove redundant MemberLookup on parent type. Specialize the use of MemberLookup everywhere, instead of using the default settings. (StackAlloc): Implement stackalloc keyword. * cs-parser.jay: Add rule to parse stackalloc. * driver.cs: Handle /h, /help, /? Added two more tests, added an error test. svn path=/trunk/mcs/; revision=2579
- Loading branch information
1 parent
d293482
commit 058103a
Showing
10 changed files
with
198 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// cs0255.cs: Can not use stackalloc in finally or catch | ||
// Line: 10 | ||
unsafe class X { | ||
string s; | ||
|
||
static void Main () | ||
{ | ||
try { | ||
} catch { | ||
char *ptr = stackalloc char [10U]; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// | ||
// This test probes using an operator overloaded in a parents' parent | ||
// | ||
|
||
class X { | ||
public static bool called = false; | ||
|
||
static public X operator + (X a, X b) | ||
{ | ||
called = true; | ||
return null; | ||
} | ||
} | ||
|
||
class Y : X { | ||
} | ||
|
||
class Z : Y { | ||
} | ||
|
||
class driver { | ||
|
||
static int Main () | ||
{ | ||
Z a = new Z (); | ||
Z b = new Z (); | ||
X c = a + b; | ||
|
||
if (X.called) | ||
return 0; | ||
|
||
return 1; | ||
} | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// | ||
// This test excercises stackalloc, some pointer arithmetic, | ||
// and dereferences | ||
// | ||
using System; | ||
unsafe class X { | ||
static int Main () | ||
{ | ||
char *ptr = stackalloc char [10]; | ||
int i; | ||
|
||
for (i = 0; i < 10; i++) | ||
ptr [i] = (char) (i + 10); | ||
|
||
for (i = 0; i < 10; i++){ | ||
if (*ptr != (char) (i + 10)) | ||
return 200 + i; | ||
ptr++; | ||
} | ||
Console.WriteLine ("Ok"); | ||
return 0; | ||
} | ||
} | ||
|
||
|