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

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

Issue 872403002: Don't create builders to determine if a native class is trivial or not. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 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 | 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 /** 7 /**
8 * A data structure for collecting fragments of a class definition. 8 * A data structure for collecting fragments of a class definition.
9 */ 9 */
10 class ClassBuilder { 10 class ClassBuilder {
11 final List<jsAst.Property> properties = <jsAst.Property>[]; 11 final List<jsAst.Property> properties = <jsAst.Property>[];
12 final List<String> fields = <String>[]; 12 final List<String> fields = <String>[];
13 13
14 String superName; 14 String superName;
15 String functionType; 15 String functionType;
16 List<jsAst.Node> fieldMetadata; 16 List<jsAst.Node> fieldMetadata;
17 17
18 final Element element; 18 final Element element;
19 final Namer namer; 19 final Namer namer;
20 20
21 /// Set to true by user if class is indistinguishable from its superclass.
22 bool isTrivial = false;
23
24 ClassBuilder(this.element, this.namer); 21 ClassBuilder(this.element, this.namer);
25 22
26 // Has the same signature as [DefineStubFunction]. 23 // Has the same signature as [DefineStubFunction].
27 jsAst.Property addProperty(String name, jsAst.Expression value) { 24 jsAst.Property addProperty(String name, jsAst.Expression value) {
28 jsAst.Property property = new jsAst.Property(js.string(name), value); 25 jsAst.Property property = new jsAst.Property(js.string(name), value);
29 properties.add(property); 26 properties.add(property);
30 return property; 27 return property;
31 } 28 }
32 29
33 void addField(String field) { 30 void addField(String field) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 fieldsAndProperties.add( 67 fieldsAndProperties.add(
71 new jsAst.Property( 68 new jsAst.Property(
72 js.string(namer.classDescriptorProperty), classData)); 69 js.string(namer.classDescriptorProperty), classData));
73 fieldsAndProperties.addAll(properties); 70 fieldsAndProperties.addAll(properties);
74 } else { 71 } else {
75 fieldsAndProperties = properties; 72 fieldsAndProperties = properties;
76 } 73 }
77 return new jsAst.ObjectInitializer(fieldsAndProperties, isOneLiner: false); 74 return new jsAst.ObjectInitializer(fieldsAndProperties, isOneLiner: false);
78 } 75 }
79 } 76 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/native_emitter.dart ('k') | pkg/compiler/lib/src/js_emitter/old_emitter/class_emitter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698