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

Side by Side Diff: tests/compiler/dart2js/backend_dart/sexpr_unstringifier.dart

Issue 708993003: Revert "Revert "dart2js: Add a type parameter to class Reference...."" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 // SExpressionUnstringifier implements the inverse operation to 5 // SExpressionUnstringifier implements the inverse operation to
6 // [SExpressionStringifier]. 6 // [SExpressionStringifier].
7 7
8 library sexpr_unstringifier; 8 library sexpr_unstringifier;
9 9
10 import 'package:compiler/src/constants/expressions.dart' 10 import 'package:compiler/src/constants/expressions.dart'
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 return parseSetClosureVariable(); 227 return parseSetClosureVariable();
228 case TYPE_OPERATOR: 228 case TYPE_OPERATOR:
229 return parseTypeOperator(); 229 return parseTypeOperator();
230 default: 230 default:
231 assert(false); 231 assert(false);
232 } 232 }
233 233
234 return null; 234 return null;
235 } 235 }
236 236
237 /// def1 def2 ... defn cont ) 237 /// prim1 prim2 ... primn cont)
238 /// Note that cont is *not* included in the returned list and not consumed. 238 /// Note that cont is *not* included in the returned list and not consumed.
239 List<Definition> parseDefinitionList() { 239 List<Primitive> parseArgumentList() {
240 List<Definition> defs = <Definition>[]; 240 List<Primitive> args = <Primitive>[];
241 while (tokens.next != ")") { 241 while (tokens.next != ")") {
242 Definition def = name2variable[tokens.read()]; 242 Primitive prim = name2variable[tokens.read()];
243 assert(def != null); 243 assert(prim != null);
244 defs.add(def); 244 args.add(prim);
245 } 245 }
246 return defs; 246 return args;
247 } 247 }
248 248
249 /// (prim1 prim2 ... primn) 249 /// (prim1 prim2 ... primn)
250 List<Primitive> parsePrimitiveList() { 250 List<Primitive> parsePrimitiveList() {
251 tokens.consumeStart(); 251 tokens.consumeStart();
252 List<Primitive> prims = <Primitive>[]; 252 List<Primitive> prims = <Primitive>[];
253 while (tokens.current != ")") { 253 while (tokens.current != ")") {
254 Primitive prim = name2variable[tokens.read()]; 254 Primitive prim = name2variable[tokens.read()];
255 assert(prim != null); 255 assert(prim != null);
256 prims.add(prim); 256 prims.add(prim);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 assert(trueCont != null && falseCont != null); 314 assert(trueCont != null && falseCont != null);
315 315
316 tokens.consumeEnd(); 316 tokens.consumeEnd();
317 return new Branch(cond, trueCont, falseCont); 317 return new Branch(cond, trueCont, falseCont);
318 } 318 }
319 319
320 /// (ConcatenateStrings args cont) 320 /// (ConcatenateStrings args cont)
321 ConcatenateStrings parseConcatenateStrings() { 321 ConcatenateStrings parseConcatenateStrings() {
322 tokens.consumeStart(CONCATENATE_STRINGS); 322 tokens.consumeStart(CONCATENATE_STRINGS);
323 323
324 List<Definition> args = parseDefinitionList(); 324 List<Primitive> args = parseArgumentList();
325 325
326 Continuation cont = name2variable[tokens.read()]; 326 Continuation cont = name2variable[tokens.read()];
327 assert(cont != null); 327 assert(cont != null);
328 328
329 tokens.consumeEnd(); 329 tokens.consumeEnd();
330 return new ConcatenateStrings(cont, args); 330 return new ConcatenateStrings(cont, args);
331 } 331 }
332 332
333 /// (DeclareFunction name = function in body) 333 /// (DeclareFunction name = function in body)
334 DeclareFunction parseDeclareFunction() { 334 DeclareFunction parseDeclareFunction() {
(...skipping 18 matching lines...) Expand all
353 InvokeConstructor parseInvokeConstructor() { 353 InvokeConstructor parseInvokeConstructor() {
354 tokens.consumeStart(INVOKE_CONSTRUCTOR); 354 tokens.consumeStart(INVOKE_CONSTRUCTOR);
355 355
356 String constructorName = tokens.read(); 356 String constructorName = tokens.read();
357 List<String> split = constructorName.split("."); 357 List<String> split = constructorName.split(".");
358 assert(split.length < 3); 358 assert(split.length < 3);
359 359
360 dart_types.DartType type = new DummyNamedType(split[0]); 360 dart_types.DartType type = new DummyNamedType(split[0]);
361 Element element = new DummyElement((split.length == 1) ? "" : split[1]); 361 Element element = new DummyElement((split.length == 1) ? "" : split[1]);
362 362
363 List<Definition> args = parseDefinitionList(); 363 List<Primitive> args = parseArgumentList();
364 364
365 Continuation cont = name2variable[tokens.read()]; 365 Continuation cont = name2variable[tokens.read()];
366 assert(cont != null); 366 assert(cont != null);
367 367
368 tokens.consumeEnd(); 368 tokens.consumeEnd();
369 Selector selector = dummySelector(constructorName, args.length); 369 Selector selector = dummySelector(constructorName, args.length);
370 return new InvokeConstructor(type, element, selector, cont, args); 370 return new InvokeConstructor(type, element, selector, cont, args);
371 } 371 }
372 372
373 /// (InvokeContinuation name args) 373 /// (InvokeContinuation name args)
374 InvokeContinuation parseInvokeContinuation(bool recursive) { 374 InvokeContinuation parseInvokeContinuation(bool recursive) {
375 tokens.consumeStart(recursive 375 tokens.consumeStart(recursive
376 ? INVOKE_CONTINUATION_RECURSIVE : INVOKE_CONTINUATION); 376 ? INVOKE_CONTINUATION_RECURSIVE : INVOKE_CONTINUATION);
377 377
378 Continuation cont = name2variable[tokens.read()]; 378 Continuation cont = name2variable[tokens.read()];
379 assert(cont != null); 379 assert(cont != null);
380 380
381 List<Definition> args = <Definition>[]; 381 List<Primitive> args = <Primitive>[];
382 while (tokens.current != ")") { 382 while (tokens.current != ")") {
383 Definition def = name2variable[tokens.read()]; 383 Primitive arg = name2variable[tokens.read()];
384 assert(def != null); 384 assert(arg != null);
385 args.add(def); 385 args.add(arg);
386 } 386 }
387 387
388 tokens.consumeEnd(); 388 tokens.consumeEnd();
389 return new InvokeContinuation(cont, args, recursive: recursive); 389 return new InvokeContinuation(cont, args, recursive: recursive);
390 } 390 }
391 391
392 /// (InvokeMethod receiver method args cont) 392 /// (InvokeMethod receiver method args cont)
393 InvokeMethod parseInvokeMethod() { 393 InvokeMethod parseInvokeMethod() {
394 tokens.consumeStart(INVOKE_METHOD); 394 tokens.consumeStart(INVOKE_METHOD);
395 395
396 Definition receiver = name2variable[tokens.read()]; 396 Definition receiver = name2variable[tokens.read()];
397 assert(receiver != null); 397 assert(receiver != null);
398 398
399 String methodName = tokens.read(); 399 String methodName = tokens.read();
400 400
401 List<Definition> args = parseDefinitionList(); 401 List<Primitive> args = parseArgumentList();
402 402
403 Continuation cont = name2variable[tokens.read()]; 403 Continuation cont = name2variable[tokens.read()];
404 assert(cont != null); 404 assert(cont != null);
405 405
406 tokens.consumeEnd(); 406 tokens.consumeEnd();
407 Selector selector = dummySelector(methodName, args.length); 407 Selector selector = dummySelector(methodName, args.length);
408 return new InvokeMethod(receiver, selector, cont, args); 408 return new InvokeMethod(receiver, selector, cont, args);
409 } 409 }
410 410
411 /// (InvokeStatic method args cont) 411 /// (InvokeStatic method args cont)
412 InvokeStatic parseInvokeStatic() { 412 InvokeStatic parseInvokeStatic() {
413 tokens.consumeStart(INVOKE_STATIC); 413 tokens.consumeStart(INVOKE_STATIC);
414 414
415 String methodName = tokens.read(); 415 String methodName = tokens.read();
416 416
417 List<Definition> args = parseDefinitionList(); 417 List<Primitive> args = parseArgumentList();
418 418
419 Continuation cont = name2variable[tokens.read()]; 419 Continuation cont = name2variable[tokens.read()];
420 assert(cont != null); 420 assert(cont != null);
421 421
422 Entity entity = new DummyEntity(methodName); 422 Entity entity = new DummyEntity(methodName);
423 Selector selector = dummySelector(methodName, args.length); 423 Selector selector = dummySelector(methodName, args.length);
424 424
425 tokens.consumeEnd(); 425 tokens.consumeEnd();
426 return new InvokeStatic(entity, selector, cont, args); 426 return new InvokeStatic(entity, selector, cont, args);
427 } 427 }
428 428
429 /// (InvokeSuperMethod method args cont) 429 /// (InvokeSuperMethod method args cont)
430 InvokeSuperMethod parseInvokeSuperMethod() { 430 InvokeSuperMethod parseInvokeSuperMethod() {
431 tokens.consumeStart(INVOKE_SUPER_METHOD); 431 tokens.consumeStart(INVOKE_SUPER_METHOD);
432 432
433 String methodName = tokens.read(); 433 String methodName = tokens.read();
434 434
435 List<Definition> args = parseDefinitionList(); 435 List<Primitive> args = parseArgumentList();
436 436
437 Continuation cont = name2variable[tokens.read()]; 437 Continuation cont = name2variable[tokens.read()];
438 assert(cont != null); 438 assert(cont != null);
439 439
440 tokens.consumeEnd(); 440 tokens.consumeEnd();
441 Selector selector = dummySelector(methodName, args.length); 441 Selector selector = dummySelector(methodName, args.length);
442 return new InvokeSuperMethod(selector, cont, args); 442 return new InvokeSuperMethod(selector, cont, args);
443 } 443 }
444 444
445 /// (LetCont (cont args) (cont_body)) body 445 /// (LetCont (cont args) (cont_body)) body
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 return new ReifyTypeVar(type); 678 return new ReifyTypeVar(type);
679 } 679 }
680 680
681 /// (This) 681 /// (This)
682 This parseThis() { 682 This parseThis() {
683 tokens.consumeStart(THIS); 683 tokens.consumeStart(THIS);
684 tokens.consumeEnd(); 684 tokens.consumeEnd();
685 return new This(); 685 return new This();
686 } 686 }
687 } 687 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698