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

Side by Side Diff: pkg/compiler/lib/src/js_emitter/old_emitter/setup_program_builder.dart

Issue 1040623002: Clean up naming scheme for reflection names. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Exclude methods that are not reflectable Created 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 part of dart2js.js_emitter; 5 part of dart2js.js_emitter;
6 6
7 // TODO(ahe): Share these with js_helper.dart. 7 // TODO(ahe): Share these with js_helper.dart.
8 const FUNCTION_INDEX = 0; 8 const FUNCTION_INDEX = 0;
9 const NAME_INDEX = 1; 9 const NAME_INDEX = 1;
10 const CALL_NAME_INDEX = 2; 10 const CALL_NAME_INDEX = 2;
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 f.\$callName = null; 676 f.\$callName = null;
677 // Update the interceptedNames map (which only exists if `invokeOn` was 677 // Update the interceptedNames map (which only exists if `invokeOn` was
678 // enabled). 678 // enabled).
679 if (#enabledInvokeOn) 679 if (#enabledInvokeOn)
680 if (isIntercepted) #interceptedNames[getterStubName] = 1; 680 if (isIntercepted) #interceptedNames[getterStubName] = 1;
681 } 681 }
682 682
683 if (#usesMangledNames) { 683 if (#usesMangledNames) {
684 var isReflectable = array.length > unmangledNameIndex; 684 var isReflectable = array.length > unmangledNameIndex;
685 if (isReflectable) { 685 if (isReflectable) {
686 for (var i = 0; i < funcs.length; i++) { 686 funcs[0].$reflectableField = 1;
687 funcs[i].$reflectableField = 1; 687 funcs[0].$reflectionInfoField = array;
688 for (var i = 1; i < funcs.length; i++) {
689 funcs[i].$reflectableField = 2;
688 funcs[i].$reflectionInfoField = array; 690 funcs[i].$reflectionInfoField = array;
689 } 691 }
690 var mangledNames = isStatic ? #mangledGlobalNames : #mangledNames; 692 var mangledNames = isStatic ? #mangledGlobalNames : #mangledNames;
691 var unmangledName = ${readString("array", "unmangledNameIndex")}; 693 var unmangledName = ${readString("array", "unmangledNameIndex")};
692 // The function is either a getter, a setter, or a method. 694 // The function is either a getter, a setter, or a method.
693 // If it is a method, it might also have a tear-off closure. 695 // If it is a method, it might also have a tear-off closure.
694 // The unmangledName is the same as the getter-name. 696 // The unmangledName is the same as the getter-name.
695 var reflectionName = unmangledName; 697 var reflectionName = unmangledName;
696 if (getterStubName) mangledNames[getterStubName] = reflectionName; 698 if (getterStubName) mangledNames[getterStubName] = reflectionName;
697 if (isSetter) { 699 if (isSetter) {
698 reflectionName += "="; 700 reflectionName += "=";
699 } else if (!isGetter) { 701 } else if (!isGetter) {
700 reflectionName += ":" + requiredParameterCount + 702 reflectionName += ":" +
701 ":" + optionalParameterCount; 703 (requiredParameterCount + optionalParameterCount);
702 } 704 }
703 mangledNames[name] = reflectionName; 705 mangledNames[name] = reflectionName;
704 funcs[0].$reflectionNameField = reflectionName; 706 funcs[0].$reflectionNameField = reflectionName;
705 funcs[0].$metadataIndexField = unmangledNameIndex + 1; 707 funcs[0].$metadataIndexField = unmangledNameIndex + 1;
706 if (optionalParameterCount) prototype[unmangledName + "*"] = funcs[0]; 708 if (optionalParameterCount) prototype[unmangledName + "*"] = funcs[0];
707 } 709 }
708 } 710 }
709 } 711 }
710 712
711 #tearOffCode; 713 #tearOffCode;
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 (function() { 804 (function() {
803 var result = $array[$index]; 805 var result = $array[$index];
804 if ($check) { 806 if ($check) {
805 throw new Error( 807 throw new Error(
806 name + ": expected value of type \'$type\' at index " + ($index) + 808 name + ": expected value of type \'$type\' at index " + ($index) +
807 " but got " + (typeof result)); 809 " but got " + (typeof result));
808 } 810 }
809 return result; 811 return result;
810 })()'''; 812 })()''';
811 } 813 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart ('k') | sdk/lib/_internal/compiler/js_lib/js_mirrors.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698