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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/js_backend/native_emitter.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 js_backend; 5 part of js_backend;
6 6
7 class NativeEmitter { 7 class NativeEmitter {
8 8
9 CodeEmitterTask emitter; 9 CodeEmitterTask emitter;
10 CodeBuffer nativeBuffer; 10 CodeBuffer nativeBuffer;
(...skipping 21 matching lines...) Expand all
32 nativeMethods = new Set<FunctionElement>(), 32 nativeMethods = new Set<FunctionElement>(),
33 nativeBuffer = new CodeBuffer(); 33 nativeBuffer = new CodeBuffer();
34 34
35 Compiler get compiler => emitter.compiler; 35 Compiler get compiler => emitter.compiler;
36 JavaScriptBackend get backend => compiler.backend; 36 JavaScriptBackend get backend => compiler.backend;
37 37
38 String get _ => emitter.space; 38 String get _ => emitter.space;
39 String get n => emitter.n; 39 String get n => emitter.n;
40 String get N => emitter.N; 40 String get N => emitter.N;
41 41
42 String get dynamicName {
43 Element element = compiler.findHelper('dynamicFunction');
44 return backend.namer.isolateAccess(element);
45 }
46
47 String get dynamicFunctionTableName {
48 Element element = compiler.findHelper('dynamicFunctionTable');
49 return backend.namer.isolateAccess(element);
50 }
51
52 String get typeNameOfName {
53 Element element = compiler.findHelper('getTypeNameOf');
54 return backend.namer.isolateAccess(element);
55 }
56
57 jsAst.Expression get defPropFunction { 42 jsAst.Expression get defPropFunction {
58 Element element = compiler.findHelper('defineProperty'); 43 Element element = compiler.findHelper('defineProperty');
59 return backend.namer.elementAccess(element); 44 return backend.namer.elementAccess(element);
60 } 45 }
61 46
62 String get toStringHelperName {
63 Element element = compiler.findHelper('toStringForNativeObject');
64 return backend.namer.isolateAccess(element);
65 }
66
67 String get hashCodeHelperName {
68 Element element = compiler.findHelper('hashCodeForNativeObject');
69 return backend.namer.isolateAccess(element);
70 }
71
72 String get dispatchPropertyNameVariable {
73 Element element = compiler.findInterceptor('dispatchPropertyName');
74 return backend.namer.isolateAccess(element);
75 }
76
77 /** 47 /**
78 * Writes the class definitions for the interceptors to [mainBuffer]. 48 * Writes the class definitions for the interceptors to [mainBuffer].
79 * Writes code to associate dispatch tags with interceptors to [nativeBuffer]. 49 * Writes code to associate dispatch tags with interceptors to [nativeBuffer].
80 * 50 *
81 * The interceptors are filtered to avoid emitting trivial interceptors. For 51 * The interceptors are filtered to avoid emitting trivial interceptors. For
82 * example, if the program contains no code that can distinguish between the 52 * example, if the program contains no code that can distinguish between the
83 * numerous subclasses of `Element` then we can pretend that `Element` is a 53 * numerous subclasses of `Element` then we can pretend that `Element` is a
84 * leaf class, and all instances of subclasses of `Element` are instances of 54 * leaf class, and all instances of subclasses of `Element` are instances of
85 * `Element`. 55 * `Element`.
86 * 56 *
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 if (emitter.compiler.enableMinification) targetBuffer.add(';'); 458 if (emitter.compiler.enableMinification) targetBuffer.add(';');
489 targetBuffer.add(jsAst.prettyPrint( 459 targetBuffer.add(jsAst.prettyPrint(
490 new jsAst.ExpressionStatement(init), compiler)); 460 new jsAst.ExpressionStatement(init), compiler));
491 targetBuffer.add('\n'); 461 targetBuffer.add('\n');
492 } 462 }
493 463
494 targetBuffer.add(nativeBuffer); 464 targetBuffer.add(nativeBuffer);
495 targetBuffer.add('\n'); 465 targetBuffer.add('\n');
496 } 466 }
497 } 467 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698