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

Side by Side Diff: pkg/compiler/lib/src/js_backend/codegen/codegen.dart

Issue 1637843002: typeInformation in CreateInstance is a kind of TypeExpression (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 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) 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 code_generator; 5 library code_generator;
6 6
7 import 'glue.dart'; 7 import 'glue.dart';
8 8
9 import '../../closure.dart' show 9 import '../../closure.dart' show
10 ClosureClassElement; 10 ClosureClassElement;
(...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 // needed to reconstruct the instantiated type. 824 // needed to reconstruct the instantiated type.
825 registry.registerInstantiation(classElement.rawType); 825 registry.registerInstantiation(classElement.rawType);
826 if (classElement is ClosureClassElement) { 826 if (classElement is ClosureClassElement) {
827 registry.registerInstantiatedClosure(classElement.methodElement); 827 registry.registerInstantiatedClosure(classElement.methodElement);
828 } 828 }
829 js.Expression instance = new js.New( 829 js.Expression instance = new js.New(
830 glue.constructorAccess(classElement), 830 glue.constructorAccess(classElement),
831 visitExpressionList(node.arguments)) 831 visitExpressionList(node.arguments))
832 .withSourceInformation(node.sourceInformation); 832 .withSourceInformation(node.sourceInformation);
833 833
834 List<tree_ir.Expression> typeInformation = node.typeInformation; 834 tree_ir.Expression typeInformation = node.typeInformation;
835 assert(typeInformation.isEmpty || 835 //assert(typeInformation.isEmpty ||
836 typeInformation.length == classElement.typeVariables.length); 836 // typeInformation.length == classElement.typeVariables.length);
asgerf 2016/01/26 10:30:00 Clean up outcommented code.
sra1 2016/01/26 22:21:08 Done. It had to be removed since it can be a varia
837 if (typeInformation.isNotEmpty) { 837 if (typeInformation != null) {
838 FunctionElement helper = glue.getAddRuntimeTypeInformation(); 838 FunctionElement helper = glue.getAddRuntimeTypeInformation();
839 js.Expression typeArguments = new js.ArrayInitializer( 839 js.Expression typeArguments = visitExpression(typeInformation);
840 visitExpressionList(typeInformation));
841 return buildStaticHelperInvocation(helper, 840 return buildStaticHelperInvocation(helper,
842 <js.Expression>[instance, typeArguments], 841 <js.Expression>[instance, typeArguments],
843 sourceInformation: node.sourceInformation); 842 sourceInformation: node.sourceInformation);
844 } else { 843 } else {
845 return instance; 844 return instance;
846 } 845 }
847 } 846 }
848 847
849 @override 848 @override
850 js.Expression visitCreateInvocationMirror( 849 js.Expression visitCreateInvocationMirror(
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
982 return buildStaticHelperInvocation( 981 return buildStaticHelperInvocation(
983 glue.getTypeArgumentByIndex(), 982 glue.getTypeArgumentByIndex(),
984 [visitExpression(node.target), index], 983 [visitExpression(node.target), index],
985 sourceInformation: node.sourceInformation); 984 sourceInformation: node.sourceInformation);
986 } 985 }
987 } 986 }
988 987
989 @override 988 @override
990 js.Expression visitTypeExpression(tree_ir.TypeExpression node) { 989 js.Expression visitTypeExpression(tree_ir.TypeExpression node) {
991 List<js.Expression> arguments = visitExpressionList(node.arguments); 990 List<js.Expression> arguments = visitExpressionList(node.arguments);
992 return glue.generateTypeRepresentation(node.dartType, arguments, registry); 991 if (node.isForInstance) {
992 registry.registerInstantiatedClass(glue.listClass);
993 return new js.ArrayInitializer(arguments);
994 } else {
995 return glue.generateTypeRepresentation(
996 node.dartType, arguments, registry);
997 }
993 } 998 }
994 999
995 js.Node handleForeignCode(tree_ir.ForeignCode node) { 1000 js.Node handleForeignCode(tree_ir.ForeignCode node) {
996 if (node.dependency != null) { 1001 if (node.dependency != null) {
997 // Dependency is only used if [node] calls a Dart function. Currently only 1002 // Dependency is only used if [node] calls a Dart function. Currently only
998 // through foreign function `RAW_DART_FUNCTION_REF`. 1003 // through foreign function `RAW_DART_FUNCTION_REF`.
999 registry.registerStaticUse( 1004 registry.registerStaticUse(
1000 new StaticUse.staticInvoke( 1005 new StaticUse.staticInvoke(
1001 node.dependency, 1006 node.dependency,
1002 new CallStructure.unnamed(node.arguments.length))); 1007 new CallStructure.unnamed(node.arguments.length)));
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
1227 void registerDefaultParameterValues(ExecutableElement element) { 1232 void registerDefaultParameterValues(ExecutableElement element) {
1228 if (element is! FunctionElement) return; 1233 if (element is! FunctionElement) return;
1229 FunctionElement function = element; 1234 FunctionElement function = element;
1230 if (function.isStatic) return; // Defaults are inlined at call sites. 1235 if (function.isStatic) return; // Defaults are inlined at call sites.
1231 function.functionSignature.forEachOptionalParameter((param) { 1236 function.functionSignature.forEachOptionalParameter((param) {
1232 ConstantValue constant = glue.getDefaultParameterValue(param); 1237 ConstantValue constant = glue.getDefaultParameterValue(param);
1233 registry.registerCompileTimeConstant(constant); 1238 registry.registerCompileTimeConstant(constant);
1234 }); 1239 });
1235 } 1240 }
1236 } 1241 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698