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

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

Issue 2625713002: Rename Enqueuer.universe to worldBuilder. (Closed)
Patch Set: Updated cf. comments Created 3 years, 11 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 part of dart2js.js_emitter; 5 part of dart2js.js_emitter;
6 6
7 class ClassStubGenerator { 7 class ClassStubGenerator {
8 final Namer namer; 8 final Namer namer;
9 final JavaScriptBackend backend; 9 final JavaScriptBackend backend;
10 final CodegenWorldBuilder codegenWorld; 10 final CodegenWorldBuilder worldBuilder;
11 final ClosedWorld closedWorld; 11 final ClosedWorld closedWorld;
12 final bool enableMinification; 12 final bool enableMinification;
13 13
14 ClassStubGenerator( 14 ClassStubGenerator(
15 this.namer, this.backend, this.codegenWorld, this.closedWorld, 15 this.namer, this.backend, this.worldBuilder, this.closedWorld,
16 {this.enableMinification}); 16 {this.enableMinification});
17 17
18 jsAst.Expression generateClassConstructor(ClassElement classElement, 18 jsAst.Expression generateClassConstructor(ClassElement classElement,
19 Iterable<jsAst.Name> fields, bool hasRtiField) { 19 Iterable<jsAst.Name> fields, bool hasRtiField) {
20 // TODO(sra): Implement placeholders in VariableDeclaration position: 20 // TODO(sra): Implement placeholders in VariableDeclaration position:
21 // 21 //
22 // String constructorName = namer.getNameOfClass(classElement); 22 // String constructorName = namer.getNameOfClass(classElement);
23 // return js.statement('function #(#) { #; }', 23 // return js.statement('function #(#) { #; }',
24 // [ constructorName, fields, 24 // [ constructorName, fields,
25 // fields.map( 25 // fields.map(
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 } 123 }
124 } 124 }
125 125
126 return generatedStubs; 126 return generatedStubs;
127 } 127 }
128 128
129 Map<jsAst.Name, Selector> computeSelectorsForNsmHandlers() { 129 Map<jsAst.Name, Selector> computeSelectorsForNsmHandlers() {
130 Map<jsAst.Name, Selector> jsNames = <jsAst.Name, Selector>{}; 130 Map<jsAst.Name, Selector> jsNames = <jsAst.Name, Selector>{};
131 131
132 // Do not generate no such method handlers if there is no class. 132 // Do not generate no such method handlers if there is no class.
133 if (codegenWorld.directlyInstantiatedClasses.isEmpty) { 133 if (worldBuilder.directlyInstantiatedClasses.isEmpty) {
134 return jsNames; 134 return jsNames;
135 } 135 }
136 136
137 void addNoSuchMethodHandlers( 137 void addNoSuchMethodHandlers(
138 String ignore, Map<Selector, SelectorConstraints> selectors) { 138 String ignore, Map<Selector, SelectorConstraints> selectors) {
139 for (Selector selector in selectors.keys) { 139 for (Selector selector in selectors.keys) {
140 SelectorConstraints maskSet = selectors[selector]; 140 SelectorConstraints maskSet = selectors[selector];
141 if (maskSet.needsNoSuchMethodHandling(selector, closedWorld)) { 141 if (maskSet.needsNoSuchMethodHandling(selector, closedWorld)) {
142 jsAst.Name jsName = namer.invocationMirrorInternalName(selector); 142 jsAst.Name jsName = namer.invocationMirrorInternalName(selector);
143 jsNames[jsName] = selector; 143 jsNames[jsName] = selector;
144 } 144 }
145 } 145 }
146 } 146 }
147 147
148 codegenWorld.forEachInvokedName(addNoSuchMethodHandlers); 148 worldBuilder.forEachInvokedName(addNoSuchMethodHandlers);
149 codegenWorld.forEachInvokedGetter(addNoSuchMethodHandlers); 149 worldBuilder.forEachInvokedGetter(addNoSuchMethodHandlers);
150 codegenWorld.forEachInvokedSetter(addNoSuchMethodHandlers); 150 worldBuilder.forEachInvokedSetter(addNoSuchMethodHandlers);
151 return jsNames; 151 return jsNames;
152 } 152 }
153 153
154 StubMethod generateStubForNoSuchMethod(jsAst.Name name, Selector selector) { 154 StubMethod generateStubForNoSuchMethod(jsAst.Name name, Selector selector) {
155 // Values match JSInvocationMirror in js-helper library. 155 // Values match JSInvocationMirror in js-helper library.
156 int type = selector.invocationMirrorKind; 156 int type = selector.invocationMirrorKind;
157 List<String> parameterNames = 157 List<String> parameterNames =
158 new List.generate(selector.argumentCount, (i) => '\$$i'); 158 new List.generate(selector.argumentCount, (i) => '\$$i');
159 159
160 List<jsAst.Expression> argNames = selector.callStructure 160 List<jsAst.Expression> argNames = selector.callStructure
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 if (cache === void 0) cache = #tearOff( 294 if (cache === void 0) cache = #tearOff(
295 this, funcs, reflectionInfo, true, [], name).prototype; 295 this, funcs, reflectionInfo, true, [], name).prototype;
296 return cache; 296 return cache;
297 } 297 }
298 : tearOffGetter(funcs, reflectionInfo, name, isIntercepted); 298 : tearOffGetter(funcs, reflectionInfo, name, isIntercepted);
299 }''', 299 }''',
300 {'tearOff': tearOffAccessExpression}); 300 {'tearOff': tearOffAccessExpression});
301 301
302 return <jsAst.Statement>[tearOffGetter, tearOff]; 302 return <jsAst.Statement>[tearOffGetter, tearOff];
303 } 303 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_backend/runtime_types.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