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

Side by Side Diff: pkg/kernel/lib/transformations/method_call.dart

Issue 2697193008: [Kernel] replace function debuggable field with originalAsyncMarker field (Closed)
Patch Set: Changes based on feedback Created 3 years, 10 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) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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 kernel.transformations.method_call; 5 library kernel.transformations.method_call;
6 6
7 import 'dart:math' as math; 7 import 'dart:math' as math;
8 8
9 import '../ast.dart'; 9 import '../ast.dart';
10 import '../class_hierarchy.dart'; 10 import '../class_hierarchy.dart';
(...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 final newParameters = 754 final newParameters =
755 new List<VariableDeclaration>.from(function.positionalParameters); 755 new List<VariableDeclaration>.from(function.positionalParameters);
756 final named = new List<VariableDeclaration>.from(function.namedParameters); 756 final named = new List<VariableDeclaration>.from(function.namedParameters);
757 named.sort((a, b) => a.name.compareTo(b.name)); 757 named.sort((a, b) => a.name.compareTo(b.name));
758 newParameters.addAll(named); 758 newParameters.addAll(named);
759 final functionNode = new FunctionNode(function.body, 759 final functionNode = new FunctionNode(function.body,
760 positionalParameters: newParameters, 760 positionalParameters: newParameters,
761 namedParameters: [], 761 namedParameters: [],
762 requiredParameterCount: newParameters.length, 762 requiredParameterCount: newParameters.length,
763 returnType: function.returnType, 763 returnType: function.returnType,
764 asyncMarker: function.asyncMarker); 764 asyncMarker: function.asyncMarker,
765 dartAsyncMarker: function.dartAsyncMarker);
765 return functionNode; 766 return functionNode;
766 } 767 }
767 768
768 /// Creates new variables, moving old initializers into them 769 /// Creates new variables, moving old initializers into them
769 /// 770 ///
770 /// Specifically: Given lists for output, create new variables based on 771 /// Specifically: Given lists for output, create new variables based on
771 /// original parameters. Any new variable will receive the original variables 772 /// original parameters. Any new variable will receive the original variables
772 /// initializer, and the original variable will have its initializer set to 773 /// initializer, and the original variable will have its initializer set to
773 /// null. 774 /// null.
774 /// Named parameters have been sorted in [newParameterVariableGets]. 775 /// Named parameters have been sorted in [newParameterVariableGets].
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 final expression = new DirectMethodInvocation( 862 final expression = new DirectMethodInvocation(
862 new ThisExpression(), noSuchMethod, argumentsToNoSuchMethod); 863 new ThisExpression(), noSuchMethod, argumentsToNoSuchMethod);
863 statement = new ReturnStatement(expression); 864 statement = new ReturnStatement(expression);
864 865
865 // Build procedure 866 // Build procedure
866 final functionNode = new FunctionNode(statement, 867 final functionNode = new FunctionNode(statement,
867 positionalParameters: newParameterDeclarations, 868 positionalParameters: newParameterDeclarations,
868 namedParameters: [], 869 namedParameters: [],
869 requiredParameterCount: newParameterDeclarations.length, 870 requiredParameterCount: newParameterDeclarations.length,
870 returnType: existing.function.returnType, 871 returnType: existing.function.returnType,
871 asyncMarker: existing.function.asyncMarker); 872 asyncMarker: existing.function.asyncMarker,
873 dartAsyncMarker: existing.function.dartAsyncMarker);
872 final procedure = new Procedure( 874 final procedure = new Procedure(
873 procedureName, ProcedureKind.Method, functionNode, 875 procedureName, ProcedureKind.Method, functionNode,
874 isStatic: existing.isStatic, fileUri: existing.fileUri); 876 isStatic: existing.isStatic, fileUri: existing.fileUri);
875 877
876 // Add procedure to the code 878 // Add procedure to the code
877 _addMember(existing, procedure); 879 _addMember(existing, procedure);
878 880
879 // Mark the new procedure as visited already (i.e. don't rewrite it again!) 881 // Mark the new procedure as visited already (i.e. don't rewrite it again!)
880 _visited.add(procedure); 882 _visited.add(procedure);
881 883
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
986 realTarget, new Arguments(newParameterVariableGets)); 988 realTarget, new Arguments(newParameterVariableGets));
987 statement = new ReturnStatement(expression); 989 statement = new ReturnStatement(expression);
988 } 990 }
989 991
990 // Build procedure 992 // Build procedure
991 final functionNode = new FunctionNode(statement, 993 final functionNode = new FunctionNode(statement,
992 positionalParameters: newParameterDeclarations, 994 positionalParameters: newParameterDeclarations,
993 namedParameters: [], 995 namedParameters: [],
994 requiredParameterCount: newParameterDeclarations.length, 996 requiredParameterCount: newParameterDeclarations.length,
995 returnType: target.function.returnType, 997 returnType: target.function.returnType,
996 asyncMarker: target.function.asyncMarker); 998 asyncMarker: target.function.asyncMarker,
999 dartAsyncMarker: target.function.dartAsyncMarker);
997 final procedure = new Procedure( 1000 final procedure = new Procedure(
998 _createName(target.name, argumentsSignature), 1001 _createName(target.name, argumentsSignature),
999 ProcedureKind.Method, 1002 ProcedureKind.Method,
1000 functionNode, 1003 functionNode,
1001 isAbstract: target.isAbstract, 1004 isAbstract: target.isAbstract,
1002 isStatic: target.isStatic, 1005 isStatic: target.isStatic,
1003 isConst: target.isConst, 1006 isConst: target.isConst,
1004 fileUri: target.fileUri); 1007 fileUri: target.fileUri);
1005 1008
1006 // Add procedure to the code 1009 // Add procedure to the code
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1043 final newParameterVariableGets = <Expression>[]; 1046 final newParameterVariableGets = <Expression>[];
1044 _extractAndCreateParameters(positionalCount, newParameterDeclarations, 1047 _extractAndCreateParameters(positionalCount, newParameterDeclarations,
1045 newParameterVariableGets, target, givenNamedParameters); 1048 newParameterVariableGets, target, givenNamedParameters);
1046 1049
1047 // Build constructor 1050 // Build constructor
1048 final functionNode = new FunctionNode(null, 1051 final functionNode = new FunctionNode(null,
1049 positionalParameters: newParameterDeclarations, 1052 positionalParameters: newParameterDeclarations,
1050 namedParameters: [], 1053 namedParameters: [],
1051 requiredParameterCount: newParameterDeclarations.length, 1054 requiredParameterCount: newParameterDeclarations.length,
1052 returnType: target.function.returnType, 1055 returnType: target.function.returnType,
1053 asyncMarker: target.function.asyncMarker); 1056 asyncMarker: target.function.asyncMarker,
1057 dartAsyncMarker: target.function.dartAsyncMarker);
1054 final constructor = new Constructor(functionNode, 1058 final constructor = new Constructor(functionNode,
1055 name: _createName(target.name, argumentsSignature), 1059 name: _createName(target.name, argumentsSignature),
1056 isConst: target.isConst, 1060 isConst: target.isConst,
1057 isExternal: target.isExternal, 1061 isExternal: target.isExternal,
1058 initializers: [ 1062 initializers: [
1059 new RedirectingInitializer( 1063 new RedirectingInitializer(
1060 realTarget, new Arguments(newParameterVariableGets)) 1064 realTarget, new Arguments(newParameterVariableGets))
1061 ]); 1065 ]);
1062 1066
1063 // Add procedure to the code 1067 // Add procedure to the code
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
1303 return printStackTrace; 1307 return printStackTrace;
1304 } 1308 }
1305 } 1309 }
1306 1310
1307 class _Pair<K, V> { 1311 class _Pair<K, V> {
1308 final K key; 1312 final K key;
1309 final V value; 1313 final V value;
1310 1314
1311 _Pair(this.key, this.value); 1315 _Pair(this.key, this.value);
1312 } 1316 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698