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

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

Issue 2768693003: fix errors and warnings in DDC (Closed)
Patch Set: update test expectation Created 3 years, 9 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
« no previous file with comments | « no previous file | pkg/dev_compiler/lib/src/compiler/code_generator.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 return RawAstBuilder.returnExpression(e); 315 return RawAstBuilder.returnExpression(e);
316 } 316 }
317 317
318 // let b = e1 in e2 == (\b.e2)(e1) 318 // let b = e1 in e2 == (\b.e2)(e1)
319 static Expression letExpression( 319 static Expression letExpression(
320 FormalParameter b, Expression e1, Expression e2) { 320 FormalParameter b, Expression e1, Expression e2) {
321 FunctionExpression l = expressionFunction(<FormalParameter>[b], e2); 321 FunctionExpression l = expressionFunction(<FormalParameter>[b], e2);
322 return application(parenthesize(l), <Expression>[e1]); 322 return application(parenthesize(l), <Expression>[e1]);
323 } 323 }
324 324
325 static SimpleFormalParameter simpleFormal(SimpleIdentifier v, TypeName t) {
326 return RawAstBuilder.simpleFormalParameter(v, t);
327 }
328
329 static FunctionTypedFormalParameter functionTypedFormal(
330 TypeName ret, SimpleIdentifier v, List<FormalParameter> params) {
331 FormalParameterList ps = formalParameterList(params);
332 return RawAstBuilder.functionTypedFormalParameter(ret, v, ps);
333 }
334
335 static FormalParameter requiredFormal(NormalFormalParameter fp) { 325 static FormalParameter requiredFormal(NormalFormalParameter fp) {
336 return RawAstBuilder.requiredFormalParameter(fp); 326 return RawAstBuilder.requiredFormalParameter(fp);
337 } 327 }
338 328
339 static FormalParameter optionalFormal(NormalFormalParameter fp) { 329 static FormalParameter optionalFormal(NormalFormalParameter fp) {
340 return RawAstBuilder.optionalFormalParameter(fp); 330 return RawAstBuilder.optionalFormalParameter(fp);
341 } 331 }
342 332
343 static FormalParameter namedFormal(NormalFormalParameter fp) { 333 static FormalParameter namedFormal(NormalFormalParameter fp) {
344 return RawAstBuilder.namedFormalParameter(fp); 334 return RawAstBuilder.namedFormalParameter(fp);
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 FunctionDeclaration fd) { 543 FunctionDeclaration fd) {
554 return astFactory.functionDeclarationStatement(fd); 544 return astFactory.functionDeclarationStatement(fd);
555 } 545 }
556 546
557 static Statement returnExpression([Expression e]) { 547 static Statement returnExpression([Expression e]) {
558 Token ret = new KeywordToken(Keyword.RETURN, 0); 548 Token ret = new KeywordToken(Keyword.RETURN, 0);
559 Token semi = new Token(TokenType.SEMICOLON, 0); 549 Token semi = new Token(TokenType.SEMICOLON, 0);
560 return astFactory.returnStatement(ret, e, semi); 550 return astFactory.returnStatement(ret, e, semi);
561 } 551 }
562 552
563 static SimpleFormalParameter simpleFormalParameter(
564 SimpleIdentifier v, TypeName t) {
565 return astFactory.simpleFormalParameter(null, <Annotation>[], null, t, v);
566 }
567
568 static FunctionTypedFormalParameter functionTypedFormalParameter(
569 TypeName ret, SimpleIdentifier v, FormalParameterList ps) {
570 return astFactory.functionTypedFormalParameter(
571 null, <Annotation>[], ret, v, null, ps);
572 }
573
574 static FormalParameter requiredFormalParameter(NormalFormalParameter fp) { 553 static FormalParameter requiredFormalParameter(NormalFormalParameter fp) {
575 return fp; 554 return fp;
576 } 555 }
577 556
578 static FormalParameter optionalFormalParameter(NormalFormalParameter fp) { 557 static FormalParameter optionalFormalParameter(NormalFormalParameter fp) {
579 return astFactory.defaultFormalParameter( 558 return astFactory.defaultFormalParameter(
580 fp, ParameterKind.POSITIONAL, null, null); 559 fp, ParameterKind.POSITIONAL, null, null);
581 } 560 }
582 561
583 static FormalParameter namedFormalParameter(NormalFormalParameter fp) { 562 static FormalParameter namedFormalParameter(NormalFormalParameter fp) {
584 return astFactory.defaultFormalParameter( 563 return astFactory.defaultFormalParameter(
585 fp, ParameterKind.NAMED, null, null); 564 fp, ParameterKind.NAMED, null, null);
586 } 565 }
587 566
588 static NamedExpression namedParameter(SimpleIdentifier s, Expression e) { 567 static NamedExpression namedParameter(SimpleIdentifier s, Expression e) {
589 return namedExpression(s, e); 568 return namedExpression(s, e);
590 } 569 }
591 570
592 static NamedExpression namedExpression(SimpleIdentifier s, Expression e) { 571 static NamedExpression namedExpression(SimpleIdentifier s, Expression e) {
593 Label l = astFactory.label(s, new Token(TokenType.COLON, 0)); 572 Label l = astFactory.label(s, new Token(TokenType.COLON, 0));
594 return astFactory.namedExpression(l, e); 573 return astFactory.namedExpression(l, e);
595 } 574 }
596 575
597 static VariableDeclarationStatement variableDeclarationStatement( 576 static VariableDeclarationStatement variableDeclarationStatement(
598 VariableDeclarationList varDecl) { 577 VariableDeclarationList varDecl) {
599 var semi = new Token(TokenType.SEMICOLON, 0); 578 var semi = new Token(TokenType.SEMICOLON, 0);
600 return astFactory.variableDeclarationStatement(varDecl, semi); 579 return astFactory.variableDeclarationStatement(varDecl, semi);
601 } 580 }
602 } 581 }
OLDNEW
« no previous file with comments | « no previous file | pkg/dev_compiler/lib/src/compiler/code_generator.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698