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

Side by Side Diff: frog/minfrog

Issue 9107031: fix Library*NegativeTests (and a couple Prefix ones by accident) (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebased Created 8 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 #!/usr/bin/env node 1 #!/usr/bin/env node
2 // ********** Library dart:core ************** 2 // ********** Library dart:core **************
3 // ********** Natives dart:core ************** 3 // ********** Natives dart:core **************
4 function $throw(e) { 4 function $throw(e) {
5 // If e is not a value, we can use V8's captureStackTrace utility method. 5 // If e is not a value, we can use V8's captureStackTrace utility method.
6 // TODO(jmesserly): capture the stack trace on other JS engines. 6 // TODO(jmesserly): capture the stack trace on other JS engines.
7 if (e && (typeof e == 'object') && Error.captureStackTrace) { 7 if (e && (typeof e == 'object') && Error.captureStackTrace) {
8 // TODO(jmesserly): this will clobber the e.stack property 8 // TODO(jmesserly): this will clobber the e.stack property
9 Error.captureStackTrace(e, $throw); 9 Error.captureStackTrace(e, $throw);
10 } 10 }
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 }, enumerable: false, configurable: true }); 271 }, enumerable: false, configurable: true });
272 Object.defineProperty(Object.prototype, "namesInOrder$1", { value: function($0) { 272 Object.defineProperty(Object.prototype, "namesInOrder$1", { value: function($0) {
273 return this.noSuchMethod("namesInOrder", [$0]); 273 return this.noSuchMethod("namesInOrder", [$0]);
274 }, enumerable: false, configurable: true }); 274 }, enumerable: false, configurable: true });
275 Object.defineProperty(Object.prototype, "needsConversion$1", { value: function($ 0) { 275 Object.defineProperty(Object.prototype, "needsConversion$1", { value: function($ 0) {
276 return this.noSuchMethod("needsConversion", [$0]); 276 return this.noSuchMethod("needsConversion", [$0]);
277 }, enumerable: false, configurable: true }); 277 }, enumerable: false, configurable: true });
278 Object.defineProperty(Object.prototype, "next$0", { value: function() { 278 Object.defineProperty(Object.prototype, "next$0", { value: function() {
279 return this.noSuchMethod("next", []); 279 return this.noSuchMethod("next", []);
280 }, enumerable: false, configurable: true }); 280 }, enumerable: false, configurable: true });
281 Object.defineProperty(Object.prototype, "postResolveChecks$0", { value: function () {
282 return this.noSuchMethod("postResolveChecks", []);
283 }, enumerable: false, configurable: true });
281 Object.defineProperty(Object.prototype, "provideFieldSyntax$0", { value: functio n() { 284 Object.defineProperty(Object.prototype, "provideFieldSyntax$0", { value: functio n() {
282 return this.noSuchMethod("provideFieldSyntax", []); 285 return this.noSuchMethod("provideFieldSyntax", []);
283 }, enumerable: false, configurable: true }); 286 }, enumerable: false, configurable: true });
284 Object.defineProperty(Object.prototype, "providePropertySyntax$0", { value: func tion() { 287 Object.defineProperty(Object.prototype, "providePropertySyntax$0", { value: func tion() {
285 return this.noSuchMethod("providePropertySyntax", []); 288 return this.noSuchMethod("providePropertySyntax", []);
286 }, enumerable: false, configurable: true }); 289 }, enumerable: false, configurable: true });
287 Object.defineProperty(Object.prototype, "removeLast$0", { value: function() { 290 Object.defineProperty(Object.prototype, "removeLast$0", { value: function() {
288 return this.noSuchMethod("removeLast", []); 291 return this.noSuchMethod("removeLast", []);
289 }, enumerable: false, configurable: true }); 292 }, enumerable: false, configurable: true });
290 Object.defineProperty(Object.prototype, "replaceFirst$2", { value: function($0, $1) { 293 Object.defineProperty(Object.prototype, "replaceFirst$2", { value: function($0, $1) {
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 } 500 }
498 function _print(obj) { 501 function _print(obj) {
499 if (typeof console == 'object') { 502 if (typeof console == 'object') {
500 if (obj) obj = obj.toString(); 503 if (obj) obj = obj.toString();
501 console.log(obj); 504 console.log(obj);
502 } else { 505 } else {
503 write(obj); 506 write(obj);
504 write('\n'); 507 write('\n');
505 } 508 }
506 } 509 }
507 function _map(itemsAndKeys) {
508 var ret = new LinkedHashMapImplementation();
509 for (var i = (0);
510 i < itemsAndKeys.get$length(); ) {
511 ret.$setindex(itemsAndKeys.$index(i++), itemsAndKeys.$index(i++));
512 }
513 return ret;
514 }
515 function _toDartException(e) { 510 function _toDartException(e) {
516 function attachStack(dartEx) { 511 function attachStack(dartEx) {
517 // TODO(jmesserly): setting the stack property is not a long term solution. 512 // TODO(jmesserly): setting the stack property is not a long term solution.
518 var stack = e.stack; 513 var stack = e.stack;
519 // The stack contains the error message, and the stack is all that is 514 // The stack contains the error message, and the stack is all that is
520 // printed (the exception's toString() is never called). Make the Dart 515 // printed (the exception's toString() is never called). Make the Dart
521 // exception's toString() be the dominant message. 516 // exception's toString() be the dominant message.
522 if (typeof stack == 'string') { 517 if (typeof stack == 'string') {
523 var message = dartEx.toString(); 518 var message = dartEx.toString();
524 if (/^(Type|Range)Error:/.test(stack)) { 519 if (/^(Type|Range)Error:/.test(stack)) {
(...skipping 1315 matching lines...) Expand 10 before | Expand all | Expand 10 after
1840 return this; 1835 return this;
1841 } 1836 }
1842 1837
1843 // Note: using Function instead of 'eval' to get a clean scope. 1838 // Note: using Function instead of 'eval' to get a clean scope.
1844 // TODO(jmesserly): evaluate the performance of these stubs. 1839 // TODO(jmesserly): evaluate the performance of these stubs.
1845 var f = 'function(' + a.join(',') + '){return $f(' + p.join(',') + ');}'; 1840 var f = 'function(' + a.join(',') + '){return $f(' + p.join(',') + ');}';
1846 return new Function('$f', 'return ' + f + '').call(null, this); 1841 return new Function('$f', 'return ' + f + '').call(null, this);
1847 1842
1848 } 1843 }
1849 // ********** Code for top level ************** 1844 // ********** Code for top level **************
1845 function _map(itemsAndKeys) {
1846 var ret = new LinkedHashMapImplementation();
1847 for (var i = (0);
1848 i < itemsAndKeys.get$length(); ) {
1849 ret.$setindex(itemsAndKeys.$index(i++), itemsAndKeys.$index(i++));
1850 }
1851 return ret;
1852 }
1850 // ********** Library node ************** 1853 // ********** Library node **************
1851 // ********** Code for Process ************** 1854 // ********** Code for Process **************
1852 function Process(_process) { 1855 function Process(_process) {
1853 this.SIGSYS = "SIGSYS"; 1856 this.SIGSYS = "SIGSYS";
1854 this.SIGALRM = "SIGALRM"; 1857 this.SIGALRM = "SIGALRM";
1855 this.SIGXCPU = "SIGXCPU"; 1858 this.SIGXCPU = "SIGXCPU";
1856 this.SIGTSTP = "SIGTSTP"; 1859 this.SIGTSTP = "SIGTSTP";
1857 this.SIGSEGV = "SIGSEGV"; 1860 this.SIGSEGV = "SIGSEGV";
1858 this.SIGQUIT = "SIGQUIT"; 1861 this.SIGQUIT = "SIGQUIT";
1859 this.SIGABRT = "SIGABRT"; 1862 this.SIGABRT = "SIGABRT";
(...skipping 2551 matching lines...) Expand 10 before | Expand all | Expand 10 after
4411 } 4414 }
4412 for (var i = this.get$bareCount(); 4415 for (var i = this.get$bareCount();
4413 i < this.get$length(); i++) { 4416 i < this.get$length(); i++) {
4414 var name = this.getName(i); 4417 var name = this.getName(i);
4415 if (name == null) name = ("$" + i); 4418 if (name == null) name = ("$" + i);
4416 result.add$1(new Value($globals.world.varType, name, null, false)); 4419 result.add$1(new Value($globals.world.varType, name, null, false));
4417 } 4420 }
4418 return new Arguments(this.nodes, result); 4421 return new Arguments(this.nodes, result);
4419 } 4422 }
4420 // ********** Code for LibraryImport ************** 4423 // ********** Code for LibraryImport **************
4421 function LibraryImport(library, prefix) { 4424 function LibraryImport(library, prefix, span) {
4422 this.library = library; 4425 this.library = library;
4426 this.span = span;
4423 this.prefix = prefix; 4427 this.prefix = prefix;
4424 } 4428 }
4425 LibraryImport.prototype.get$prefix = function() { return this.prefix; }; 4429 LibraryImport.prototype.get$prefix = function() { return this.prefix; };
4426 LibraryImport.prototype.set$prefix = function(value) { return this.prefix = valu e; };
4427 LibraryImport.prototype.get$library = function() { return this.library; }; 4430 LibraryImport.prototype.get$library = function() { return this.library; };
4428 LibraryImport.prototype.set$library = function(value) { return this.library = va lue; }; 4431 LibraryImport.prototype.get$span = function() { return this.span; };
4432 // ********** Code for Member **************
4433 $inherits(Member, Element);
4434 function Member(name, declaringType) {
4435 this.isGenerated = false;
4436 this.declaringType = declaringType;
4437 this._provideFieldSyntax = false;
4438 this._providePropertySyntax = false;
4439 Element.call(this, name, declaringType);
4440 }
4441 Member.prototype.get$declaringType = function() { return this.declaringType; };
4442 Member.prototype.get$isGenerated = function() { return this.isGenerated; };
4443 Member.prototype.set$isGenerated = function(value) { return this.isGenerated = v alue; };
4444 Member.prototype.get$generator = function() { return this.generator; };
4445 Member.prototype.set$generator = function(value) { return this.generator = value ; };
4446 Member.prototype.get$library = function() {
4447 return this.declaringType.get$library();
4448 }
4449 Member.prototype.get$isPrivate = function() {
4450 return this.name != null && this.name.startsWith("_");
4451 }
4452 Member.prototype.get$isConstructor = function() {
4453 return false;
4454 }
4455 Member.prototype.get$isField = function() {
4456 return false;
4457 }
4458 Member.prototype.get$isMethod = function() {
4459 return false;
4460 }
4461 Member.prototype.get$isProperty = function() {
4462 return false;
4463 }
4464 Member.prototype.get$isAbstract = function() {
4465 return false;
4466 }
4467 Member.prototype.get$isFinal = function() {
4468 return false;
4469 }
4470 Member.prototype.get$isConst = function() {
4471 return false;
4472 }
4473 Member.prototype.get$isFactory = function() {
4474 return false;
4475 }
4476 Member.prototype.get$isOperator = function() {
4477 return this.name.startsWith(":");
4478 }
4479 Member.prototype.get$isCallMethod = function() {
4480 return this.name == ":call";
4481 }
4482 Member.prototype.get$requiresPropertySyntax = function() {
4483 return false;
4484 }
4485 Member.prototype.get$requiresFieldSyntax = function() {
4486 return false;
4487 }
4488 Member.prototype.get$isNative = function() {
4489 return false;
4490 }
4491 Member.prototype.get$constructorName = function() {
4492 $globals.world.internalError("can not be a constructor", this.get$span());
4493 }
4494 Member.prototype.provideFieldSyntax = function() {
4495
4496 }
4497 Member.prototype.providePropertySyntax = function() {
4498
4499 }
4500 Member.prototype.get$initDelegate = function() {
4501 $globals.world.internalError("cannot have initializers", this.get$span());
4502 }
4503 Member.prototype.set$initDelegate = function(ctor) {
4504 $globals.world.internalError("cannot have initializers", this.get$span());
4505 }
4506 Member.prototype.computeValue = function() {
4507 $globals.world.internalError("cannot have value", this.get$span());
4508 }
4509 Member.prototype.get$inferredResult = function() {
4510 var t = this.get$returnType();
4511 if (t.get$isBool() && (this.get$library().get$isCore() || this.get$library().g et$isCoreImpl())) {
4512 return $globals.world.nonNullBool;
4513 }
4514 return t;
4515 }
4516 Member.prototype.get$definition = function() {
4517 return null;
4518 }
4519 Member.prototype.get$parameters = function() {
4520 return [];
4521 }
4522 Member.prototype.canInvoke = function(context, args) {
4523 return this.get$canGet() && new Value(this.get$returnType(), null, null, true) .canInvoke(context, ":call", args);
4524 }
4525 Member.prototype.invoke = function(context, node, target, args, isDynamic) {
4526 var newTarget = this._get(context, node, target, isDynamic);
4527 return newTarget.invoke$5(context, ":call", node, args, isDynamic);
4528 }
4529 Member.prototype.override = function(other) {
4530 if (this.get$isStatic()) {
4531 $globals.world.error("static members can not hide parent members", this.get$ span(), other.get$span());
4532 return false;
4533 }
4534 else if (other.get$isStatic()) {
4535 $globals.world.error("can not override static member", this.get$span(), othe r.get$span());
4536 return false;
4537 }
4538 return true;
4539 }
4540 Member.prototype.get$generatedFactoryName = function() {
4541 var prefix = ("" + this.declaringType.get$jsname() + "." + this.get$constructo rName() + "$");
4542 if (this.name == "") {
4543 return ("" + prefix + "factory");
4544 }
4545 else {
4546 return ("" + prefix + this.name + "$factory");
4547 }
4548 }
4549 Member.prototype.hashCode = function() {
4550 var typeCode = this.declaringType == null ? (1) : this.declaringType.hashCode( );
4551 var nameCode = this.get$isConstructor() ? this.get$constructorName().hashCode( ) : this.name.hashCode();
4552 return (typeCode << (4)) ^ nameCode;
4553 }
4554 Member.prototype.$eq = function(other) {
4555 return (other instanceof Member) && $eq(this.get$isConstructor(), other.get$is Constructor()) && $eq(this.declaringType, other.get$declaringType()) && (this.ge t$isConstructor() ? this.get$constructorName() == other.get$constructorName() : this.name == other.get$name());
4556 }
4557 Member.prototype._get$3 = Member.prototype._get;
4558 Member.prototype._get$3$isDynamic = Member.prototype._get;
4559 Member.prototype._get$4 = Member.prototype._get;
4560 Member.prototype._set$4 = Member.prototype._set;
4561 Member.prototype._set$4$isDynamic = Member.prototype._set;
4562 Member.prototype._set$5 = Member.prototype._set;
4563 Member.prototype.canInvoke$2 = Member.prototype.canInvoke;
4564 Member.prototype.computeValue$0 = Member.prototype.computeValue;
4565 Member.prototype.hashCode$0 = Member.prototype.hashCode;
4566 Member.prototype.invoke$4 = function($0, $1, $2, $3) {
4567 return this.invoke($0, $1, $2, $3, false);
4568 };
4569 Member.prototype.invoke$4$isDynamic = Member.prototype.invoke;
4570 Member.prototype.invoke$5 = Member.prototype.invoke;
4571 Member.prototype.provideFieldSyntax$0 = Member.prototype.provideFieldSyntax;
4572 Member.prototype.providePropertySyntax$0 = Member.prototype.providePropertySynta x;
4573 // ********** Code for AmbiguousMember **************
4574 $inherits(AmbiguousMember, Member);
4575 function AmbiguousMember(name, members) {
4576 this.members = members;
4577 Member.call(this, name, null);
4578 }
4579 AmbiguousMember.prototype.get$members = function() { return this.members; };
4580 AmbiguousMember.prototype.set$members = function(value) { return this.members = value; };
4429 // ********** Code for Library ************** 4581 // ********** Code for Library **************
4430 $inherits(Library, Element); 4582 $inherits(Library, Element);
4431 function Library(baseSource) { 4583 function Library(baseSource) {
4432 this.baseSource = baseSource; 4584 this.baseSource = baseSource;
4433 this.isWritten = false; 4585 this.isWritten = false;
4434 Element.call(this, null, null); 4586 Element.call(this, null, null);
4435 this.sourceDir = dirname(this.baseSource.filename); 4587 this.sourceDir = dirname(this.baseSource.filename);
4436 this.topType = new DefinedType(null, this, null, true); 4588 this.topType = new DefinedType(null, this, null, true);
4437 this.types = _map(["", this.topType]); 4589 this.types = _map(["", this.topType]);
4438 this.imports = []; 4590 this.imports = [];
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
4470 Library.prototype.get$span = function() { 4622 Library.prototype.get$span = function() {
4471 return new SourceSpan(this.baseSource, (0), (0)); 4623 return new SourceSpan(this.baseSource, (0), (0));
4472 } 4624 }
4473 Library.prototype.makeFullPath = function(filename) { 4625 Library.prototype.makeFullPath = function(filename) {
4474 if (filename.startsWith("dart:")) return filename; 4626 if (filename.startsWith("dart:")) return filename;
4475 if (filename.startsWith("/")) return filename; 4627 if (filename.startsWith("/")) return filename;
4476 if (filename.startsWith("file:///")) return filename; 4628 if (filename.startsWith("file:///")) return filename;
4477 if (filename.startsWith("http://")) return filename; 4629 if (filename.startsWith("http://")) return filename;
4478 return joinPaths(this.sourceDir, filename); 4630 return joinPaths(this.sourceDir, filename);
4479 } 4631 }
4480 Library.prototype.addImport = function(fullname, prefix) { 4632 Library.prototype.addImport = function(fullname, prefix, span) {
4481 var newLib = $globals.world.getOrAddLibrary(fullname); 4633 var newLib = $globals.world.getOrAddLibrary(fullname);
4482 this.imports.add(new LibraryImport(newLib, prefix)); 4634 if (newLib.get$isCore()) return;
4635 this.imports.add(new LibraryImport(newLib, prefix, span));
4483 return newLib; 4636 return newLib;
4484 } 4637 }
4485 Library.prototype.addNative = function(fullname) { 4638 Library.prototype.addNative = function(fullname) {
4486 this.natives.add($globals.world.reader.readFile(fullname)); 4639 this.natives.add($globals.world.reader.readFile(fullname));
4487 } 4640 }
4488 Library.prototype._findMembers = function(name) { 4641 Library.prototype._findMembers = function(name) {
4489 if (name.startsWith("_")) { 4642 if (name.startsWith("_")) {
4490 return this._privateMembers.$index(name); 4643 return this._privateMembers.$index(name);
4491 } 4644 }
4492 else { 4645 else {
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
4607 return n.get$name(); 4760 return n.get$name();
4608 }) 4761 })
4609 ); 4762 );
4610 return type.name.name + "." + Strings.join(names, "."); 4763 return type.name.name + "." + Strings.join(names, ".");
4611 } 4764 }
4612 else { 4765 else {
4613 return type.name.name; 4766 return type.name.name;
4614 } 4767 }
4615 } 4768 }
4616 Library.prototype.lookup = function(name, span) { 4769 Library.prototype.lookup = function(name, span) {
4617 var retType = this.findTypeByName(name); 4770 return this._topNames.$index(name);
4618 var ret = null;
4619 if (retType != null) {
4620 ret = retType.get$typeMember();
4621 }
4622 var newRet = this.topType.getMember(name);
4623 if (newRet != null) {
4624 if (ret != null && $ne(ret, newRet)) {
4625 $globals.world.error(("conflicting members for \"" + name + "\""), span, r et.get$span(), newRet.get$span());
4626 }
4627 else {
4628 ret = newRet;
4629 }
4630 }
4631 var $$list = this.imports;
4632 for (var $$i = 0;$$i < $$list.get$length(); $$i++) {
4633 var imported = $$list.$index($$i);
4634 if (imported.get$prefix() == null) {
4635 newRet = imported.get$library().get$topType().getMember$1(name);
4636 if (newRet != null) {
4637 if (ret != null && $ne(ret, newRet)) {
4638 $globals.world.error(("conflicting members for \"" + name + "\""), spa n, ret.get$span(), newRet.get$span());
4639 }
4640 else {
4641 ret = newRet;
4642 }
4643 }
4644 }
4645 }
4646 return ret;
4647 } 4771 }
4648 Library.prototype.resolve = function() { 4772 Library.prototype.resolve = function() {
4649 if (this.name == null) { 4773 if (this.name == null) {
4650 this.name = this.baseSource.filename; 4774 this.name = this.baseSource.filename;
4651 var index = this.name.lastIndexOf("/", this.name.length); 4775 var index = this.name.lastIndexOf("/", this.name.length);
4652 if (index >= (0)) { 4776 if (index >= (0)) {
4653 this.name = this.name.substring(index + (1)); 4777 this.name = this.name.substring(index + (1));
4654 } 4778 }
4655 index = this.name.indexOf("."); 4779 index = this.name.indexOf(".");
4656 if (index > (0)) { 4780 if (index > (0)) {
4657 this.name = this.name.substring((0), index); 4781 this.name = this.name.substring((0), index);
4658 } 4782 }
4659 } 4783 }
4660 this._jsname = this.name.replaceAll(".", "_").replaceAll(":", "_").replaceAll( " ", "_"); 4784 this._jsname = this.name.replaceAll(".", "_").replaceAll(":", "_").replaceAll( " ", "_");
4661 var $$list = this.types.getValues(); 4785 var $$list = this.types.getValues();
4662 for (var $$i = this.types.getValues().iterator$0(); $$i.hasNext$0(); ) { 4786 for (var $$i = this.types.getValues().iterator$0(); $$i.hasNext$0(); ) {
4663 var type = $$i.next$0(); 4787 var type = $$i.next$0();
4664 type.resolve$0(); 4788 type.resolve$0();
4665 } 4789 }
4666 } 4790 }
4791 Library.prototype._addTopName = function(name, member, localSpan) {
4792 var existing = this._topNames.$index(name);
4793 if (existing == null) {
4794 this._topNames.$setindex(name, member);
4795 }
4796 else {
4797 if ((existing instanceof AmbiguousMember)) {
4798 existing.get$members().add$1(member);
4799 }
4800 else {
4801 var newMember = new AmbiguousMember(name, [existing, member]);
4802 $globals.world.error(("conflicting members for \"" + name + "\""), existin g.get$span(), member.get$span(), localSpan);
4803 this._topNames.$setindex(name, newMember);
4804 }
4805 }
4806 }
4807 Library.prototype._addTopNames = function(lib) {
4808 var $$list = lib.topType.members.getValues();
4809 for (var $$i = lib.topType.members.getValues().iterator$0(); $$i.hasNext$0(); ) {
4810 var member = $$i.next$0();
4811 if (member.get$isPrivate() && $ne(lib, this)) continue;
4812 this._addTopName(member.get$name(), member);
4813 }
4814 var $$list = lib.types.getValues();
4815 for (var $$i = lib.types.getValues().iterator$0(); $$i.hasNext$0(); ) {
4816 var type = $$i.next$0();
4817 if (!type.get$isTop()) {
4818 if ($ne(lib, this) && type.get$typeMember().get$isPrivate()) continue;
4819 this._addTopName(type.get$name(), type.get$typeMember());
4820 }
4821 }
4822 }
4823 Library.prototype.postResolveChecks = function() {
4824 this._topNames = new HashMapImplementation();
4825 this._addTopNames(this);
4826 var $$list = this.imports;
4827 for (var $$i = 0;$$i < $$list.get$length(); $$i++) {
4828 var imported = $$list.$index($$i);
4829 if (imported.get$prefix() == null) {
4830 this._addTopNames(imported.get$library());
4831 }
4832 else {
4833 this._addTopName(imported.get$prefix(), imported.get$library().get$topType ().get$typeMember(), imported.get$span());
4834 }
4835 }
4836 }
4667 Library.prototype.visitSources = function() { 4837 Library.prototype.visitSources = function() {
4668 var visitor = new _LibraryVisitor(this); 4838 var visitor = new _LibraryVisitor(this);
4669 visitor.addSource$1(this.baseSource); 4839 visitor.addSource$1(this.baseSource);
4670 } 4840 }
4671 Library.prototype.toString = function() { 4841 Library.prototype.toString = function() {
4672 return this.baseSource.filename; 4842 return this.baseSource.filename;
4673 } 4843 }
4674 Library.prototype.hashCode = function() { 4844 Library.prototype.hashCode = function() {
4675 return this.baseSource.filename.hashCode(); 4845 return this.baseSource.filename.hashCode();
4676 } 4846 }
4677 Library.prototype.$eq = function(other) { 4847 Library.prototype.$eq = function(other) {
4678 return (other instanceof Library) && $eq(other.get$baseSource().get$filename() , this.baseSource.filename); 4848 return (other instanceof Library) && $eq(other.get$baseSource().get$filename() , this.baseSource.filename);
4679 } 4849 }
4680 Library.prototype.findTypeByName$1 = Library.prototype.findTypeByName; 4850 Library.prototype.findTypeByName$1 = Library.prototype.findTypeByName;
4681 Library.prototype.hashCode$0 = Library.prototype.hashCode; 4851 Library.prototype.hashCode$0 = Library.prototype.hashCode;
4852 Library.prototype.postResolveChecks$0 = Library.prototype.postResolveChecks;
4682 Library.prototype.resolve$0 = Library.prototype.resolve; 4853 Library.prototype.resolve$0 = Library.prototype.resolve;
4683 Library.prototype.toString$0 = Library.prototype.toString; 4854 Library.prototype.toString$0 = Library.prototype.toString;
4684 Library.prototype.visitSources$0 = Library.prototype.visitSources; 4855 Library.prototype.visitSources$0 = Library.prototype.visitSources;
4685 // ********** Code for _LibraryVisitor ************** 4856 // ********** Code for _LibraryVisitor **************
4686 function _LibraryVisitor(library) { 4857 function _LibraryVisitor(library) {
4687 this.library = library; 4858 this.library = library;
4688 this.isTop = true; 4859 this.isTop = true;
4689 this.seenSource = false; 4860 this.seenSource = false;
4690 this.seenResource = false; 4861 this.seenResource = false;
4691 this.seenImport = false; 4862 this.seenImport = false;
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
4775 } 4946 }
4776 if ($eq(prefix, "")) prefix = null; 4947 if ($eq(prefix, "")) prefix = null;
4777 var filename = this.library.makeFullPath(name); 4948 var filename = this.library.makeFullPath(name);
4778 if (this.library.imports.some((function (li) { 4949 if (this.library.imports.some((function (li) {
4779 return $eq(li.get$library().get$baseSource(), filename); 4950 return $eq(li.get$library().get$baseSource(), filename);
4780 }) 4951 })
4781 )) { 4952 )) {
4782 $globals.world.error(("duplicate import of \"" + name + "\""), node.span ); 4953 $globals.world.error(("duplicate import of \"" + name + "\""), node.span );
4783 return; 4954 return;
4784 } 4955 }
4785 var newLib = this.library.addImport(filename, prefix); 4956 var newLib = this.library.addImport(filename, prefix, node.span);
4786 break; 4957 break;
4787 4958
4788 case "source": 4959 case "source":
4789 4960
4790 this.seenSource = true; 4961 this.seenSource = true;
4791 name = this.getSingleStringArg(node); 4962 name = this.getSingleStringArg(node);
4792 this.addSourceFromName(name, node.span); 4963 this.addSourceFromName(name, node.span);
4793 if (this.seenResource) { 4964 if (this.seenResource) {
4794 $globals.world.error("#sources must come before any #resource", node.spa n); 4965 $globals.world.error("#sources must come before any #resource", node.spa n);
4795 } 4966 }
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
4933 } 5104 }
4934 Parameter.prototype.get$isOptional = function() { 5105 Parameter.prototype.get$isOptional = function() {
4935 return this.definition != null && this.definition.value != null; 5106 return this.definition != null && this.definition.value != null;
4936 } 5107 }
4937 Parameter.prototype.get$hasDefaultValue = function() { 5108 Parameter.prototype.get$hasDefaultValue = function() {
4938 return this.definition.value.span.start != this.definition.span.start; 5109 return this.definition.value.span.start != this.definition.span.start;
4939 } 5110 }
4940 Parameter.prototype.copyWithNewType$2 = Parameter.prototype.copyWithNewType; 5111 Parameter.prototype.copyWithNewType$2 = Parameter.prototype.copyWithNewType;
4941 Parameter.prototype.genValue$2 = Parameter.prototype.genValue; 5112 Parameter.prototype.genValue$2 = Parameter.prototype.genValue;
4942 Parameter.prototype.resolve$0 = Parameter.prototype.resolve; 5113 Parameter.prototype.resolve$0 = Parameter.prototype.resolve;
4943 // ********** Code for Member **************
4944 $inherits(Member, Element);
4945 function Member(name, declaringType) {
4946 this.isGenerated = false;
4947 this.declaringType = declaringType;
4948 this._provideFieldSyntax = false;
4949 this._providePropertySyntax = false;
4950 Element.call(this, name, declaringType);
4951 }
4952 Member.prototype.get$declaringType = function() { return this.declaringType; };
4953 Member.prototype.get$isGenerated = function() { return this.isGenerated; };
4954 Member.prototype.set$isGenerated = function(value) { return this.isGenerated = v alue; };
4955 Member.prototype.get$generator = function() { return this.generator; };
4956 Member.prototype.set$generator = function(value) { return this.generator = value ; };
4957 Member.prototype.get$library = function() {
4958 return this.declaringType.get$library();
4959 }
4960 Member.prototype.get$isPrivate = function() {
4961 return this.name.startsWith("_");
4962 }
4963 Member.prototype.get$isConstructor = function() {
4964 return false;
4965 }
4966 Member.prototype.get$isField = function() {
4967 return false;
4968 }
4969 Member.prototype.get$isMethod = function() {
4970 return false;
4971 }
4972 Member.prototype.get$isProperty = function() {
4973 return false;
4974 }
4975 Member.prototype.get$isAbstract = function() {
4976 return false;
4977 }
4978 Member.prototype.get$isFinal = function() {
4979 return false;
4980 }
4981 Member.prototype.get$isConst = function() {
4982 return false;
4983 }
4984 Member.prototype.get$isFactory = function() {
4985 return false;
4986 }
4987 Member.prototype.get$isOperator = function() {
4988 return this.name.startsWith(":");
4989 }
4990 Member.prototype.get$isCallMethod = function() {
4991 return this.name == ":call";
4992 }
4993 Member.prototype.get$requiresPropertySyntax = function() {
4994 return false;
4995 }
4996 Member.prototype.get$requiresFieldSyntax = function() {
4997 return false;
4998 }
4999 Member.prototype.get$isNative = function() {
5000 return false;
5001 }
5002 Member.prototype.get$constructorName = function() {
5003 $globals.world.internalError("can not be a constructor", this.get$span());
5004 }
5005 Member.prototype.provideFieldSyntax = function() {
5006
5007 }
5008 Member.prototype.providePropertySyntax = function() {
5009
5010 }
5011 Member.prototype.get$initDelegate = function() {
5012 $globals.world.internalError("cannot have initializers", this.get$span());
5013 }
5014 Member.prototype.set$initDelegate = function(ctor) {
5015 $globals.world.internalError("cannot have initializers", this.get$span());
5016 }
5017 Member.prototype.computeValue = function() {
5018 $globals.world.internalError("cannot have value", this.get$span());
5019 }
5020 Member.prototype.get$inferredResult = function() {
5021 var t = this.get$returnType();
5022 if (t.get$isBool() && (this.get$library().get$isCore() || this.get$library().g et$isCoreImpl())) {
5023 return $globals.world.nonNullBool;
5024 }
5025 return t;
5026 }
5027 Member.prototype.get$definition = function() {
5028 return null;
5029 }
5030 Member.prototype.get$parameters = function() {
5031 return [];
5032 }
5033 Member.prototype.canInvoke = function(context, args) {
5034 return this.get$canGet() && new Value(this.get$returnType(), null, null, true) .canInvoke(context, ":call", args);
5035 }
5036 Member.prototype.invoke = function(context, node, target, args, isDynamic) {
5037 var newTarget = this._get(context, node, target, isDynamic);
5038 return newTarget.invoke$5(context, ":call", node, args, isDynamic);
5039 }
5040 Member.prototype.override = function(other) {
5041 if (this.get$isStatic()) {
5042 $globals.world.error("static members can not hide parent members", this.get$ span(), other.get$span());
5043 return false;
5044 }
5045 else if (other.get$isStatic()) {
5046 $globals.world.error("can not override static member", this.get$span(), othe r.get$span());
5047 return false;
5048 }
5049 return true;
5050 }
5051 Member.prototype.get$generatedFactoryName = function() {
5052 var prefix = ("" + this.declaringType.get$jsname() + "." + this.get$constructo rName() + "$");
5053 if (this.name == "") {
5054 return ("" + prefix + "factory");
5055 }
5056 else {
5057 return ("" + prefix + this.name + "$factory");
5058 }
5059 }
5060 Member.prototype.hashCode = function() {
5061 var typeCode = this.declaringType == null ? (1) : this.declaringType.hashCode( );
5062 var nameCode = this.get$isConstructor() ? this.get$constructorName().hashCode( ) : this.name.hashCode();
5063 return (typeCode << (4)) ^ nameCode;
5064 }
5065 Member.prototype.$eq = function(other) {
5066 return (other instanceof Member) && $eq(this.get$isConstructor(), other.get$is Constructor()) && $eq(this.declaringType, other.get$declaringType()) && (this.ge t$isConstructor() ? this.get$constructorName() == other.get$constructorName() : this.name == other.get$name());
5067 }
5068 Member.prototype._get$3 = Member.prototype._get;
5069 Member.prototype._get$3$isDynamic = Member.prototype._get;
5070 Member.prototype._get$4 = Member.prototype._get;
5071 Member.prototype._set$4 = Member.prototype._set;
5072 Member.prototype._set$4$isDynamic = Member.prototype._set;
5073 Member.prototype._set$5 = Member.prototype._set;
5074 Member.prototype.canInvoke$2 = Member.prototype.canInvoke;
5075 Member.prototype.computeValue$0 = Member.prototype.computeValue;
5076 Member.prototype.hashCode$0 = Member.prototype.hashCode;
5077 Member.prototype.invoke$4 = function($0, $1, $2, $3) {
5078 return this.invoke($0, $1, $2, $3, false);
5079 };
5080 Member.prototype.invoke$4$isDynamic = Member.prototype.invoke;
5081 Member.prototype.invoke$5 = Member.prototype.invoke;
5082 Member.prototype.provideFieldSyntax$0 = Member.prototype.provideFieldSyntax;
5083 Member.prototype.providePropertySyntax$0 = Member.prototype.providePropertySynta x;
5084 // ********** Code for TypeMember ************** 5114 // ********** Code for TypeMember **************
5085 $inherits(TypeMember, Member); 5115 $inherits(TypeMember, Member);
5086 function TypeMember(type) { 5116 function TypeMember(type) {
5087 this.type = type; 5117 this.type = type;
5088 Member.call(this, type.name, type.library.topType); 5118 Member.call(this, type.name, type.library.topType);
5089 } 5119 }
5090 TypeMember.prototype.get$type = function() { return this.type; }; 5120 TypeMember.prototype.get$type = function() { return this.type; };
5091 TypeMember.prototype.get$span = function() { 5121 TypeMember.prototype.get$span = function() {
5092 return this.type.definition.span; 5122 return this.type.definition == null ? null : this.type.definition.span;
5093 } 5123 }
5094 TypeMember.prototype.get$isStatic = function() { 5124 TypeMember.prototype.get$isStatic = function() {
5095 return true; 5125 return true;
5096 } 5126 }
5097 TypeMember.prototype.get$returnType = function() { 5127 TypeMember.prototype.get$returnType = function() {
5098 return $globals.world.varType; 5128 return $globals.world.varType;
5099 } 5129 }
5100 TypeMember.prototype.canInvoke = function(context, args) { 5130 TypeMember.prototype.canInvoke = function(context, args) {
5101 return false; 5131 return false;
5102 } 5132 }
(...skipping 7806 matching lines...) Expand 10 before | Expand all | Expand 10 after
12909 ListValue.prototype.binop$4 = ListValue.prototype.binop; 12939 ListValue.prototype.binop$4 = ListValue.prototype.binop;
12910 ListValue.prototype.getGlobalValue$0 = ListValue.prototype.getGlobalValue; 12940 ListValue.prototype.getGlobalValue$0 = ListValue.prototype.getGlobalValue;
12911 // ********** Code for MapValue ************** 12941 // ********** Code for MapValue **************
12912 $inherits(MapValue, EvaluatedValue); 12942 $inherits(MapValue, EvaluatedValue);
12913 function MapValue(values, isConst, type, span) { 12943 function MapValue(values, isConst, type, span) {
12914 this.values = values; 12944 this.values = values;
12915 EvaluatedValue.call(this, isConst, type, span); 12945 EvaluatedValue.call(this, isConst, type, span);
12916 } 12946 }
12917 MapValue.prototype.get$code = function() { 12947 MapValue.prototype.get$code = function() {
12918 var items = new ListValue(this.values, false, $globals.world.listType, this.sp an); 12948 var items = new ListValue(this.values, false, $globals.world.listType, this.sp an);
12919 var tp = $globals.world.corelib.topType; 12949 var tp = $globals.world.coreimpl.topType;
12920 var f = this.isConst ? tp.getMember$1("_constMap") : tp.getMember$1("_map"); 12950 var f = this.isConst ? tp.getMember$1("_constMap") : tp.getMember$1("_map");
12921 var value = f.invoke(null, null, new Value.type$ctor(tp, null), new Arguments( null, [items]), false); 12951 var value = f.invoke(null, null, new Value.type$ctor(tp, null), new Arguments( null, [items]), false);
12922 return value.get$code(); 12952 return value.get$code();
12923 } 12953 }
12924 MapValue.prototype.getGlobalValue = function() { 12954 MapValue.prototype.getGlobalValue = function() {
12925 return $globals.world.gen.globalForConst(this, this.values); 12955 return $globals.world.gen.globalForConst(this, this.values);
12926 } 12956 }
12927 MapValue.prototype.binop = function(kind, other, context, node) { 12957 MapValue.prototype.binop = function(kind, other, context, node) {
12928 if (!(other instanceof MapValue)) return Value.prototype.binop.call(this, kind , other, context, node); 12958 if (!(other instanceof MapValue)) return Value.prototype.binop.call(this, kind , other, context, node);
12929 switch (kind) { 12959 switch (kind) {
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
13370 var library = this.getOrAddLibrary(script); 13400 var library = this.getOrAddLibrary(script);
13371 this.process(); 13401 this.process();
13372 return library; 13402 return library;
13373 } 13403 }
13374 World.prototype.resolveAll = function() { 13404 World.prototype.resolveAll = function() {
13375 var $$list = this.libraries.getValues(); 13405 var $$list = this.libraries.getValues();
13376 for (var $$i = this.libraries.getValues().iterator$0(); $$i.hasNext$0(); ) { 13406 for (var $$i = this.libraries.getValues().iterator$0(); $$i.hasNext$0(); ) {
13377 var lib = $$i.next$0(); 13407 var lib = $$i.next$0();
13378 lib.resolve$0(); 13408 lib.resolve$0();
13379 } 13409 }
13410 var $$list = this.libraries.getValues();
13411 for (var $$i = this.libraries.getValues().iterator$0(); $$i.hasNext$0(); ) {
13412 var lib = $$i.next$0();
13413 lib.postResolveChecks$0();
13414 }
13380 } 13415 }
13381 World.prototype.get$resolveAll = function() { 13416 World.prototype.get$resolveAll = function() {
13382 return this.resolveAll.bind(this); 13417 return this.resolveAll.bind(this);
13383 } 13418 }
13384 World.prototype.findMainMethod = function(lib) { 13419 World.prototype.findMainMethod = function(lib) {
13385 var mainMembers = lib.topType.resolveMember("main"); 13420 var mainMembers = lib.topType.resolveMember("main");
13386 var main = null; 13421 var main = null;
13387 if (mainMembers == null || $eq(mainMembers.get$members().get$length(), (0))) { 13422 if (mainMembers == null || $eq(mainMembers.get$members().get$length(), (0))) {
13388 this.fatal("no main method specified"); 13423 this.fatal("no main method specified");
13389 } 13424 }
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after
13975 $globals._RED_COLOR = "\x1b[31m"; 14010 $globals._RED_COLOR = "\x1b[31m";
13976 } 14011 }
13977 var const$0000 = Object.create(EmptyQueueException.prototype, {}); 14012 var const$0000 = Object.create(EmptyQueueException.prototype, {});
13978 var const$0001 = Object.create(_DeletedKeySentinel.prototype, {}); 14013 var const$0001 = Object.create(_DeletedKeySentinel.prototype, {});
13979 var const$0005 = Object.create(NoMoreElementsException.prototype, {}); 14014 var const$0005 = Object.create(NoMoreElementsException.prototype, {});
13980 var const$0007 = Object.create(IllegalAccessException.prototype, {}); 14015 var const$0007 = Object.create(IllegalAccessException.prototype, {});
13981 var const$0008 = ImmutableList.ImmutableList$from$factory([]); 14016 var const$0008 = ImmutableList.ImmutableList$from$factory([]);
13982 var $globals = {}; 14017 var $globals = {};
13983 $static_init(); 14018 $static_init();
13984 main(); 14019 main();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698