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

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

Issue 1859343004: dartfmt pkg/compiler (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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.lazy_emitter; 5 library dart2js.js_emitter.lazy_emitter;
6 6
7 import 'package:js_runtime/shared/embedded_names.dart' show 7 import 'package:js_runtime/shared/embedded_names.dart'
8 JsBuiltin, 8 show JsBuiltin, METADATA, TYPES;
9 METADATA,
10 TYPES;
11 9
12 import '../../common.dart'; 10 import '../../common.dart';
13 import '../../compiler.dart' show 11 import '../../compiler.dart' show Compiler;
14 Compiler; 12 import '../../constants/values.dart' show ConstantValue;
15 import '../../constants/values.dart' show 13 import '../../elements/elements.dart'
16 ConstantValue; 14 show ClassElement, Element, FieldElement, FunctionElement;
17 import '../../elements/elements.dart' show
18 ClassElement,
19 Element,
20 FieldElement,
21 FunctionElement;
22 import '../../js/js.dart' as js; 15 import '../../js/js.dart' as js;
23 import '../../js_backend/js_backend.dart' show 16 import '../../js_backend/js_backend.dart' show JavaScriptBackend, Namer;
24 JavaScriptBackend,
25 Namer;
26 17
27 import '../js_emitter.dart' show 18 import '../js_emitter.dart' show NativeEmitter;
28 NativeEmitter; 19 import '../js_emitter.dart' as emitterTask show Emitter;
29 import '../js_emitter.dart' as emitterTask show
30 Emitter;
31 import '../model.dart'; 20 import '../model.dart';
32 import '../program_builder/program_builder.dart' show 21 import '../program_builder/program_builder.dart' show ProgramBuilder;
33 ProgramBuilder;
34 22
35 import 'model_emitter.dart'; 23 import 'model_emitter.dart';
36 24
37 class Emitter implements emitterTask.Emitter { 25 class Emitter implements emitterTask.Emitter {
38 final Compiler _compiler; 26 final Compiler _compiler;
39 final Namer namer; 27 final Namer namer;
40 final ModelEmitter _emitter; 28 final ModelEmitter _emitter;
41 29
42 JavaScriptBackend get _backend => _compiler.backend; 30 JavaScriptBackend get _backend => _compiler.backend;
43 31
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 78
91 js.PropertyAccess _globalPropertyAccess(Element element) { 79 js.PropertyAccess _globalPropertyAccess(Element element) {
92 js.Name name = namer.globalPropertyName(element); 80 js.Name name = namer.globalPropertyName(element);
93 js.PropertyAccess pa = new js.PropertyAccess( 81 js.PropertyAccess pa = new js.PropertyAccess(
94 new js.VariableUse(namer.globalObjectFor(element)), name); 82 new js.VariableUse(namer.globalObjectFor(element)), name);
95 return pa; 83 return pa;
96 } 84 }
97 85
98 @override 86 @override
99 js.Expression isolateLazyInitializerAccess(FieldElement element) { 87 js.Expression isolateLazyInitializerAccess(FieldElement element) {
100 return js.js('#.#', [namer.globalObjectFor(element), 88 return js.js('#.#',
101 namer.lazyInitializerName(element)]); 89 [namer.globalObjectFor(element), namer.lazyInitializerName(element)]);
102 } 90 }
103 91
104 @override 92 @override
105 js.Expression isolateStaticClosureAccess(FunctionElement element) { 93 js.Expression isolateStaticClosureAccess(FunctionElement element) {
106 return _emitter.generateStaticClosureAccess(element); 94 return _emitter.generateStaticClosureAccess(element);
107 } 95 }
108 96
109 @override 97 @override
110 js.PropertyAccess staticFieldAccess(FieldElement element) { 98 js.PropertyAccess staticFieldAccess(FieldElement element) {
111 return _globalPropertyAccess(element); 99 return _globalPropertyAccess(element);
112 } 100 }
113 101
114 @override 102 @override
115 js.PropertyAccess staticFunctionAccess(FunctionElement element) { 103 js.PropertyAccess staticFunctionAccess(FunctionElement element) {
116 return _globalPropertyAccess(element); 104 return _globalPropertyAccess(element);
117 } 105 }
118 106
119 @override 107 @override
120 js.PropertyAccess constructorAccess(ClassElement element) { 108 js.PropertyAccess constructorAccess(ClassElement element) {
121 return _globalPropertyAccess(element); 109 return _globalPropertyAccess(element);
122 } 110 }
123 111
124 @override 112 @override
125 js.PropertyAccess prototypeAccess(ClassElement element, 113 js.PropertyAccess prototypeAccess(
126 bool hasBeenInstantiated) { 114 ClassElement element, bool hasBeenInstantiated) {
127 js.Expression constructor = 115 js.Expression constructor =
128 hasBeenInstantiated ? constructorAccess(element) : typeAccess(element); 116 hasBeenInstantiated ? constructorAccess(element) : typeAccess(element);
129 return js.js('#.prototype', constructor); 117 return js.js('#.prototype', constructor);
130 } 118 }
131 119
132 @override 120 @override
133 js.Expression interceptorClassAccess(ClassElement element) { 121 js.Expression interceptorClassAccess(ClassElement element) {
134 // Some interceptors are eagerly constructed. However, native interceptors 122 // Some interceptors are eagerly constructed. However, native interceptors
135 // aren't. 123 // aren't.
136 return js.js('#.ensureResolved()', _globalPropertyAccess(element)); 124 return js.js('#.ensureResolved()', _globalPropertyAccess(element));
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 case JsBuiltin.getMetadata: 168 case JsBuiltin.getMetadata:
181 return _emitter.templateForReadMetadata; 169 return _emitter.templateForReadMetadata;
182 170
183 case JsBuiltin.getType: 171 case JsBuiltin.getType:
184 return _emitter.templateForReadType; 172 return _emitter.templateForReadType;
185 173
186 case JsBuiltin.createDartClosureFromNameOfStaticFunction: 174 case JsBuiltin.createDartClosureFromNameOfStaticFunction:
187 throw new UnsupportedError('createDartClosureFromNameOfStaticFunction'); 175 throw new UnsupportedError('createDartClosureFromNameOfStaticFunction');
188 176
189 default: 177 default:
190 reporter.internalError(NO_LOCATION_SPANNABLE, 178 reporter.internalError(
191 "Unhandled Builtin: $builtin"); 179 NO_LOCATION_SPANNABLE, "Unhandled Builtin: $builtin");
192 return null; 180 return null;
193 } 181 }
194 } 182 }
195 183
196 @override 184 @override
197 void invalidateCaches() { 185 void invalidateCaches() {}
198 }
199 } 186 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/js_emitter.dart ('k') | pkg/compiler/lib/src/js_emitter/lazy_emitter/model_emitter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698