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_emitter/old_emitter/setup_program_builder.dart

Issue 1198293002: dart2js: Use an abstract Name class for names in the generated JavaScript ast. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: fix tests Created 5 years, 6 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) 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 'precompiled': precompiledAccess, 126 'precompiled': precompiledAccess,
127 'finishedClassesAccess': finishedClassesAccess, 127 'finishedClassesAccess': finishedClassesAccess,
128 'needsMixinSupport': emitter.needsMixinSupport, 128 'needsMixinSupport': emitter.needsMixinSupport,
129 'needsNativeSupport': program.needsNativeSupport, 129 'needsNativeSupport': program.needsNativeSupport,
130 'isInterceptorClass': namer.operatorIs(backend.jsInterceptorClass), 130 'isInterceptorClass': namer.operatorIs(backend.jsInterceptorClass),
131 'isObject' : namer.operatorIs(compiler.objectClass), 131 'isObject' : namer.operatorIs(compiler.objectClass),
132 'specProperty': js.string(namer.nativeSpecProperty), 132 'specProperty': js.string(namer.nativeSpecProperty),
133 'trivialNsmHandlers': emitter.buildTrivialNsmHandlers(), 133 'trivialNsmHandlers': emitter.buildTrivialNsmHandlers(),
134 'hasRetainedMetadata': backend.hasRetainedMetadata, 134 'hasRetainedMetadata': backend.hasRetainedMetadata,
135 'types': typesAccess, 135 'types': typesAccess,
136 'objectClassName': js.string(namer.runtimeTypeName(compiler.objectClass)), 136 'objectClassName': js.quoteName(
137 namer.runtimeTypeName(compiler.objectClass)),
137 'needsStructuredMemberInfo': emitter.needsStructuredMemberInfo, 138 'needsStructuredMemberInfo': emitter.needsStructuredMemberInfo,
138 'usesMangledNames': 139 'usesMangledNames':
139 compiler.mirrorsLibrary != null || compiler.enabledFunctionApply, 140 compiler.mirrorsLibrary != null || compiler.enabledFunctionApply,
140 'tearOffCode': buildTearOffCode(backend), 141 'tearOffCode': buildTearOffCode(backend),
141 'nativeInfoHandler': nativeInfoHandler, 142 'nativeInfoHandler': nativeInfoHandler,
142 'operatorIsPrefix' : js.string(namer.operatorIsPrefix), 143 'operatorIsPrefix' : js.string(namer.operatorIsPrefix),
143 'deferredActionString': js.string(namer.deferredAction)}; 144 'deferredActionString': js.string(namer.deferredAction)};
144 145
145 String skeleton = ''' 146 String skeleton = '''
146 function $setupProgramName(programData, typesOffset) { 147 function $setupProgramName(programData, typesOffset) {
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 var classData = descriptor["${namer.classDescriptorProperty}"], 571 var classData = descriptor["${namer.classDescriptorProperty}"],
571 split, supr, fields = classData; 572 split, supr, fields = classData;
572 573
573 if (#hasRetainedMetadata) 574 if (#hasRetainedMetadata)
574 if (typeof classData == "object" && 575 if (typeof classData == "object" &&
575 classData instanceof Array) { 576 classData instanceof Array) {
576 classData = fields = classData[0]; 577 classData = fields = classData[0];
577 } 578 }
578 // ${ClassBuilder.fieldEncodingDescription}. 579 // ${ClassBuilder.fieldEncodingDescription}.
579 var s = fields.split(";"); 580 var s = fields.split(";");
580 fields = s[1] == "" ? [] : s[1].split(","); 581 fields = s[1] ? s[1].split(",") : [];
581 supr = s[0]; 582 supr = s[0];
582 // ${ClassBuilder.functionTypeEncodingDescription}. 583 // ${ClassBuilder.functionTypeEncodingDescription}.
583 split = supr.split(":"); 584 split = supr.split(":");
584 if (split.length == 2) { 585 if (split.length == 2) {
585 supr = split[0]; 586 supr = split[0];
586 var functionSignature = split[1]; 587 var functionSignature = split[1];
587 if (functionSignature) 588 if (functionSignature)
588 descriptor.${namer.operatorSignature} = function(s) { 589 descriptor.${namer.operatorSignature} = function(s) {
589 return function() { 590 return function() {
590 return #types[s]; 591 return #types[s];
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 (function() { 846 (function() {
846 var result = $array[$index]; 847 var result = $array[$index];
847 if ($check) { 848 if ($check) {
848 throw new Error( 849 throw new Error(
849 name + ": expected value of type \'$type\' at index " + ($index) + 850 name + ": expected value of type \'$type\' at index " + ($index) +
850 " but got " + (typeof result)); 851 " but got " + (typeof result));
851 } 852 }
852 return result; 853 return result;
853 })()'''; 854 })()''';
854 } 855 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698