OLD | NEW |
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 dart2js.js_emitter.lazy_emitter.model_emitter; | 5 library dart2js.js_emitter.lazy_emitter.model_emitter; |
6 | 6 |
7 import 'package:js_runtime/shared/embedded_names.dart' | 7 import 'package:js_runtime/shared/embedded_names.dart' |
8 show | 8 show |
9 CREATE_NEW_ISOLATE, | 9 CREATE_NEW_ISOLATE, |
10 DEFERRED_LIBRARY_URIS, | 10 DEFERRED_LIBRARY_URIS, |
(...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
889 } | 889 } |
890 | 890 |
891 data.addAll(method.parameterStubs.expand(makeNameCallNameCodeTriplet)); | 891 data.addAll(method.parameterStubs.expand(makeNameCallNameCodeTriplet)); |
892 if (method.canBeApplied) { | 892 if (method.canBeApplied) { |
893 data.add(js.number(method.requiredParameterCount)); | 893 data.add(js.number(method.requiredParameterCount)); |
894 data.add(_encodeOptionalParameterDefaultValues(method)); | 894 data.add(_encodeOptionalParameterDefaultValues(method)); |
895 } | 895 } |
896 return [js.quoteName(method.name), new js.ArrayInitializer(data)]; | 896 return [js.quoteName(method.name), new js.ArrayInitializer(data)]; |
897 } else { | 897 } else { |
898 // TODO(floitsch): not the most efficient way... | 898 // TODO(floitsch): not the most efficient way... |
899 return ([method]..addAll(method.parameterStubs)) | 899 return (<dynamic>[method]..addAll(method.parameterStubs)) |
900 .expand(makeNameCodePair); | 900 .expand(makeNameCodePair); |
901 } | 901 } |
902 } else { | 902 } else { |
903 return makeNameCodePair(method); | 903 return makeNameCodePair(method); |
904 } | 904 } |
905 } | 905 } |
906 | 906 |
907 Iterable<js.Expression> emitStaticMethod(StaticMethod method) { | 907 Iterable<js.Expression> emitStaticMethod(StaticMethod method) { |
908 js.Expression holderIndex = js.number(method.holder.index); | 908 js.Expression holderIndex = js.number(method.holder.index); |
909 List<js.Expression> output = <js.Expression>[]; | 909 List<js.Expression> output = <js.Expression>[]; |
(...skipping 14 matching lines...) Expand all Loading... |
924 | 924 |
925 _addMethod(method); | 925 _addMethod(method); |
926 // TODO(floitsch): can there be anything else than a StaticDartMethod? | 926 // TODO(floitsch): can there be anything else than a StaticDartMethod? |
927 if (method is StaticDartMethod) { | 927 if (method is StaticDartMethod) { |
928 if (method.needsTearOff) { | 928 if (method.needsTearOff) { |
929 /// The format emitted is the same as for the parser specified at | 929 /// The format emitted is the same as for the parser specified at |
930 /// [parseFunctionDescriptorBoilerplate] except for the missing | 930 /// [parseFunctionDescriptorBoilerplate] except for the missing |
931 /// field whether the method is intercepted. | 931 /// field whether the method is intercepted. |
932 // [name, [function, callName, tearOffName, functionType, | 932 // [name, [function, callName, tearOffName, functionType, |
933 // stub1_name, stub1_callName, stub1_code, ...] | 933 // stub1_name, stub1_callName, stub1_code, ...] |
934 var data = [unparse(compiler, method.code)]; | 934 var data = <js.Expression>[unparse(compiler, method.code)]; |
935 data.add(js.quoteName(method.callName)); | 935 data.add(js.quoteName(method.callName)); |
936 data.add(js.quoteName(method.tearOffName)); | 936 data.add(js.quoteName(method.tearOffName)); |
937 data.add(method.functionType); | 937 data.add(method.functionType); |
938 data.addAll(method.parameterStubs.expand(makeNameCallNameCodeTriplet)); | 938 data.addAll(method.parameterStubs.expand(makeNameCallNameCodeTriplet)); |
939 if (method.canBeApplied) { | 939 if (method.canBeApplied) { |
940 data.add(js.number(method.requiredParameterCount)); | 940 data.add(js.number(method.requiredParameterCount)); |
941 data.add(_encodeOptionalParameterDefaultValues(method)); | 941 data.add(_encodeOptionalParameterDefaultValues(method)); |
942 } | 942 } |
943 return [ | 943 return [ |
944 js.quoteName(method.name), | 944 js.quoteName(method.name), |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1289 #eagerClasses; | 1289 #eagerClasses; |
1290 | 1290 |
1291 var end = Date.now(); | 1291 var end = Date.now(); |
1292 // print('Setup: ' + (end - start) + ' ms.'); | 1292 // print('Setup: ' + (end - start) + ' ms.'); |
1293 | 1293 |
1294 #invokeMain; // Start main. | 1294 #invokeMain; // Start main. |
1295 | 1295 |
1296 })(Date.now(), #code) | 1296 })(Date.now(), #code) |
1297 }"""; | 1297 }"""; |
1298 } | 1298 } |
OLD | NEW |