| OLD | NEW |
| 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 | 10 |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 /// Creates a literal js string from [value]. | 320 /// Creates a literal js string from [value]. |
| 321 /// | 321 /// |
| 322 /// Note that this function only puts quotes around [value]. It does not do | 322 /// Note that this function only puts quotes around [value]. It does not do |
| 323 /// any escaping, so use only when you can guarantee that [value] does not | 323 /// any escaping, so use only when you can guarantee that [value] does not |
| 324 /// contain newlines or backslashes. For escaping the string use | 324 /// contain newlines or backslashes. For escaping the string use |
| 325 /// [escapedString]. | 325 /// [escapedString]. |
| 326 LiteralString string(String value) => new LiteralString('"$value"'); | 326 LiteralString string(String value) => new LiteralString('"$value"'); |
| 327 | 327 |
| 328 LiteralNumber number(num value) => new LiteralNumber('$value'); | 328 LiteralNumber number(num value) => new LiteralNumber('$value'); |
| 329 | 329 |
| 330 LiteralBool boolean(bool value) => new LiteralBool(value); |
| 331 |
| 330 ArrayInitializer numArray(Iterable<int> list) => | 332 ArrayInitializer numArray(Iterable<int> list) => |
| 331 new ArrayInitializer(list.map(number).toList()); | 333 new ArrayInitializer(list.map(number).toList()); |
| 332 | 334 |
| 333 ArrayInitializer stringArray(Iterable<String> list) => | 335 ArrayInitializer stringArray(Iterable<String> list) => |
| 334 new ArrayInitializer(list.map(string).toList()); | 336 new ArrayInitializer(list.map(string).toList()); |
| 335 | 337 |
| 336 Comment comment(String text) => new Comment(text); | 338 Comment comment(String text) => new Comment(text); |
| 337 | 339 |
| 338 Call propertyCall(Expression receiver, | 340 Call propertyCall(Expression receiver, |
| 339 String fieldName, | 341 String fieldName, |
| (...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1236 Catch parseCatch() { | 1238 Catch parseCatch() { |
| 1237 expectCategory(LPAREN); | 1239 expectCategory(LPAREN); |
| 1238 String identifier = lastToken; | 1240 String identifier = lastToken; |
| 1239 expectCategory(ALPHA); | 1241 expectCategory(ALPHA); |
| 1240 expectCategory(RPAREN); | 1242 expectCategory(RPAREN); |
| 1241 expectCategory(LBRACE); | 1243 expectCategory(LBRACE); |
| 1242 Block body = parseBlock(); | 1244 Block body = parseBlock(); |
| 1243 return new Catch(new VariableDeclaration(identifier), body); | 1245 return new Catch(new VariableDeclaration(identifier), body); |
| 1244 } | 1246 } |
| 1245 } | 1247 } |
| OLD | NEW |