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

Side by Side Diff: dart/sdk/lib/_internal/compiler/implementation/js_backend/native_emitter.dart

Issue 19676002: Implement top-level getters. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Update pkg status Created 7 years, 5 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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 // Fix superclass. TODO(sra): make native classes inherit from Interceptor. 251 // Fix superclass. TODO(sra): make native classes inherit from Interceptor.
252 if (superclass == compiler.objectClass) { 252 if (superclass == compiler.objectClass) {
253 superclass = backend.jsInterceptorClass; 253 superclass = backend.jsInterceptorClass;
254 } 254 }
255 255
256 String superName = backend.namer.getName(superclass); 256 String superName = backend.namer.getName(superclass);
257 257
258 ClassBuilder builder = new ClassBuilder(); 258 ClassBuilder builder = new ClassBuilder();
259 emitter.emitClassConstructor(classElement, builder); 259 emitter.emitClassConstructor(classElement, builder);
260 emitter.emitSuper(superName, builder); 260 emitter.emitSuper(superName, builder);
261 bool hasFields = emitter.emitClassFields( 261 bool hasFields = emitter.emitFields(
262 classElement, builder, superName, classIsNative: true); 262 classElement, builder, superName, classIsNative: true);
263 int propertyCount = builder.properties.length; 263 int propertyCount = builder.properties.length;
264 emitter.emitClassGettersSetters(classElement, builder); 264 emitter.emitClassGettersSetters(classElement, builder);
265 emitter.emitInstanceMembers(classElement, builder); 265 emitter.emitInstanceMembers(classElement, builder);
266 emitter.emitIsTests(classElement, builder); 266 emitter.emitIsTests(classElement, builder);
267 267
268 if (!hasFields && 268 if (!hasFields &&
269 builder.properties.length == propertyCount && 269 builder.properties.length == propertyCount &&
270 superclass is! MixinApplicationElement) { 270 superclass is! MixinApplicationElement) {
271 builder.isTrivial = true; 271 builder.isTrivial = true;
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 if (emitter.compiler.enableMinification) targetBuffer.add(';'); 444 if (emitter.compiler.enableMinification) targetBuffer.add(';');
445 targetBuffer.add(jsAst.prettyPrint( 445 targetBuffer.add(jsAst.prettyPrint(
446 new jsAst.ExpressionStatement(init), compiler)); 446 new jsAst.ExpressionStatement(init), compiler));
447 targetBuffer.add('\n'); 447 targetBuffer.add('\n');
448 } 448 }
449 449
450 targetBuffer.add(nativeBuffer); 450 targetBuffer.add(nativeBuffer);
451 targetBuffer.add('\n'); 451 targetBuffer.add('\n');
452 } 452 }
453 } 453 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698