sus 0.18.1 → 0.18.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/sus/file.rb +21 -1
- data/lib/sus/identity.rb +4 -4
- data/lib/sus/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7368b0ed0e288959f59f0fe6c2c5dd93ff90ba52f423b1365406e8de260536c1
|
4
|
+
data.tar.gz: 10fe5fec8209ce9cea739f580a3f4bd1b36be3b6e384f6ff85ad813fad32d0f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1456e34138bea3c5952ababab2950ac946ddce0a3f55879ed1bedb9828c536ffb5c4ced7b9a35f4e80ad1879e230dd26b0fc120b7258e218710530165d9233e5
|
7
|
+
data.tar.gz: b1ea6d027ec46f0aa72e74fd6cb169a71b5209a57791b52b7f41c1a1f2fc7d70353e08e73ebfef2d7262e67a7be10702500d07ee99f18499d898de5b0ad917ed
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/sus/file.rb
CHANGED
@@ -9,6 +9,17 @@ require_relative 'context'
|
|
9
9
|
# This has to be done at the top level. It allows us to define constants within the given class while still retaining top-level constant resolution.
|
10
10
|
Sus::TOPLEVEL_CLASS_EVAL = ->(__klass__, __path__){__klass__.class_eval(::File.read(__path__), __path__)}
|
11
11
|
|
12
|
+
# This is a hack to allow us to get the line number of a syntax error.
|
13
|
+
unless SyntaxError.method_defined?(:lineno)
|
14
|
+
class SyntaxError
|
15
|
+
def lineno
|
16
|
+
if message =~ /:(\d+):/
|
17
|
+
$1.to_i
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
12
23
|
module Sus
|
13
24
|
module File
|
14
25
|
extend Context
|
@@ -41,7 +52,15 @@ module Sus
|
|
41
52
|
|
42
53
|
class FileLoadError
|
43
54
|
def self.build(parent, path, error)
|
44
|
-
identity = Identity.file(parent.identity, path)
|
55
|
+
identity = Identity.file(parent.identity, path)
|
56
|
+
|
57
|
+
# This is a mess.
|
58
|
+
if error.is_a?(SyntaxError) and error.path == path
|
59
|
+
identity = identity.with_line(error.lineno)
|
60
|
+
else
|
61
|
+
identity = identity.scoped(error.backtrace_locations)
|
62
|
+
end
|
63
|
+
|
45
64
|
self.new(identity, path, error)
|
46
65
|
end
|
47
66
|
|
@@ -52,6 +71,7 @@ module Sus
|
|
52
71
|
end
|
53
72
|
|
54
73
|
attr :identity
|
74
|
+
attr :error
|
55
75
|
|
56
76
|
def leaf?
|
57
77
|
true
|
data/lib/sus/identity.rb
CHANGED
@@ -26,6 +26,10 @@ module Sus
|
|
26
26
|
@key = nil
|
27
27
|
end
|
28
28
|
|
29
|
+
def with_line(line)
|
30
|
+
self.class.new(@path, @name, line, @parent, unique: @unique)
|
31
|
+
end
|
32
|
+
|
29
33
|
attr :path
|
30
34
|
attr :name
|
31
35
|
attr :line
|
@@ -103,10 +107,6 @@ module Sus
|
|
103
107
|
|
104
108
|
protected
|
105
109
|
|
106
|
-
def with_line(line)
|
107
|
-
Identity.new(@path, @name, line, @parent, unique: @unique)
|
108
|
-
end
|
109
|
-
|
110
110
|
def append_unique_key(key, unique = @unique)
|
111
111
|
if @parent
|
112
112
|
@parent.append_unique_key(key)
|
data/lib/sus/version.rb
CHANGED
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|