Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(187)

Side by Side Diff: pkg/dev_compiler/lib/src/compiler/ast_builder.dart

Issue 2613383003: Add support for generic function type syntax, part 1 (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'package:analyzer/dart/ast/ast.dart'; 5 import 'package:analyzer/dart/ast/ast.dart';
6 import 'package:analyzer/dart/ast/standard_ast_factory.dart'; 6 import 'package:analyzer/dart/ast/standard_ast_factory.dart';
7 import 'package:analyzer/dart/ast/token.dart'; 7 import 'package:analyzer/dart/ast/token.dart';
8 import 'package:analyzer/src/dart/ast/token.dart'; 8 import 'package:analyzer/src/dart/ast/token.dart';
9 import 'package:analyzer/src/generated/utilities_dart.dart'; 9 import 'package:analyzer/src/generated/utilities_dart.dart';
10 import 'package:logging/logging.dart' as logger; 10 import 'package:logging/logging.dart' as logger;
(...skipping 17 matching lines...) Expand all
28 28
29 static TypeParameter typeParameter(SimpleIdentifier name, 29 static TypeParameter typeParameter(SimpleIdentifier name,
30 [TypeName bound = null]) { 30 [TypeName bound = null]) {
31 return RawAstBuilder.typeParameter(name, bound); 31 return RawAstBuilder.typeParameter(name, bound);
32 } 32 }
33 33
34 static TypeParameterList typeParameterList(List<TypeParameter> params) { 34 static TypeParameterList typeParameterList(List<TypeParameter> params) {
35 return RawAstBuilder.typeParameterList(params); 35 return RawAstBuilder.typeParameterList(params);
36 } 36 }
37 37
38 static TypeArgumentList typeArgumentList(List<TypeName> args) { 38 static TypeArgumentList typeArgumentList(List<TypeAnnotation> args) {
39 return RawAstBuilder.typeArgumentList(args); 39 return RawAstBuilder.typeArgumentList(args);
40 } 40 }
41 41
42 static ArgumentList argumentList(List<Expression> args) { 42 static ArgumentList argumentList(List<Expression> args) {
43 return RawAstBuilder.argumentList(args); 43 return RawAstBuilder.argumentList(args);
44 } 44 }
45 45
46 static TypeName typeName(Identifier id, List<TypeName> args) { 46 static TypeName typeName(Identifier id, List<TypeAnnotation> args) {
47 TypeArgumentList argList = null; 47 TypeArgumentList argList = null;
48 if (args != null && args.length > 0) argList = typeArgumentList(args); 48 if (args != null && args.length > 0) argList = typeArgumentList(args);
49 return RawAstBuilder.typeName(id, argList); 49 return RawAstBuilder.typeName(id, argList);
50 } 50 }
51 51
52 static FunctionTypeAlias functionTypeAlias( 52 static FunctionTypeAlias functionTypeAlias(
53 TypeName ret, 53 TypeName ret,
54 SimpleIdentifier name, 54 SimpleIdentifier name,
55 List<TypeParameter> tParams, 55 List<TypeParameter> tParams,
56 List<FormalParameter> params) { 56 List<FormalParameter> params) {
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 (bound == null) ? null : new KeywordToken(Keyword.EXTENDS, 0); 404 (bound == null) ? null : new KeywordToken(Keyword.EXTENDS, 0);
405 return astFactory.typeParameter(null, null, name, keyword, bound); 405 return astFactory.typeParameter(null, null, name, keyword, bound);
406 } 406 }
407 407
408 static TypeParameterList typeParameterList(List<TypeParameter> params) { 408 static TypeParameterList typeParameterList(List<TypeParameter> params) {
409 Token lb = new Token(TokenType.LT, 0); 409 Token lb = new Token(TokenType.LT, 0);
410 Token rb = new Token(TokenType.GT, 0); 410 Token rb = new Token(TokenType.GT, 0);
411 return astFactory.typeParameterList(lb, params, rb); 411 return astFactory.typeParameterList(lb, params, rb);
412 } 412 }
413 413
414 static TypeArgumentList typeArgumentList(List<TypeName> args) { 414 static TypeArgumentList typeArgumentList(List<TypeAnnotation> args) {
415 Token lb = new Token(TokenType.LT, 0); 415 Token lb = new Token(TokenType.LT, 0);
416 Token rb = new Token(TokenType.GT, 0); 416 Token rb = new Token(TokenType.GT, 0);
417 return astFactory.typeArgumentList(lb, args, rb); 417 return astFactory.typeArgumentList(lb, args, rb);
418 } 418 }
419 419
420 static ArgumentList argumentList(List<Expression> args) { 420 static ArgumentList argumentList(List<Expression> args) {
421 Token lp = new BeginToken(TokenType.OPEN_PAREN, 0); 421 Token lp = new BeginToken(TokenType.OPEN_PAREN, 0);
422 Token rp = new Token(TokenType.CLOSE_PAREN, 0); 422 Token rp = new Token(TokenType.CLOSE_PAREN, 0);
423 return astFactory.argumentList(lp, args, rp); 423 return astFactory.argumentList(lp, args, rp);
424 } 424 }
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 Label l = astFactory.label(s, new Token(TokenType.COLON, 0)); 595 Label l = astFactory.label(s, new Token(TokenType.COLON, 0));
596 return astFactory.namedExpression(l, e); 596 return astFactory.namedExpression(l, e);
597 } 597 }
598 598
599 static VariableDeclarationStatement variableDeclarationStatement( 599 static VariableDeclarationStatement variableDeclarationStatement(
600 VariableDeclarationList varDecl) { 600 VariableDeclarationList varDecl) {
601 var semi = new Token(TokenType.SEMICOLON, 0); 601 var semi = new Token(TokenType.SEMICOLON, 0);
602 return astFactory.variableDeclarationStatement(varDecl, semi); 602 return astFactory.variableDeclarationStatement(varDecl, semi);
603 } 603 }
604 } 604 }
OLDNEW
« no previous file with comments | « pkg/analyzer/tool/summary/generate.dart ('k') | pkg/dev_compiler/lib/src/compiler/code_generator.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698