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

Unified Diff: frog/minfrog

Issue 8788004: Fixing parsing of factories. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: updated minfrog Created 9 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | frog/parser.dart » ('j') | frog/parser.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: frog/minfrog
diff --git a/frog/minfrog b/frog/minfrog
index e5b4d093aa65252ec38eb1230b6d7f36f5487961..1e2b9bdda7a01eae2c83c41e9d9bc8b7abe6cf91 100755
--- a/frog/minfrog
+++ b/frog/minfrog
@@ -8128,7 +8128,10 @@ Parser.prototype.classDefinition = function(kind) {
}
var _factory = null;
if (this._maybeEat(75/*TokenKind.FACTORY*/)) {
- _factory = this.type(0);
+ _factory = this.nameTypeReference();
+ if (this._peekKind(52/*TokenKind.LT*/)) {
+ this.typeParameters();
+ }
}
var body = [];
if (this._maybeEat(6/*TokenKind.LBRACE*/)) {
@@ -9345,7 +9348,7 @@ Parser.prototype.typeList = function() {
while (this._maybeEat(11/*TokenKind.COMMA*/))
return types;
}
-Parser.prototype.type = function(depth) {
+Parser.prototype.nameTypeReference = function() {
var start = this._peekToken.start;
var name;
var names = null;
@@ -9377,7 +9380,10 @@ Parser.prototype.type = function(depth) {
if (names == null) names = [];
names.add$1(this.identifier());
}
- var typeRef = new NameTypeReference(isFinal, name, names, this._makeSpan(start));
+ return new NameTypeReference(isFinal, name, names, this._makeSpan(start));
+}
+Parser.prototype.type = function(depth) {
+ var typeRef = this.nameTypeReference();
if (this._peekKind(52/*TokenKind.LT*/)) {
return this.addTypeArguments(typeRef, depth);
}
@@ -12444,6 +12450,7 @@ World.prototype.withTiming = function(name, f) {
}
// ********** Code for FrogOptions **************
function FrogOptions(homedir, args, files) {
+ this.config = 'dev'
this.enableLeg = false
this.legOnly = false
this.enableAsserts = false
@@ -12460,7 +12467,16 @@ function FrogOptions(homedir, args, files) {
this.showInfo = false
this.showWarnings = true
// Initializers done
- this.libDir = homedir + '/lib';
+ if ($eq(this.config, 'dev')) {
+ this.libDir = joinPaths(homedir, '/lib');
+ }
+ else if ($eq(this.config, 'sdk')) {
+ this.libDir = joinPaths(homedir, '/../lib');
+ }
+ else {
+ $globals.world.error(('Invalid configuration ' + this.config));
+ $throw(('Invalid configuration'));
+ }
var ignoreUnrecognizedFlags = false;
var passedLibDir = false;
this.childArgs = [];
@@ -12568,7 +12584,7 @@ function FrogOptions(homedir, args, files) {
}
}
- if (!passedLibDir && !files.fileExists(this.libDir)) {
+ if (!passedLibDir && $eq(this.config, 'dev') && !files.fileExists(this.libDir)) {
var temp = 'frog/lib';
if (files.fileExists(temp)) {
this.libDir = temp;
@@ -12581,7 +12597,15 @@ function FrogOptions(homedir, args, files) {
// ********** Code for LibraryReader **************
function LibraryReader() {
// Initializers done
- this._specialLibs = _map(['dart:core', joinPaths($globals.options.libDir, 'corelib.dart'), 'dart:coreimpl', joinPaths($globals.options.libDir, 'corelib_impl.dart'), 'dart:html', joinPaths($globals.options.libDir, '../../client/html/release/html.dart'), 'dart:htmlimpl', joinPaths($globals.options.libDir, '../../client/html/release/htmlimpl.dart'), 'dart:dom', joinPaths($globals.options.libDir, '../../client/dom/frog/frog_dom.dart'), 'dart:json', joinPaths($globals.options.libDir, 'json.dart')]);
+ if ($eq($globals.options.config, 'dev')) {
+ this._specialLibs = _map(['dart:core', joinPaths($globals.options.libDir, 'corelib.dart'), 'dart:coreimpl', joinPaths($globals.options.libDir, 'corelib_impl.dart'), 'dart:html', joinPaths($globals.options.libDir, '../../client/html/release/html.dart'), 'dart:htmlimpl', joinPaths($globals.options.libDir, '../../client/html/release/htmlimpl.dart'), 'dart:dom', joinPaths($globals.options.libDir, '../../client/dom/frog/frog_dom.dart'), 'dart:json', joinPaths($globals.options.libDir, 'json.dart')]);
+ }
+ else if ($eq($globals.options.config, 'sdk')) {
+ this._specialLibs = _map(['dart:core', joinPaths($globals.options.libDir, 'core/core_frog.dart'), 'dart:coreimpl', joinPaths($globals.options.libDir, 'coreimpl/coreimpl_frog.dart'), 'dart:html', joinPaths($globals.options.libDir, 'html/html.dart'), 'dart:htmlimpl', joinPaths($globals.options.libDir, 'htmlimpl/htmlimpl.dart'), 'dart:dom', joinPaths($globals.options.libDir, 'dom/frog/frog_dom.dart'), 'dart:json', joinPaths($globals.options.libDir, 'coreimpl/frog/json.dart')]);
+ }
+ else {
+ $globals.world.error(('Invalid configuration ' + $globals.options.config));
+ }
}
LibraryReader.prototype.readFile = function(fullname) {
var filename = this._specialLibs.$index(fullname);
« no previous file with comments | « no previous file | frog/parser.dart » ('j') | frog/parser.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698