mirror of
https://github.com/atom/atom.git
synced 2026-02-14 08:35:11 -05:00
Use class methods to create native object shims
CoffeeScript 1.5 complains if a constructor has a returns a value.
This commit is contained in:
@@ -24,7 +24,7 @@ class Git
|
||||
ignore: 1 << 14
|
||||
|
||||
constructor: (path, options={}) ->
|
||||
@repo = new GitRepository(path)
|
||||
@repo = GitRepository.open(path)
|
||||
refreshIndexOnFocus = options.refreshIndexOnFocus ? true
|
||||
if refreshIndexOnFocus
|
||||
$ = require 'jquery'
|
||||
|
||||
@@ -30,13 +30,13 @@ class LanguageMode
|
||||
|
||||
buffer = @editSession.buffer
|
||||
commentStartRegexString = _.escapeRegExp(commentStartString).replace(/(\s+)$/, '($1)?')
|
||||
commentStartRegex = new OnigRegExp("^(\\s*)(#{commentStartRegexString})")
|
||||
commentStartRegex = OnigRegExp.create("^(\\s*)(#{commentStartRegexString})")
|
||||
shouldUncomment = commentStartRegex.test(buffer.lineForRow(start))
|
||||
|
||||
if commentEndString = syntax.getProperty(scopes, "editor.commentEnd")
|
||||
if shouldUncomment
|
||||
commentEndRegexString = _.escapeRegExp(commentEndString).replace(/^(\s+)/, '($1)?')
|
||||
commentEndRegex = new OnigRegExp("(#{commentEndRegexString})(\\s*)$")
|
||||
commentEndRegex = OnigRegExp.create("(#{commentEndRegexString})(\\s*)$")
|
||||
startMatch = commentStartRegex.search(buffer.lineForRow(start))
|
||||
endMatch = commentEndRegex.search(buffer.lineForRow(end))
|
||||
if startMatch and endMatch
|
||||
@@ -152,12 +152,12 @@ class LanguageMode
|
||||
|
||||
increaseIndentRegexForScopes: (scopes) ->
|
||||
if increaseIndentPattern = syntax.getProperty(scopes, 'editor.increaseIndentPattern')
|
||||
new OnigRegExp(increaseIndentPattern)
|
||||
OnigRegExp.create(increaseIndentPattern)
|
||||
|
||||
decreaseIndentRegexForScopes: (scopes) ->
|
||||
if decreaseIndentPattern = syntax.getProperty(scopes, 'editor.decreaseIndentPattern')
|
||||
new OnigRegExp(decreaseIndentPattern)
|
||||
OnigRegExp.create(decreaseIndentPattern)
|
||||
|
||||
foldEndRegexForScopes: (scopes) ->
|
||||
if foldEndPattern = syntax.getProperty(scopes, 'editor.foldEndPattern')
|
||||
new OnigRegExp(foldEndPattern)
|
||||
OnigRegExp.create(foldEndPattern)
|
||||
|
||||
@@ -28,7 +28,7 @@ class TextMateGrammar
|
||||
constructor: ({ @name, @fileTypes, @scopeName, patterns, repository, @foldingStopMarker, firstLineMatch}) ->
|
||||
@initialRule = new Rule(this, {@scopeName, patterns})
|
||||
@repository = {}
|
||||
@firstLineRegex = new OnigRegExp(firstLineMatch) if firstLineMatch
|
||||
@firstLineRegex = OnigRegExp.create(firstLineMatch) if firstLineMatch
|
||||
@fileTypes ?= []
|
||||
|
||||
for name, data of repository
|
||||
@@ -111,7 +111,7 @@ class Rule
|
||||
regex = pattern.regexSource
|
||||
regexes.push regex if regex
|
||||
|
||||
regexScanner = new OnigScanner(regexes)
|
||||
regexScanner = OnigScanner.create(regexes)
|
||||
regexScanner.patterns = patterns
|
||||
@scannersByBaseGrammarName[baseGrammar.name] = regexScanner unless anchored
|
||||
regexScanner
|
||||
|
||||
Reference in New Issue
Block a user