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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/js_emitter/reflection_data_parser.dart

Issue 255843005: Avoid generating VariableUse nodes with non-identifier names (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 7 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;
11 const REQUIRED_PARAMETER_INDEX = 3; 11 const REQUIRED_PARAMETER_INDEX = 3;
12 const OPTIONAL_PARAMETER_INDEX = 4; 12 const OPTIONAL_PARAMETER_INDEX = 4;
13 const DEFAULT_ARGUMENTS_INDEX = 5; 13 const DEFAULT_ARGUMENTS_INDEX = 5;
14 14
15 const bool VALIDATE_DATA = false; 15 const bool VALIDATE_DATA = false;
16 16
17 // TODO(ahe): This code should be integrated in CodeEmitterTask.finishClasses. 17 // TODO(ahe): This code should be integrated in CodeEmitterTask.finishClasses.
18 jsAst.Expression getReflectionDataParser(String classesCollector, 18 jsAst.Expression getReflectionDataParser(String classesCollector,
19 JavaScriptBackend backend) { 19 JavaScriptBackend backend) {
20 Namer namer = backend.namer; 20 Namer namer = backend.namer;
21 Compiler compiler = backend.compiler; 21 Compiler compiler = backend.compiler;
22 Element closureFromTearOff = compiler.findHelper('closureFromTearOff'); 22 Element closureFromTearOff = compiler.findHelper('closureFromTearOff');
23 String tearOffAccess; 23 String tearOffAccess;
24 String tearOffGlobalObjectName; 24 String tearOffGlobalObjectName;
25 String tearOffGlobalObject; 25 String tearOffGlobalObject;
26 if (closureFromTearOff != null) { 26 if (closureFromTearOff != null) {
27 // TODO(sra): Replace with AST.
27 tearOffAccess = namer.isolateAccess(closureFromTearOff); 28 tearOffAccess = namer.isolateAccess(closureFromTearOff);
28 tearOffGlobalObjectName = tearOffGlobalObject = 29 tearOffGlobalObjectName = tearOffGlobalObject =
29 namer.globalObjectFor(closureFromTearOff); 30 namer.globalObjectFor(closureFromTearOff);
30 } else { 31 } else {
31 // Default values for mocked-up test libraries. 32 // Default values for mocked-up test libraries.
32 tearOffAccess = 33 tearOffAccess =
33 r'''function() { throw 'Helper \'closureFromTearOff\' missing.' }'''; 34 r'''function() { throw 'Helper \'closureFromTearOff\' missing.' }''';
34 tearOffGlobalObjectName = 'MissingHelperFunction'; 35 tearOffGlobalObjectName = 'MissingHelperFunction';
35 tearOffGlobalObject = '($tearOffAccess())'; 36 tearOffGlobalObject = '($tearOffAccess())';
36 } 37 }
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 (function() { 351 (function() {
351 var result = $array[$index]; 352 var result = $array[$index];
352 if ($check) { 353 if ($check) {
353 throw new Error( 354 throw new Error(
354 name + ": expected value of type \'$type\' at index " + ($index) + 355 name + ": expected value of type \'$type\' at index " + ($index) +
355 " but got " + (typeof result)); 356 " but got " + (typeof result));
356 } 357 }
357 return result; 358 return result;
358 })()'''; 359 })()''';
359 } 360 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698