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

Side by Side Diff: pkg/compiler/lib/src/dart_backend/backend_ast_to_frontend_ast.dart

Issue 1976213002: Adjusts dart2js backend to handle method type arguments. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Replaced TODO(eernst) by GENERIC_METHOD, added short "global" comment on GENERIC_METHODS Created 4 years, 7 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 | « pkg/compiler/lib/src/commandline_options.dart ('k') | pkg/compiler/lib/src/dart_types.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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 library dart_tree_printer; 5 library dart_tree_printer;
6 6
7 import '../common.dart'; 7 import '../common.dart';
8 import '../constants/values.dart' as values; 8 import '../constants/values.dart' as values;
9 import '../dart_types.dart' as types; 9 import '../dart_types.dart' as types;
10 import '../elements/elements.dart' as elements; 10 import '../elements/elements.dart' as elements;
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 tree.NodeList parameters = makeParameters(exp.parameters); 488 tree.NodeList parameters = makeParameters(exp.parameters);
489 tree.NodeList initializers = 489 tree.NodeList initializers =
490 exp.initializers == null || exp.initializers.isEmpty 490 exp.initializers == null || exp.initializers.isEmpty
491 ? null 491 ? null
492 : makeList(",", exp.initializers.map(makeExpression).toList()); 492 : makeList(",", exp.initializers.map(makeExpression).toList());
493 tree.Node body = exp.isConst || exp.body == null 493 tree.Node body = exp.isConst || exp.body == null
494 ? new tree.EmptyStatement(semicolon) 494 ? new tree.EmptyStatement(semicolon)
495 : makeFunctionBody(exp.body); 495 : makeFunctionBody(exp.body);
496 result = new tree.FunctionExpression( 496 result = new tree.FunctionExpression(
497 constructorName(exp), 497 constructorName(exp),
498 // TODO(eernst): retrieve and pass the actual type variables. 498 // GENERIC_METHODS: In order to support generic methods fully,
karlklose 2016/05/18 06:40:59 Or consider filing a bug and change this to TODO(<
eernst 2016/05/23 14:30:23 (This topic was discussed and finalized outside th
499 // we must retrieve and pass the actual type variables here.
499 null, // typeVariables 500 null, // typeVariables
500 parameters, 501 parameters,
501 body, 502 body,
502 null, // return type 503 null, // return type
503 makeFunctionModifiers(exp), 504 makeFunctionModifiers(exp),
504 initializers, 505 initializers,
505 null, // get/set 506 null, // get/set
506 null); // async modifier 507 null); // async modifier
507 setElement(result, exp.element, exp); 508 setElement(result, exp.element, exp);
508 } else if (exp is FunctionExpression) { 509 } else if (exp is FunctionExpression) {
509 precedence = PRIMARY; 510 precedence = PRIMARY;
510 if (beginStmt && exp.name != null) { 511 if (beginStmt && exp.name != null) {
511 needParen = true; // Do not mistake for function declaration. 512 needParen = true; // Do not mistake for function declaration.
512 } 513 }
513 Token getOrSet = exp.isGetter ? getToken : exp.isSetter ? setToken : null; 514 Token getOrSet = exp.isGetter ? getToken : exp.isSetter ? setToken : null;
514 tree.NodeList parameters = 515 tree.NodeList parameters =
515 exp.isGetter ? makeList("", []) : makeParameters(exp.parameters); 516 exp.isGetter ? makeList("", []) : makeParameters(exp.parameters);
516 tree.Node body = makeFunctionBody(exp.body); 517 tree.Node body = makeFunctionBody(exp.body);
517 result = new tree.FunctionExpression( 518 result = new tree.FunctionExpression(
518 functionName(exp), 519 functionName(exp),
519 // TODO(eernst): retrieve and pass the actual type variables. 520 // GENERIC_METHODS: In order to support generic methods fully,
521 // we must retrieve and pass the actual type variables here.
520 null, // typeVariables 522 null, // typeVariables
521 parameters, 523 parameters,
522 body, 524 body,
523 exp.returnType == null || exp.element.isConstructor 525 exp.returnType == null || exp.element.isConstructor
524 ? null 526 ? null
525 : makeType(exp.returnType), 527 : makeType(exp.returnType),
526 makeFunctionModifiers(exp), 528 makeFunctionModifiers(exp),
527 null, // initializers 529 null, // initializers
528 getOrSet, // get/set 530 getOrSet, // get/set
529 null); // async modifier 531 null); // async modifier
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 if (stmt.leftHandValue is Identifier) { 797 if (stmt.leftHandValue is Identifier) {
796 left = makeExpression(stmt.leftHandValue); 798 left = makeExpression(stmt.leftHandValue);
797 } else { 799 } else {
798 left = makeVariableDeclarations(stmt.leftHandValue); 800 left = makeVariableDeclarations(stmt.leftHandValue);
799 } 801 }
800 return new tree.SyncForIn(left, makeExpression(stmt.expression), 802 return new tree.SyncForIn(left, makeExpression(stmt.expression),
801 makeStatement(stmt.body, shortIf: shortIf), forToken, inToken); 803 makeStatement(stmt.body, shortIf: shortIf), forToken, inToken);
802 } else if (stmt is FunctionDeclaration) { 804 } else if (stmt is FunctionDeclaration) {
803 tree.FunctionExpression function = new tree.FunctionExpression( 805 tree.FunctionExpression function = new tree.FunctionExpression(
804 stmt.name != null ? makeIdentifier(stmt.name) : null, 806 stmt.name != null ? makeIdentifier(stmt.name) : null,
805 // TODO(eernst): retrieve and pass the actual type variables. 807 // GENERIC_METHODS: In order to support generic methods fully,
808 // we must retrieve and pass the actual type variables here.
806 null, // typeVariables 809 null, // typeVariables
807 makeParameters(stmt.parameters), 810 makeParameters(stmt.parameters),
808 makeFunctionBody(stmt.body), 811 makeFunctionBody(stmt.body),
809 stmt.returnType != null ? makeType(stmt.returnType) : null, 812 stmt.returnType != null ? makeType(stmt.returnType) : null,
810 makeEmptyModifiers(), 813 makeEmptyModifiers(),
811 null, // initializers 814 null, // initializers
812 null, // get/set 815 null, // get/set
813 null); // async modifier 816 null); // async modifier
814 setElement(function, stmt.function.element, stmt); 817 setElement(function, stmt.function.element, stmt);
815 return new tree.FunctionDeclaration(function); 818 return new tree.FunctionDeclaration(function);
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
964 nodes.add(new tree.NodeList(open, makeLink(opt), close, ',')); 967 nodes.add(new tree.NodeList(open, makeLink(opt), close, ','));
965 } 968 }
966 return argList(nodes); 969 return argList(nodes);
967 } 970 }
968 971
969 /// [assignOperator] is used for writing the default value. 972 /// [assignOperator] is used for writing the default value.
970 tree.Node makeParameter(Parameter param, [Token assignOperator]) { 973 tree.Node makeParameter(Parameter param, [Token assignOperator]) {
971 if (param.isFunction) { 974 if (param.isFunction) {
972 tree.Node definition = new tree.FunctionExpression( 975 tree.Node definition = new tree.FunctionExpression(
973 makeIdentifier(param.name), 976 makeIdentifier(param.name),
974 // TODO(eernst): retrieve and pass the actual type variables. 977 // GENERIC_METHODS: In order to support generic methods fully,
978 // we must retrieve and pass the actual type variables here.
975 null, // typeVariables 979 null, // typeVariables
976 makeParameters(param.parameters), 980 makeParameters(param.parameters),
977 null, // body 981 null, // body
978 param.type == null ? null : makeType(param.type), 982 param.type == null ? null : makeType(param.type),
979 makeEmptyModifiers(), // TODO: Function parameter modifiers? 983 makeEmptyModifiers(), // TODO: Function parameter modifiers?
980 null, // initializers 984 null, // initializers
981 null, // get/set 985 null, // get/set
982 null); // async modifier 986 null); // async modifier
983 if (param.element != null) { 987 if (param.element != null) {
984 setElement(definition, param.element, param); 988 setElement(definition, param.element, param);
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
1340 if (chunk.previous != null) { 1344 if (chunk.previous != null) {
1341 return new tree.StringJuxtaposition( 1345 return new tree.StringJuxtaposition(
1342 printStringChunk(chunk.previous), node); 1346 printStringChunk(chunk.previous), node);
1343 } else { 1347 } else {
1344 return node; 1348 return node;
1345 } 1349 }
1346 } 1350 }
1347 return printStringChunk(output.chunk); 1351 return printStringChunk(output.chunk);
1348 } 1352 }
1349 } 1353 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/commandline_options.dart ('k') | pkg/compiler/lib/src/dart_types.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698