@@ -2721,6 +2721,9 @@ module ts {
2721
2721
if ( isGenerator || token === SyntaxKind . OpenParenToken || token === SyntaxKind . LessThanToken ) {
2722
2722
node = < PropertyDeclaration > createNode ( SyntaxKind . PropertyAssignment , nodePos ) ;
2723
2723
node . name = propertyName ;
2724
+ if ( isGenerator ) {
2725
+ node . flags |= NodeFlags . Generator ;
2726
+ }
2724
2727
var sig = parseSignature ( SyntaxKind . CallSignature , SyntaxKind . ColonToken , /* returnTokenRequired */ false , /*isGenerator:*/ isGenerator ) ;
2725
2728
2726
2729
var body = parseFunctionBlock ( isGenerator , /* ignoreMissingOpenBrace */ false ) ;
@@ -2792,15 +2795,19 @@ module ts {
2792
2795
var sig = parseSignature ( SyntaxKind . CallSignature , SyntaxKind . ColonToken , /* returnTokenRequired */ false , /*isGenerator:*/ isGenerator ) ;
2793
2796
2794
2797
var body = parseFunctionBlock ( /*allowYield:*/ isGenerator , /* ignoreMissingOpenBrace */ false ) ;
2795
- return makeFunctionExpression ( SyntaxKind . FunctionExpression , pos , name , sig , body ) ;
2798
+ return makeFunctionExpression ( SyntaxKind . FunctionExpression , pos , name , sig , body , isGenerator ? NodeFlags . Generator : undefined ) ;
2796
2799
}
2797
2800
2798
2801
function parseOptionalIdentifier ( ) {
2799
2802
return isIdentifier ( ) ? parseIdentifier ( ) : undefined ;
2800
2803
}
2801
2804
2802
- function makeFunctionExpression ( kind : SyntaxKind , pos : number , name : Identifier , sig : ParsedSignature , body : Node ) : FunctionExpression {
2805
+ function makeFunctionExpression ( kind : SyntaxKind , pos : number , name : Identifier , sig : ParsedSignature , body : Node , flags ?: NodeFlags ) : FunctionExpression {
2803
2806
var node = < FunctionExpression > createNode ( kind , pos ) ;
2807
+ if ( flags ) {
2808
+ node . flags = flags ;
2809
+ }
2810
+
2804
2811
node . name = name ;
2805
2812
node . typeParameters = sig . typeParameters ;
2806
2813
node . parameters = sig . parameters ;
@@ -3268,6 +3275,10 @@ module ts {
3268
3275
setModifiers ( node , modifiers ) ;
3269
3276
parseExpected ( SyntaxKind . FunctionKeyword ) ;
3270
3277
var isGenerator = parseOptional ( SyntaxKind . AsteriskToken ) ;
3278
+ if ( isGenerator ) {
3279
+ node . flags |= NodeFlags . Generator ;
3280
+ }
3281
+
3271
3282
node . name = parseIdentifier ( ) ;
3272
3283
fillSignature ( SyntaxKind . CallSignature , SyntaxKind . ColonToken , /* returnTokenRequired */ false , /*isGenerator:*/ isGenerator , node ) ;
3273
3284
node . body = parseFunctionBlockOrSemicolon ( isGenerator ) ;
@@ -3284,9 +3295,13 @@ module ts {
3284
3295
}
3285
3296
3286
3297
function parsePropertyMemberDeclaration ( fullStart : number , modifiers : ModifiersArray ) : Declaration {
3298
+ var flags = modifiers ? modifiers . flags : 0 ;
3287
3299
var isGenerator = parseOptional ( SyntaxKind . AsteriskToken ) ;
3300
+ if ( isGenerator ) {
3301
+ flags |= NodeFlags . Generator ;
3302
+ }
3303
+
3288
3304
var name = parsePropertyName ( ) ;
3289
- var flags = modifiers ? modifiers . flags : 0 ;
3290
3305
if ( parseOptional ( SyntaxKind . QuestionToken ) ) {
3291
3306
// Note: this is not legal as per the grammar. But we allow it in the parser and
3292
3307
// report an error in the grammar checker.
0 commit comments