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

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

Issue 2700053003: Don't use magic strings/properties to communicate between compiler and runtime. (Closed)
Patch Set: Small cleanup. 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) 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.class_stub_generator; 5 library dart2js.js_emitter.class_stub_generator;
6 6
7 import '../common/names.dart' show Identifiers; 7 import '../common/names.dart' show Identifiers;
8 import '../compiler.dart' show Compiler; 8 import '../compiler.dart' show Compiler;
9 import '../elements/entities.dart'; 9 import '../elements/entities.dart';
10 import '../js/js.dart' as jsAst; 10 import '../js/js.dart' as jsAst;
(...skipping 22 matching lines...) Expand all
33 // TODO(sra): Implement placeholders in VariableDeclaration position: 33 // TODO(sra): Implement placeholders in VariableDeclaration position:
34 // 34 //
35 // String constructorName = namer.getNameOfClass(classElement); 35 // String constructorName = namer.getNameOfClass(classElement);
36 // return js.statement('function #(#) { #; }', 36 // return js.statement('function #(#) { #; }',
37 // [ constructorName, fields, 37 // [ constructorName, fields,
38 // fields.map( 38 // fields.map(
39 // (name) => js('this.# = #', [name, name]))])); 39 // (name) => js('this.# = #', [name, name]))]));
40 var typeParameters = const <jsAst.Parameter>[]; 40 var typeParameters = const <jsAst.Parameter>[];
41 var typeInits = const <jsAst.Expression>[]; 41 var typeInits = const <jsAst.Expression>[];
42 if (hasRtiField) { 42 if (hasRtiField) {
43 typeParameters = namer.rtiFieldName; 43 var rtiName = namer.rtiFieldJsName;
44 typeInits = js('this.# = #', [namer.rtiFieldName, namer.rtiFieldName]); 44 typeParameters = rtiName
45 typeInits = js('this.# = #', [rtiName, rtiName]);
45 } 46 }
46 return js('function(#, #) { #; #; this.#();}', [ 47 return js('function(#, #) { #; #; this.#();}', [
47 fields, 48 fields,
48 typeParameters, 49 typeParameters,
49 fields.map((name) => js('this.# = #', [name, name])), 50 fields.map((name) => js('this.# = #', [name, name])),
50 typeInits, 51 typeInits,
51 namer.deferredAction 52 namer.deferredAction
52 ]); 53 ]);
53 } 54 }
54 55
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 if (cache === void 0) cache = #tearOff( 313 if (cache === void 0) cache = #tearOff(
313 this, funcs, reflectionInfo, true, [], name).prototype; 314 this, funcs, reflectionInfo, true, [], name).prototype;
314 return cache; 315 return cache;
315 } 316 }
316 : tearOffGetter(funcs, reflectionInfo, name, isIntercepted); 317 : tearOffGetter(funcs, reflectionInfo, name, isIntercepted);
317 }''', 318 }''',
318 {'tearOff': tearOffAccessExpression}); 319 {'tearOff': tearOffAccessExpression});
319 320
320 return <jsAst.Statement>[tearOffGetter, tearOff]; 321 return <jsAst.Statement>[tearOffGetter, tearOff];
321 } 322 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_backend/namer.dart ('k') | pkg/compiler/lib/src/js_emitter/full_emitter/class_emitter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698