| 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 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 | 327 |
| 328 LiteralNumber number(num value) => new LiteralNumber('$value'); | 328 LiteralNumber number(num value) => new LiteralNumber('$value'); |
| 329 | 329 |
| 330 ArrayInitializer numArray(Iterable<int> list) => | 330 ArrayInitializer numArray(Iterable<int> list) => |
| 331 new ArrayInitializer.from(list.map(number)); | 331 new ArrayInitializer.from(list.map(number)); |
| 332 | 332 |
| 333 ArrayInitializer stringArray(Iterable<String> list) => | 333 ArrayInitializer stringArray(Iterable<String> list) => |
| 334 new ArrayInitializer.from(list.map(string)); | 334 new ArrayInitializer.from(list.map(string)); |
| 335 | 335 |
| 336 Comment comment(String text) => new Comment(text); | 336 Comment comment(String text) => new Comment(text); |
| 337 |
| 338 Call propertyCall(Expression receiver, |
| 339 String fieldName, |
| 340 List<Expression> arguments) { |
| 341 return new Call(new PropertyAccess.field(receiver, fieldName), arguments); |
| 342 } |
| 337 } | 343 } |
| 338 | 344 |
| 339 LiteralString string(String value) => js.string(value); | 345 LiteralString string(String value) => js.string(value); |
| 340 LiteralNumber number(num value) => js.number(value); | 346 LiteralNumber number(num value) => js.number(value); |
| 341 ArrayInitializer numArray(Iterable<int> list) => js.numArray(list); | 347 ArrayInitializer numArray(Iterable<int> list) => js.numArray(list); |
| 342 ArrayInitializer stringArray(Iterable<String> list) => js.stringArray(list); | 348 ArrayInitializer stringArray(Iterable<String> list) => js.stringArray(list); |
| 349 Call propertyCall(Expression receiver, |
| 350 String fieldName, |
| 351 List<Expression> arguments) { |
| 352 return js.propertyCall(receiver, fieldName, arguments); |
| 353 } |
| 343 | 354 |
| 344 class MiniJsParserError { | 355 class MiniJsParserError { |
| 345 MiniJsParserError(this.parser, this.message) { } | 356 MiniJsParserError(this.parser, this.message) { } |
| 346 | 357 |
| 347 final MiniJsParser parser; | 358 final MiniJsParser parser; |
| 348 final String message; | 359 final String message; |
| 349 | 360 |
| 350 String toString() { | 361 String toString() { |
| 351 int pos = parser.lastPosition; | 362 int pos = parser.lastPosition; |
| 352 | 363 |
| (...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1220 Catch parseCatch() { | 1231 Catch parseCatch() { |
| 1221 expectCategory(LPAREN); | 1232 expectCategory(LPAREN); |
| 1222 String identifier = lastToken; | 1233 String identifier = lastToken; |
| 1223 expectCategory(ALPHA); | 1234 expectCategory(ALPHA); |
| 1224 expectCategory(RPAREN); | 1235 expectCategory(RPAREN); |
| 1225 expectCategory(LBRACE); | 1236 expectCategory(LBRACE); |
| 1226 Block body = parseBlock(); | 1237 Block body = parseBlock(); |
| 1227 return new Catch(new VariableDeclaration(identifier), body); | 1238 return new Catch(new VariableDeclaration(identifier), body); |
| 1228 } | 1239 } |
| 1229 } | 1240 } |
| OLD | NEW |