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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/js/builder.dart

Issue 160343002: Implement reflection on annotations of parameters. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comment. Created 6 years, 10 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
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/js_emitter/container_builder.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // Utilities for building JS ASTs at runtime. Contains a builder class 5 // Utilities for building JS ASTs at runtime. Contains a builder class
6 // and a parser that parses part of the language. 6 // and a parser that parses part of the language.
7 7
8 part of js; 8 part of js;
9 9
10 class JsBuilder { 10 class JsBuilder {
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 } else if (expression is num) { 119 } else if (expression is num) {
120 return new LiteralNumber('$expression'); 120 return new LiteralNumber('$expression');
121 } else if (expression is bool) { 121 } else if (expression is bool) {
122 return new LiteralBool(expression); 122 return new LiteralBool(expression);
123 } else if (expression is Map) { 123 } else if (expression is Map) {
124 if (!expression.isEmpty) { 124 if (!expression.isEmpty) {
125 throw new ArgumentError('expression should be an empty Map'); 125 throw new ArgumentError('expression should be an empty Map');
126 } 126 }
127 return new ObjectInitializer([]); 127 return new ObjectInitializer([]);
128 } else if (expression is List) { 128 } else if (expression is List) {
129 var values = new List<ArrayElement>(expression.length); 129 var values = new List<ArrayElement>.generate(expression.length,
130 int index = 0; 130 (index) => new ArrayElement(index, toExpression(expression[index])));
131 for (var entry in expression) {
132 values[index] = new ArrayElement(index, toExpression(entry));
133 index++;
134 }
135 return new ArrayInitializer(values.length, values); 131 return new ArrayInitializer(values.length, values);
136 } else { 132 } else {
137 throw new ArgumentError('expression should be an Expression, ' 133 throw new ArgumentError('expression should be an Expression, '
138 'a String, a num, a bool, or a Map'); 134 'a String, a num, a bool, a Map, or a List;');
139 } 135 }
140 } 136 }
141 137
142 ForIn forIn(String name, object, statement) { 138 ForIn forIn(String name, object, statement) {
143 return new ForIn(defineVar(name), 139 return new ForIn(defineVar(name),
144 toExpression(object), 140 toExpression(object),
145 toStatement(statement)); 141 toStatement(statement));
146 } 142 }
147 143
148 For for_(init, condition, update, statement) { 144 For for_(init, condition, update, statement) {
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 } 788 }
793 789
794 Node visitLiteralNull(LiteralNull node) { 790 Node visitLiteralNull(LiteralNull node) {
795 return node; 791 return node;
796 } 792 }
797 793
798 Node visitLiteralBool(LiteralBool node) { 794 Node visitLiteralBool(LiteralBool node) {
799 return node; 795 return node;
800 } 796 }
801 } 797 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/js_emitter/container_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698