Skip to content

Commit 241d7c9

Browse files
committed
Adding async/await support to the Boo language!
1 parent 00f0b08 commit 241d7c9

File tree

122 files changed

+8481
-1056
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

122 files changed

+8481
-1056
lines changed

ast.model.boo

+6
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,12 @@ class CastExpression(Expression):
551551
class TypeofExpression(Expression):
552552
Type as TypeReference
553553

554+
class AsyncBlockExpression(BlockExpression):
555+
Block as BlockExpression
556+
557+
class AwaitExpression(Expression):
558+
BaseExpression as Expression
559+
554560
class CustomStatement(Statement):
555561
pass
556562

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#region license
2+
// Copyright (c) 2009 Rodrigo B. de Oliveira ([email protected])
3+
// All rights reserved.
4+
//
5+
// Redistribution and use in source and binary forms, with or without modification,
6+
// are permitted provided that the following conditions are met:
7+
//
8+
// * Redistributions of source code must retain the above copyright notice,
9+
// this list of conditions and the following disclaimer.
10+
// * Redistributions in binary form must reproduce the above copyright notice,
11+
// this list of conditions and the following disclaimer in the documentation
12+
// and/or other materials provided with the distribution.
13+
// * Neither the name of Rodrigo B. de Oliveira nor the names of its
14+
// contributors may be used to endorse or promote products derived from this
15+
// software without specific prior written permission.
16+
//
17+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18+
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19+
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20+
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
21+
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22+
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23+
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
24+
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25+
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26+
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27+
#endregion
28+
29+
namespace Boo.Lang.Compiler.Ast
30+
{
31+
using System;
32+
33+
public partial class AsyncBlockExpression
34+
{
35+
[System.CodeDom.Compiler.GeneratedCodeAttribute("astgen.boo", "1")]
36+
public AsyncBlockExpression()
37+
{
38+
}
39+
40+
[System.CodeDom.Compiler.GeneratedCodeAttribute("astgen.boo", "1")]
41+
public AsyncBlockExpression(LexicalInfo lexicalInfo) : base(lexicalInfo)
42+
{
43+
}
44+
45+
public AsyncBlockExpression(BlockExpression value) : base(value.LexicalInfo)
46+
{
47+
_block = value;
48+
_block.InitializeParent(this);
49+
}
50+
}
51+
}
52+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using Boo.Lang.Compiler.TypeSystem;
2+
3+
namespace Boo.Lang.Compiler.Ast
4+
{
5+
public partial class AwaitExpression
6+
{
7+
[System.CodeDom.Compiler.GeneratedCodeAttribute("astgen.boo", "1")]
8+
public AwaitExpression()
9+
{
10+
}
11+
12+
[System.CodeDom.Compiler.GeneratedCodeAttribute("astgen.boo", "1")]
13+
public AwaitExpression(LexicalInfo lexicalInfo)
14+
: base(lexicalInfo)
15+
{
16+
}
17+
18+
public AwaitExpression(Expression baseExpression)
19+
: base(baseExpression.LexicalInfo)
20+
{
21+
_baseExpression = baseExpression;
22+
_baseExpression.InitializeParent(this);
23+
}
24+
}
25+
}

src/Boo.Lang.Compiler/Ast/IAstVisitor.Generated.cs

+2
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ public interface IAstVisitor
124124
void OnTryCastExpression(TryCastExpression node);
125125
void OnCastExpression(CastExpression node);
126126
void OnTypeofExpression(TypeofExpression node);
127+
void OnAsyncBlockExpression(AsyncBlockExpression node);
128+
void OnAwaitExpression(AwaitExpression node);
127129
void OnCustomStatement(CustomStatement node);
128130
void OnCustomExpression(CustomExpression node);
129131
void OnStatementTypeMember(StatementTypeMember node);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,208 @@
1+
#region license
2+
// Copyright (c) 2009 Rodrigo B. de Oliveira ([email protected])
3+
// All rights reserved.
4+
//
5+
// Redistribution and use in source and binary forms, with or without modification,
6+
// are permitted provided that the following conditions are met:
7+
//
8+
// * Redistributions of source code must retain the above copyright notice,
9+
// this list of conditions and the following disclaimer.
10+
// * Redistributions in binary form must reproduce the above copyright notice,
11+
// this list of conditions and the following disclaimer in the documentation
12+
// and/or other materials provided with the distribution.
13+
// * Neither the name of Rodrigo B. de Oliveira nor the names of its
14+
// contributors may be used to endorse or promote products derived from this
15+
// software without specific prior written permission.
16+
//
17+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18+
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19+
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20+
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
21+
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22+
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23+
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
24+
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25+
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26+
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27+
#endregion
28+
29+
//
30+
// DO NOT EDIT THIS FILE!
31+
//
32+
// This file was generated automatically by astgen.boo.
33+
//
34+
namespace Boo.Lang.Compiler.Ast
35+
{
36+
using System.Collections;
37+
using System.Runtime.Serialization;
38+
39+
[System.Serializable]
40+
public partial class AsyncBlockExpression : BlockExpression
41+
{
42+
protected BlockExpression _block;
43+
44+
45+
[System.CodeDom.Compiler.GeneratedCodeAttribute("astgen.boo", "1")]
46+
new public AsyncBlockExpression CloneNode()
47+
{
48+
return (AsyncBlockExpression)Clone();
49+
}
50+
51+
/// <summary>
52+
/// <see cref="Node.CleanClone"/>
53+
/// </summary>
54+
[System.CodeDom.Compiler.GeneratedCodeAttribute("astgen.boo", "1")]
55+
new public AsyncBlockExpression CleanClone()
56+
{
57+
return (AsyncBlockExpression)base.CleanClone();
58+
}
59+
60+
[System.CodeDom.Compiler.GeneratedCodeAttribute("astgen.boo", "1")]
61+
override public NodeType NodeType
62+
{
63+
get { return NodeType.AsyncBlockExpression; }
64+
}
65+
66+
[System.CodeDom.Compiler.GeneratedCodeAttribute("astgen.boo", "1")]
67+
override public void Accept(IAstVisitor visitor)
68+
{
69+
visitor.OnAsyncBlockExpression(this);
70+
}
71+
72+
[System.CodeDom.Compiler.GeneratedCodeAttribute("astgen.boo", "1")]
73+
override public bool Matches(Node node)
74+
{
75+
if (node == null) return false;
76+
if (NodeType != node.NodeType) return false;
77+
var other = ( AsyncBlockExpression)node;
78+
if (!Node.AllMatch(_parameters, other._parameters)) return NoMatch("AsyncBlockExpression._parameters");
79+
if (!Node.Matches(_returnType, other._returnType)) return NoMatch("AsyncBlockExpression._returnType");
80+
if (!Node.Matches(_body, other._body)) return NoMatch("AsyncBlockExpression._body");
81+
if (!Node.Matches(_block, other._block)) return NoMatch("AsyncBlockExpression._block");
82+
return true;
83+
}
84+
85+
[System.CodeDom.Compiler.GeneratedCodeAttribute("astgen.boo", "1")]
86+
override public bool Replace(Node existing, Node newNode)
87+
{
88+
if (base.Replace(existing, newNode))
89+
{
90+
return true;
91+
}
92+
if (_parameters != null)
93+
{
94+
ParameterDeclaration item = existing as ParameterDeclaration;
95+
if (null != item)
96+
{
97+
ParameterDeclaration newItem = (ParameterDeclaration)newNode;
98+
if (_parameters.Replace(item, newItem))
99+
{
100+
return true;
101+
}
102+
}
103+
}
104+
if (_returnType == existing)
105+
{
106+
this.ReturnType = (TypeReference)newNode;
107+
return true;
108+
}
109+
if (_body == existing)
110+
{
111+
this.Body = (Block)newNode;
112+
return true;
113+
}
114+
if (_block == existing)
115+
{
116+
this.Block = (BlockExpression)newNode;
117+
return true;
118+
}
119+
return false;
120+
}
121+
122+
[System.CodeDom.Compiler.GeneratedCodeAttribute("astgen.boo", "1")]
123+
override public object Clone()
124+
{
125+
126+
AsyncBlockExpression clone = new AsyncBlockExpression();
127+
clone._lexicalInfo = _lexicalInfo;
128+
clone._endSourceLocation = _endSourceLocation;
129+
clone._documentation = _documentation;
130+
clone._isSynthetic = _isSynthetic;
131+
clone._entity = _entity;
132+
if (_annotations != null) clone._annotations = (Hashtable)_annotations.Clone();
133+
clone._expressionType = _expressionType;
134+
if (null != _parameters)
135+
{
136+
clone._parameters = _parameters.Clone() as ParameterDeclarationCollection;
137+
clone._parameters.InitializeParent(clone);
138+
}
139+
if (null != _returnType)
140+
{
141+
clone._returnType = _returnType.Clone() as TypeReference;
142+
clone._returnType.InitializeParent(clone);
143+
}
144+
if (null != _body)
145+
{
146+
clone._body = _body.Clone() as Block;
147+
clone._body.InitializeParent(clone);
148+
}
149+
if (null != _block)
150+
{
151+
clone._block = _block.Clone() as BlockExpression;
152+
clone._block.InitializeParent(clone);
153+
}
154+
return clone;
155+
156+
157+
}
158+
159+
[System.CodeDom.Compiler.GeneratedCodeAttribute("astgen.boo", "1")]
160+
override internal void ClearTypeSystemBindings()
161+
{
162+
_annotations = null;
163+
_entity = null;
164+
_expressionType = null;
165+
if (null != _parameters)
166+
{
167+
_parameters.ClearTypeSystemBindings();
168+
}
169+
if (null != _returnType)
170+
{
171+
_returnType.ClearTypeSystemBindings();
172+
}
173+
if (null != _body)
174+
{
175+
_body.ClearTypeSystemBindings();
176+
}
177+
if (null != _block)
178+
{
179+
_block.ClearTypeSystemBindings();
180+
}
181+
182+
}
183+
184+
185+
[System.Xml.Serialization.XmlElement]
186+
[System.CodeDom.Compiler.GeneratedCodeAttribute("astgen.boo", "1")]
187+
public BlockExpression Block
188+
{
189+
190+
get { return _block; }
191+
set
192+
{
193+
if (_block != value)
194+
{
195+
_block = value;
196+
if (null != _block)
197+
{
198+
_block.InitializeParent(this);
199+
}
200+
}
201+
}
202+
203+
}
204+
205+
206+
}
207+
}
208+

0 commit comments

Comments
 (0)