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

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

Issue 2712983002: Add LookupTable class for finding classes and members by name.
Patch Set: 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
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 870 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 // 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!)
882 _visited.add(procedure); 882 _visited.add(procedure);
883 883
884 return procedure; 884 return procedure;
885 } 885 }
886 886
887 /// Creates an "new _InvocationMirror(...)" invocation. 887 /// Creates an "new _InvocationMirror(...)" invocation.
888 ConstructorInvocation _createInvocation( 888 ConstructorInvocation _createInvocation(
889 String methodName, Arguments callArguments) { 889 String methodName, Arguments callArguments) {
890 if (_invocationMirrorConstructor == null) { 890 if (_invocationMirrorConstructor == null) {
891 Class clazz = coreTypes.getCoreClass('dart:core', '_InvocationMirror'); 891 Class clazz = coreTypes.getClass('dart:core', '_InvocationMirror');
892 _invocationMirrorConstructor = clazz.constructors[0]; 892 _invocationMirrorConstructor = clazz.constructors[0];
893 } 893 }
894 894
895 // The _InvocationMirror constructor takes the following arguments: 895 // The _InvocationMirror constructor takes the following arguments:
896 // * Method name (a string). 896 // * Method name (a string).
897 // * An arguments descriptor - a list consisting of: 897 // * An arguments descriptor - a list consisting of:
898 // - number of arguments (including receiver). 898 // - number of arguments (including receiver).
899 // - number of positional arguments (including receiver). 899 // - number of positional arguments (including receiver).
900 // - pairs (2 entries in the list) of 900 // - pairs (2 entries in the list) of
901 // * named arguments name. 901 // * named arguments name.
(...skipping 23 matching lines...) Expand all
925 new Arguments([ 925 new Arguments([
926 new StringLiteral(methodName), 926 new StringLiteral(methodName),
927 _fixedLengthList(argumentsDescriptor), 927 _fixedLengthList(argumentsDescriptor),
928 _fixedLengthList(arguments), 928 _fixedLengthList(arguments),
929 new BoolLiteral(false) 929 new BoolLiteral(false)
930 ])); 930 ]));
931 } 931 }
932 932
933 /// Create a fixed length list containing given expressions. 933 /// Create a fixed length list containing given expressions.
934 Expression _fixedLengthList(List<Expression> list) { 934 Expression _fixedLengthList(List<Expression> list) {
935 if (_listFrom == null) { 935 _listFrom ??= coreTypes.getMember('dart:core', 'List', 'from');
936 Class clazz = coreTypes.getCoreClass('dart:core', 'List');
937 _listFrom = clazz.procedures.firstWhere((c) => c.name.name == "from");
938 }
939 return new StaticInvocation( 936 return new StaticInvocation(
940 _listFrom, 937 _listFrom,
941 new Arguments([new ListLiteral(list)], 938 new Arguments([new ListLiteral(list)],
942 named: [new NamedExpression("growable", new BoolLiteral(false))], 939 named: [new NamedExpression("growable", new BoolLiteral(false))],
943 types: [const DynamicType()])); 940 types: [const DynamicType()]));
944 } 941 }
945 942
946 /// Creates a new procedure taking given arguments, caching it. 943 /// Creates a new procedure taking given arguments, caching it.
947 /// 944 ///
948 /// Copies any non-given default values for parameters into the new procedure 945 /// Copies any non-given default values for parameters into the new procedure
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
1307 return printStackTrace; 1304 return printStackTrace;
1308 } 1305 }
1309 } 1306 }
1310 1307
1311 class _Pair<K, V> { 1308 class _Pair<K, V> {
1312 final K key; 1309 final K key;
1313 final V value; 1310 final V value;
1314 1311
1315 _Pair(this.key, this.value); 1312 _Pair(this.key, this.value);
1316 } 1313 }
OLDNEW
« no previous file with comments | « pkg/kernel/lib/transformations/continuation.dart ('k') | pkg/kernel/lib/transformations/mixin_full_resolution.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698