Skip to content

Commit

Permalink
Merge pull request #247 from bryan-m-hughes/timob-14261
Browse files Browse the repository at this point in the history
[TIMOB-14261] Changed infinite loop warnings to errors and removed hard-coded platform list
  • Loading branch information
pinnamur committed Sep 19, 2013
2 parents 9e91125 + aa4b738 commit cbbd201
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 13 deletions.
2 changes: 1 addition & 1 deletion lib/rules/AST_Do.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ AST.registerRuleProcessor('AST_Do', function processRule() {
ruleName: this.className,
ast: this
});
Runtime.reportWarning('maxIterationsExceeded', eventDescription);
Runtime.reportError('maxIterationsExceeded', eventDescription);

this._ambiguousBlock = true;
Base.enterAmbiguousBlock();
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/AST_For.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ AST.registerRuleProcessor('AST_For', function processRule() {
ruleName: this.className,
ast: this
});
Runtime.reportWarning('maxIterationsExceeded', eventDescription);
Runtime.reportError('maxIterationsExceeded', eventDescription);

this._ambiguousBlock = true;
Base.enterAmbiguousBlock();
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/AST_ForIn.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ AST.registerRuleProcessor('AST_ForIn', function processRule() {
ruleName: this.className,
ast: this
});
Runtime.reportWarning('maxIterationsExceeded', eventDescription);
Runtime.reportError('maxIterationsExceeded', eventDescription);

this._ambiguousBlock = true;
Base.enterAmbiguousBlock();
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/AST_While.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ AST.registerRuleProcessor('AST_While', function processRule() {
ruleName: this.className,
ast: this
});
Runtime.reportWarning('maxIterationsExceeded', eventDescription);
Runtime.reportError('maxIterationsExceeded', eventDescription);

this._ambiguousBlock = true;
Base.enterAmbiguousBlock();
Expand Down
26 changes: 17 additions & 9 deletions plugins/ti-api-provider/lib/TiAPIProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,6 @@ exports.init = function init(options) {
process.exit(1);
}

if (!platform) {
console.error('The ' + exports.displayName + ' plugin requires the "platform" option');
process.exit(1);
}
if (platformList.indexOf(platform) === -1) {
console.error('"' + platform + '" is not a valid platform for the ' + exports.displayName + ' plugin');
process.exit(1);
}

// Parse and validate the JSCA file
jsca = path.join(options.sdkPath, 'api.jsca');
if (!fs.existsSync(jsca)) {
Expand Down Expand Up @@ -117,6 +108,23 @@ exports.init = function init(options) {
}
}

// Validate the platform information
platformList = manifest.platforms || platformList;
if (platformList.indexOf('iphone') != -1 && platformList.indexOf('ipad') == -1) {
platformList.push('ipad');
}
if (platformList.indexOf('ipad') != -1 && platformList.indexOf('iphone') == -1) {
platformList.push('iphone');
}
if (!platform) {
console.error('The ' + exports.displayName + ' plugin requires the "platform" option');
process.exit(1);
}
if (platformList.indexOf(platform) === -1) {
console.error('"' + platform + '" is not a valid platform for the ' + exports.displayName + ' plugin');
process.exit(1);
}

// Validate the SDK version
if (appc.version.lt(manifest.version, '2.1.0')) {
console.error('The ' + exports.displayName + ' plugin only works with SDK 2.1.0 or newer');
Expand Down

0 comments on commit cbbd201

Please sign in to comment.