correct System.register regex (#1071)

This commit is contained in:
guybedford 2016-02-03 15:04:01 +02:00
parent 7ea9734098
commit e472ecce1a
3 changed files with 23 additions and 1 deletions

View File

@ -51,7 +51,7 @@
*
*/
var leadingCommentAndMetaRegEx = /^\s*(\/\*[^\*]*(\*(?!\/)[^\*]*)*\*\/|\s*\/\/[^\n]*|\s*"[^"]+"\s*;?|\s*'[^']+'\s*;?)*\s*/;
var leadingCommentAndMetaRegEx = /^(\s*\/\*[^\*]*(\*(?!\/)[^\*]*)*\*\/|\s*\/\/[^\n]*|\s*"[^"]+"\s*;?|\s*'[^']+'\s*;?)*\s*/;
function detectRegisterFormat(source) {
var leadingCommentAndMeta = source.match(leadingCommentAndMetaRegEx);
return leadingCommentAndMeta && source.substr(leadingCommentAndMeta[0].length, 15) == 'System.register';

View File

@ -514,6 +514,13 @@ asyncTest('System.register regex test', function() {
}, err);
});
asyncTest('System.register regex test 2', function() {
System['import']('tests/register-regex-2.js').then(function(m) {
ok(m);
start();
}, err);
});
asyncTest('System.register module name arg', function() {
System['import']('tests/module-name.js').then(function(m) {
ok(m.name == System.baseURL + 'tests/module-name.js');

View File

@ -0,0 +1,15 @@
/**
* @file file comment
* ...
*/
/**
* module comment
* ...
*/
System.register([], function() {
return {
setters: [],
execute: function() {}
};
});